annotate cdcnv.c @ 11:1ee15e2dc386 default tip

added support for macosx
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Fri, 30 Nov 2012 22:10:10 +0900
parents c6f444d2272c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
1 /* cdcnv.c ---------------------------------------------
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
2 $Id: cdcnv.c,v 1.1 2002/12/21 01:13:27 tosy Exp $
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
3
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
4 (以前の履歴は rcctl.c 参照)
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
5 v0.30 97.12.13 コード変換部(cdcnv.c)分離
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
6 v0.31 98.03.07 Mac21対応
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
7 v0.31a 98.03.11 Syncom対応(要rc_send修正)
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
8 v0.31b 98.03.15 ALISA3(L)対応
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
9 v0.32 98.11.29 鉄人,Σ,NET7000対応
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
10 v0.40 02.12.15 B-kara,HyperJOY対応,Σバグ修正
9
c6f444d2272c revised version history
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 4
diff changeset
11 v0.50 11.01.06 libhidを使ってlinux用に書き直し (yaz)
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
12 ------------------------------------------------------*/
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
13
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
14 #include <string.h>
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
15 #include <stdio.h>
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
16 #include "debug.h"
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
17
11
1ee15e2dc386 added support for macosx
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 9
diff changeset
18 #if defined(__FreeBSD__) || defined(linux) || defined(__APPLE__)
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
19 #define stricmp(s, c) strcasecmp(s, c)
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
20 #endif
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
21
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
22 const char mks[] = "XUGJHBPDSNKMALZTCI";
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
23 #define M_X2 0 /* X2000 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
24 #define M_UK 1 /* U-kara */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
25 #define M_GI 2 /* GIGA */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
26 #define M_JO 3 /* JOYSOUND */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
27 #define M_HJ 4 /* HyperJOY */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
28 #define M_BT 5 /* BeMax'S(T) */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
29 #define M_PR 6 /* Prologue21 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
30 #define M_DA 7 /* DAM */
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
31 #define M_SY 8 /* Syncom/孫悟空 */
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
32 #define M_N7 9 /* NET7000 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
33 #define M_BK 10 /* B-kara */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
34 #define M_MA 11 /* Mac21 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
35 #define M_A3 12 /* ALISA3(A) */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
36 #define M_AL 13 /* ALISA3(L) */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
37 #define M_AZ 14 /* ALISA3(Z) */
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
38 #define M_TS 15 /* 東映システム */
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
39 #define M_SI 16 /* Σシステム */
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
40 #define M_TJ 17 /* カラオケの鉄人 */
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
41
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
42 #define K_SE 3
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
43 #define K_KU 4
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
44 #define K_KD 5
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
45 #define K_SP 6
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
46 #define K_ST 7
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
47 #define K_CL 8
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
48 #define K_NM 9
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
49
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
50 int cvt[][21] = {
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
51 /* cd, IDL, IDH, SE, KU, KD, SP, ST, CL, */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
52 /* 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B*/
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
53 {0x30, 0x2e, 0xd1, 0x17, 0x02, 0x03, 0x0c, 0x1c, 0x0d, /* X2000 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
54 0x13, 0x10, 0x14, 0x18, 0x11, 0x15, 0x19, 0x12, 0x16, 0x1a, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
55 {0x30, 0x98, 0x67, 0x0c, 0x13, 0x12, 0x0f, 0x0e, 0x0d, /* U-kara/-2 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
56 0x09, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
57 {0x10, 0x84, 0x10, -1, 0x04, 0x05, 0x0f, 0x01, -1, /* GIGA */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
58 0xf0, 0x60, 0x70, 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
59 {0x40, 0x81, 0x16, 0x1f, 0x54, 0x0b, 0x1d, 0x5c, 0x1c, /* JOYSOUND */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
60 0x00, 0x07, 0x0a, 0x58, 0x03, 0x06, 0x50, 0x01, 0x0e, 0x5d, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
61 {0x20, 0x81, 0x16, 0x1f, 0x54, 0x0b, 0x1d, 0x5c, 0x1c, /* HyperJOY */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
62 0x00, 0x07, 0x0a, 0x58, 0x03, 0x06, 0x50, 0x01, 0x0e, 0x5d, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
63 {0x20, 0xac, 0x53, 0x9d, 0xcc, 0xca, 0x96, 0xdc, 0x9a, /* BeMax'S (T) */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
64 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
65 {0x10, 0x81, 0xb0, 0x33, 0xd3, 0xb3, 0x93, 0x13, -1, /* Prologue21 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
66 0x00, 0x08, 0x04, 0x0c, 0x02, 0x0a, 0x06, 0x0e, 0x01, 0x09, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
67 {0x10, 0xd1, 0x2d, 0x09, 0x04, 0x05, 0x00, 0x01, 0x07, /* DAM */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
68 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
69 {0x60, 0xc3, 0xc3, 0x05, 0x2c, 0x2d, 0x04, 0xc7, 0x02, /* Syncom */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
70 0x0f, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
71 {0x30, 0x84, 0x05, 0x0f, 0x0e, 0x0c, 0x07, -1, 0x1e, /* NET7000 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
72 0x1c, 0x10, 0x11, 0x12, 0x14, 0x15, 0x16, 0x18, 0x19, 0x1a, -1, -1 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
73 {0x10, 0x2e, 0xd1, 0x4c, 0x35, 0x33, 0x4f, 0x4e, 0x4d, /* B-kara */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
74 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
75 {0x30, 0x80, 0x00, 0x03, 0x18, 0x14, 0x1e, -1, 0x07, /* Mac21 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
76 0x00, 0x0c, 0x0d, 0x0e, 0x08, 0x09, 0x0a, 0x04, 0x05, 0x06, 0x01, 0x02 },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
77 {0x30, 0x87, 0x56, 0x12, 0x43, 0x47, 0x11, -1, 0x42, /* ALISA3 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
78 0x0d, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
79 {0x30, 0x87, 0x56, 0x12, 0x43, 0x47, 0x11, -1, 0x42, /* ALISA3 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
80 0x0d, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
81 {0x30, 0x87, 0x56, 0x12, 0x43, 0x47, 0x11, -1, 0x42, /* ALISA3 */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
82 0x0d, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0e, 0x0f },
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
83 {0x30, 0x00, 0xff, 0x41, 0x08, 0x09, 0x4c, 0x45, 0x44, /* TOEI sys */
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
84 0x13, 0x0f, 0x4f, 0x4e, 0x07, 0x47, 0x46, 0x03, 0x43, 0x42, 0x53, 0x52 },
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
85
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
86 {0x10, 0x55, 0xaa, 0x3e, 0x08, 0x09, 0x5c, -1, -1, /* Σ System */
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
87 0x13, 0x0f, 0x4f, 0x4e, 0x07, 0x47, 0x46, 0x03, 0x43, 0x42, 0x53, 0x52 },
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
88
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
89 {0x40, 0xae, 0x51, 0xdc, 0x03, 0x02, 0x96, -1, 0xdd, /* 鉄人 */
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
90 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0xda, 0xdb }
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
91 };
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
92
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
93 int tsc[] = {0x00, 0x04, 0x0c, 0x10, 0x01, 0x05, 0x0d, 0x11};
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
94 int tjc[] = {0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xde, 0xd0, 0xd1, 0xd2, 0xd3};
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
95
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
96 char *cverrstr[] = {
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
97 "Invalid maker code.",
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
98 "Invalid music number.",
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
99 "Invalid function code."
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
100 };
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
101
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
102 int cdcnv(int buf[], char *mak, char *cod)
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
103 {
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
104 int maker, i, c, n, *q;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
105 char *tmp = NULL;
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
106
4
8781bb6d488d raised the debug level required for messaging out
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2
diff changeset
107 debug(2, "mak=%s cod=%s\n", mak, cod);
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
108
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
109 tmp = strchr(mks, *mak & 0xdf);
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
110 if(!tmp)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
111 return -1;
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
112
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
113 maker = (int)(tmp - mks);
4
8781bb6d488d raised the debug level required for messaging out
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 2
diff changeset
114 debug(2, "maker=%d\n", maker);
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
115
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
116 q = buf;
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
117
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
118 *q++ = 0x80; /* wake-up code */
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
119 *q++ = cvt[maker][0];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
120 *q++ = cvt[maker][1];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
121 *q++ = cvt[maker][2];
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
122
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
123 /* 統合機種等でのメーカー名指定 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
124 if ((c = *++mak) != 0) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
125 if ((maker == M_A3)&&('0' <= c)&&(c <= '4'))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
126 cvt[maker][K_SE] = 0x12 + (c - '0');
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
127 else if ((maker == M_AZ)&&('1' <= c)&&(c <= '4'))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
128 *q++ = 0x13 + (c - '1');
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
129 else if ((maker == M_AL)&&('0' <= c)&&(c <= '9')) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
130 *q++ = cvt[maker][K_NM + (c - '0')];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
131 *q++ = 0x10;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
132 }
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
133 else if ((maker == M_TS)&&('1' <= c)&&(c <= '8'))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
134 *q++ = tsc[c - '1'];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
135 else if ((maker == M_TJ)&&('0' <= c)&&(c <= '9'))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
136 *q++ = tjc[c - '1'];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
137 else if ((maker == M_UK)&&('2' == c)) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
138 buf[1] = 0x70;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
139 *q++ = 0xf0;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
140 }
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
141 }
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
142 if (maker == M_BK)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
143 *q++ = 0xf0;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
144
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
145 if (('0' <= *cod)&&(*cod <= '9')) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
146 if (maker == M_DA)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
147 *q++ = 0x08;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
148 else if (maker == M_MA)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
149 *q++ = 0x10; /* Req.1 */
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
150 else if (maker == M_SI) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
151 /* [1-9A-F] -> '01','02',...,'15' , NULL -> '00' */
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
152 if (*mak == 0) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
153 *q++ = cvt[maker][K_NM + 0];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
154 *q++ = cvt[maker][K_NM + 0];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
155 }
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
156 else {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
157 if (mak[1] != 0)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
158 *q++ = cvt[maker][K_NM + (*mak++ - '0')];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
159 else
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
160 *q++ = cvt[maker][K_NM + ((*mak >= 'A')? 1: 0)];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
161 *q++ = cvt[maker][K_NM + ((*mak % 0x41) & 0x0f)];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
162 }
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
163 }
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
164
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
165 /* 曲コード変換 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
166 while((c = *cod++) != '\0') {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
167 if (('0' <= c)&&(c <= '9'))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
168 *q = cvt[maker][c - '0' + K_NM];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
169 else if ((c == 'A')||(c == 'a'))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
170 *q = cvt[maker][10 + K_NM];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
171 else if ((c == 'B')||(c == 'b'))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
172 *q = cvt[maker][11 + K_NM];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
173 else if (c == '-') {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
174 if (maker == M_TJ)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
175 *q = cvt[maker][K_SE];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
176 else
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
177 continue;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
178 }
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
179 else
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
180 *q = -1;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
181 if (*q++ == -1)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
182 return -2;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
183 }
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
184
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
185 /* 送信直前処理 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
186 switch(maker) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
187 case M_X2:
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
188 /* X2000: 曲コードの末尾 2 桁の直前にも SET を送信 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
189 q -= 2;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
190 q[3] = cvt[maker][K_SE];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
191 q[2] = q[1];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
192 q[1] = q[0];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
193 q[0] = cvt[maker][K_SE];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
194 q += 4;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
195 break;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
196
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
197 case M_GI:
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
198 /* GIGA: 曲コードが 6 桁以下の場合は最後に'0'を埋める */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
199 while(q < &buf[10])
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
200 *q++ = cvt[maker][K_NM];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
201 break;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
202
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
203 case M_PR:
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
204 /* Prologue21: */
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
205 for( i=0; i<3; i++ ) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
206 buf[10-i] = 0;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
207 if (q > &buf[4])
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
208 buf[10-i] = *--q << 4;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
209 if (q > &buf[4])
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
210 buf[10-i] |= *--q;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
211 }
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
212 q = &buf[11];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
213 *q++ = 0x33;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
214 buf[4] = buf[8];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
215 buf[5] = buf[9];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
216 buf[6] = buf[10];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
217 buf[7] = buf[11];
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
218 break; /* q=&buf[8] にしないとバグのような… */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
219
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
220 case M_SI:
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
221 /* Σシステム: コード長 10 バイト(<Maker[2]>,<Code[7]>,<SET>)固定 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
222 case M_DA:
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
223 /* DAM: コード長 9 バイト(0x08,<Code[7]>,<SET>)固定 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
224 case M_BK:
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
225 /* B-kara: コード長 9 バイト(0xf0,<Code[7]>,<SET>)固定 */
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
226 n = (maker == M_SI)? 12: 11; /* 数字の最終桁を buf[n] とした値 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
227 for( i=0; i<7; i++ ) {
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
228 c = *(q-1);
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
229 if ((i == 1)&&((c == cvt[maker][K_NM+10])||(c == cvt[maker][K_NM+11])))
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
230 /* 曲コード中の'A','B'以降の桁数が1桁なら'0'を挿入 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
231 buf[n-i] = cvt[maker][K_NM + 0];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
232 else if ((i == 2)&&(c!=cvt[maker][K_NM+10])&&(c!=cvt[maker][K_NM+11]))
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
233 /* 曲コードの末尾 3 文字めが'A','B'でなければ'-'を設定 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
234 buf[n-i] = (maker == M_BK)? 0x3d: ((maker == M_SI)? 0x51: 0x3c);
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
235 else if (q > &buf[n-6])
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
236 buf[n-i] = *--q;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
237 else
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
238 /* 桁数の足らない部分には'0'を設定 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
239 buf[n-i] = cvt[maker][K_NM + 0];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
240 }
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
241 q = &buf[n+1];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
242 default:
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
243 *q++ = cvt[maker][K_SE];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
244 break;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
245 }
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
246 }
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
247 /* 制御コードの処理 */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
248 else {
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
249 *q = -1;
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
250 if (!stricmp(cod, "SE"))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
251 *q = cvt[maker][K_SE];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
252 else if (!stricmp(cod, "KU"))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
253 *q = cvt[maker][K_KU];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
254 else if (!stricmp(cod, "KD"))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
255 *q = cvt[maker][K_KD];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
256 else if (!stricmp(cod, "SP"))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
257 *q = cvt[maker][K_SP];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
258 else if (!stricmp(cod, "ST"))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
259 *q = cvt[maker][K_ST];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
260 else if (!stricmp(cod, "CL"))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
261 *q = cvt[maker][K_CL];
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
262 if (*q == -1)
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
263 return -3;
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
264 q++;
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
265 }
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
266
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
267 if ((maker == M_BK)||((maker == M_UK)&&('2' == *mak)))
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
268 *q++ = 0xf7;
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
269
2
b16b82dbfe87 massive cleanup
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 1
diff changeset
270 buf[1] |= q-buf-2; /* 実送信バイト数(PIC 制御用)を埋め込み */
1
05cc06e88a57 modified to make use of libhid to access the device
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents: 0
diff changeset
271 return q-buf;
0
e1a1a181c0d7 initial import
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff changeset
272 }