summaryrefslogtreecommitdiff
blob: 5a5cd7d3fcb95cf8deb3f925d76af916ad2b10fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
- Support for other hardware
- ssr comment in the mouse array.
- Use of defines for numeric constants to improve code readability.
- Debian patch integrated

diff -Nuar --exclude '*~' lomoco-1.0.old/src/lomoco.c lomoco-1.0/src/lomoco.c
--- lomoco-1.0.old/src/lomoco.c	2006-03-01 06:10:05.000000000 -0800
+++ lomoco-1.0/src/lomoco.c	2006-04-30 02:38:05.107430674 -0700
@@ -32,11 +32,12 @@
  * model:	you can find on the hardware, look for M/N: ...
  * csr:		mouse with receiver (wireless)
  * res:		mouse has resolution control
- * sms:		mouse has smart control
+ * ssr:     mouse has smart scroll reporting
+ * sms:		mouse has smart scroll
  * dual:	dual receiver (wireless mouse+wireless keyboard)
  *
  *   product id,  name,                                        model,    csr, res, ssr, sms, dual */
-mouse_t mice [] = {
+static mouse_t mice [] = {
 	{0xc00e, "Wheel Mouse Optical",                        "M-BJ58",      0, 1, 0, 0, 0},
 	{0xc00f, "MouseMan Traveler",                          "M-BJ79",      0, 1, 0, 0, 0},
 	{0xc012, "MouseMan Dual Optical",                      "M-BL63B",     0, 1, 0, 0, 0},
@@ -42,6 +42,7 @@
 	{0xc012, "MouseMan Dual Optical",                      "M-BL63B",     0, 1, 0, 0, 0},
 	{0xc01d, "MX510 Optical Mouse",                        "M-BS81A",     0, 1, 1, 1, 0},
 	{0xc01e, "MX518 Optical Mouse",                        "M-BS81A",     0, 1, 1, 0, 0},
+	{0xc051, "MX518 Optical Mouse",                        "M-BS81A",     0, 1, 1, 0, 0},
 	{0xc024, "MX300 Optical Mouse",                        "M-BP82",      0, 1, 0, 0, 0},
 	{0xc01b, "MX310 Optical Mouse",                        "M-BP86",      0, 1, 0, 0, 0},
 	{0xc025, "MX500 Optical Mouse",                        "M-BP81A",     0, 1, 1, 1, 0},
@@ -49,50 +50,37 @@
 	{0xc041, "G5 Laser Gaming Mouse",                      "M-UAC113",    0, 1, 0, 1, 0},
 	{0xc501, "Mouse Receiver",                             "C-BA4-MSE",   1, 0, 0, 0, 0},
 	{0xc502, "Dual Receiver",                              "C-UA3-DUAL",  1, 0, 0, 0, 1},
-	{0xc503, "Receiver for MX900 Receiver",                "C-UJ16A",     1, 0, 0, 1, 0},
+	{0xc503, "Receiver for MX900",                         "C-UJ16A",     1, 0, 0, 1, 0},
 	{0xc504, "Receiver for Cordless Freedom Optical",      "C-BD9-DUAL",  1, 0, 0, 0, 1},
 	{0xc505, "Receiver for Cordless Elite Duo",            "C-BG17-DUAL", 1, 0, 0, 0, 1},
 	{0xc506, "Receiver for MX700 Optical Mouse",           "C-BF16-MSE",  1, 0, 0, 1, 0},
 	{0xc508, "Receiver for Cordless Optical TrackMan",     "C-BA4-MSE",   1, 0, 0, 1, 0},
-	{0xc702, "Receiver for Cordless Presenter",            "C-UF15",      1, 0, 0, 0, 0},
-	{0xc704, "Receiver for diNovo Media Desktop",          "C-BQ16A",     1, 0, 1, 1, 0},
+	
+	/* From Michele Noberasco <s4t4n@gentoo.org> */
+	{0xc50a, "Reciveer for Cordless Optical Mouse for Notebooks", "C-BJ27-MSE",  1, 0, 0, 0, 0},
+	
+	/* From Robin H. Johnson <robbat2@gentoo.org> */
+	{0xc50b, "Receiver for Cordless Desktop MX",           "C-BK16A-DUAL",1, 0, 0, 1, 1},
+
 	/* From Markus Wiesner <m_wiesner@gmx.net> */
 	{0xc50e, "Receiver for MX1000 Laser",                  "C-BN34",      1, 0, 1, 1, 0},
 	{0xc512, "Receiver for Cordless Desktop MX3100 Laser", "C-BO34",      1, 0, 0, 1, 1},
+
+	{0xc702, "Receiver for Cordless Presenter",            "C-UF15",      1, 0, 0, 0, 0},
+	{0xc704, "Receiver for diNovo Media Desktop",          "C-BQ16A",     1, 0, 1, 1, 0},
 	{0x0000, NULL, NULL, 0, 0, 0, 0}
 };
 
-
 /*
- * Description:	Query the mouse and report all cordless mouse specific infos
+ * Description:	Print out a set of CSR data
  *		e.g. receiver type, mouse type, battery status
  *
- * Parameters:	mouse_t *m
- *			mouse struct with the mouse specs
- *		struct usb_dev_handle *handle
- *			usb device handle of the mouse
- *		unsigned int addr
- *			address for dual receivers
+ * Parameters:	unsigned char* buf
+ *			result from query_csr internals
  *
  * Return:	void
  */
-static void query_csr(mouse_t *m, struct usb_dev_handle *handle,
-			unsigned int addr) {
-	unsigned char buf[12] = {0};
-	
-	if (usb_control_msg (	handle,
-				USB_TYPE_VENDOR | USB_ENDPOINT_IN,
-				0x09,
-				(0x0003 | addr),
-				(0x0000 | addr),
-				(char *) buf,
-				8,
-				TIMEOUT		) != 8) {
-
-		perror("Writing to USB device: CSR");
-		exit(EXIT_FAILURE);
-	}
-
+static void print_csr(unsigned char* buf) {
 	/* We have not obtained blocks P6 P0 P4 P5 P8 P9 PB0 PB1 */
 
 	/* Is a C504 receiver busy? */
@@ -111,6 +99,7 @@
 		case 0x3c: printf ("C508\n"); break;
 		case 0x3d: printf ("C506\n"); break;
 		case 0x3e: printf ("C505\n"); break;
+		case 0x3f: printf ("C50B\n"); break;
 		case 0x42: printf ("C512\n"); break;
 	default: printf ("Unknown (type %x)\n", P0);
 	}
@@ -138,6 +127,7 @@
 		case 0x82: printf ("Cordless Optical TrackMan\n"); break;
 		case 0x8A: printf ("MX700 Cordless Optical Mouse\n"); break;
 		case 0x8B: printf ("MX700 Cordless Optical Mouse (2ch)\n"); break;
+		case 0x94: printf ("Cordless Optical Mouse for Notebooks\n"); break;
 	default: printf ("Unknown (type %x)\n", P4);
 	}
 
@@ -199,6 +189,38 @@
 	}
 }
 
+/*
+ * Description:	Query the mouse and report all cordless mouse specific infos
+ *		e.g. receiver type, mouse type, battery status
+ *
+ * Parameters:	mouse_t *m
+ *			mouse struct with the mouse specs
+ *		struct usb_dev_handle *handle
+ *			usb device handle of the mouse
+ *		unsigned int addr
+ *			address for dual receivers
+ *
+ * Return:	void
+ */
+static void query_csr(mouse_t *m, struct usb_dev_handle *handle,
+			unsigned int addr) {
+	unsigned char buf[12] = {0};
+	
+	if (usb_control_msg (	handle,
+				USB_TYPE_VENDOR | USB_ENDPOINT_IN,
+				REQUEST_MOUSE_CSR,
+				(0x0003 | addr),
+				(0x0000 | addr),
+				(char *) buf,
+				8,
+				TIMEOUT		) != 8) {
+
+		perror("Writing to USB device: CSR");
+		exit(EXIT_FAILURE);
+	}
+	print_csr(buf);
+
+}
 
 /*
  * Description:	Query the mouse and report the current resolution
@@ -218,8 +240,8 @@
 
 	if (usb_control_msg (	handle,
 				USB_TYPE_VENDOR | USB_ENDPOINT_IN,
-				0x01,
-				(0x000e | addr),
+				REQUEST_MOUSE_GET_RES_SSR,
+				(VALUE_MOUSE_GET_RES | addr),
 				(0x0000 | addr),
 				(char *) buf,
 				1,
@@ -255,8 +277,8 @@
 	if (m->has_ssr) {
 		if (usb_control_msg (	handle,
 					USB_TYPE_VENDOR | USB_ENDPOINT_IN,
-					0x01,
-					(0x0017 | addr),
+					REQUEST_MOUSE_GET_RES_SSR,
+					(VALUE_MOUSE_GET_SSR | addr),
 					(0x0000 | addr),
 					(char*) buf,
 					1,
@@ -394,8 +416,8 @@
 		assert ((set_channel == 1) || (set_channel == 2));
 		if (usb_control_msg (	handle,
 					USB_TYPE_VENDOR,
-					0x02,
-					(0x0008 | addr),
+					REQUEST_MOUSE_PUT_RES_SMS,
+					(VALUE_MOUSE_CHANNEL | addr),
 					((set_channel - 1) | addr),
 					NULL,
 					0,
@@ -412,8 +434,8 @@
 	if (set_unlock) {
 		if (usb_control_msg (	handle,
 					USB_TYPE_VENDOR,
-					0x02,
-					(0x06 | addr),
+					REQUEST_MOUSE_PUT_RES_SMS,
+					(VALUE_MOUSE_UNLOCK | addr),
 					(0x1 | addr),
 					NULL,
 					0,
@@ -430,8 +452,8 @@
 	if (set_lock) {
 		if (usb_control_msg (	handle,
 					USB_TYPE_VENDOR,
-					0x02,
-					(0x0006 | addr),
+					REQUEST_MOUSE_PUT_RES_SMS,
+					(VALUE_MOUSE_UNLOCK | addr),
 					(0x0000 | addr),
 					NULL,
 					0,
@@ -448,8 +470,8 @@
 	if (set_clear) {
 		if (usb_control_msg (	handle,
 					USB_TYPE_VENDOR,
-					0x09,
-					(0x0004 | addr),
+					REQUEST_MOUSE_CSR,
+					(VALUE_MOUSE_CLEAR | addr),
 					(0x0000 | addr),
 					NULL,
 					0,
@@ -483,8 +505,8 @@
 		
 	if (usb_control_msg (	handle,
 				USB_TYPE_VENDOR,
-				0x0002,
-				0x000e,
+				REQUEST_MOUSE_PUT_RES_SMS,
+				VALUE_MOUSE_PUT_RES,
 				(set_res / 400) + 2,
 				NULL,
 				0,
@@ -514,8 +536,8 @@
 	assert ((set_sms == 1) || (set_sms == -1));
 	if (usb_control_msg (	handle,
 				USB_TYPE_VENDOR,
-				0x02,
-				0x0017,
+				REQUEST_MOUSE_PUT_RES_SMS,
+				VALUE_MOUSE_PUT_SSR,
 				(set_sms == 1 ? 0x0001 : 0x0000),
 				NULL,
 				0,
@@ -641,7 +663,7 @@
 		/* Do we support this device? If so, list it. */
 		if ((m = find_mouse (device)) != NULL) {
 			
-			printf ("%s.%s: %04x:%04x %s (%s) Caps: %s%s%s\n",
+			printf ("%s.%s: %04x:%04x %s (%s) Caps: %s%s%s%s\n",
 				device->bus->dirname,
 				device->filename,
 				device->descriptor.idVendor,
@@ -650,6 +672,7 @@
 				m->model,
 				m->has_csr? "CSR ": "",
 				m->has_res? "RES ": "",
+				m->has_ssr? "SSR ": "",
 				m->has_sms? "SMS ": ""
 				);
 		}
@@ -667,7 +671,7 @@
 				device->filename,
 				device->descriptor.idVendor,
 				device->descriptor.idProduct,
-				ret ? product : "Unknown"
+				ret > 0 ? product : "Unknown"
 				);
 			continue;
 		}
diff -Nuar --exclude '*~' lomoco-1.0.old/src/lomoco.h lomoco-1.0/src/lomoco.h
--- lomoco-1.0.old/src/lomoco.h	2006-03-01 06:10:05.000000000 -0800
+++ lomoco-1.0/src/lomoco.h	2006-04-30 02:34:04.381175920 -0700
@@ -97,4 +97,17 @@
 		int	is_dual;
 } mouse_t;
 
+
+#define REQUEST_MOUSE_CSR			0x09
+#define		VALUE_MOUSE_GET			0x0003
+#define		VALUE_MOUSE_CLEAR		0x0004
+#define REQUEST_MOUSE_GET_RES_SSR	0x01
+#define		VALUE_MOUSE_GET_RES		0x000e
+#define		VALUE_MOUSE_GET_SSR		0x0017
+#define REQUEST_MOUSE_PUT_RES_SMS	0x02
+#define		VALUE_MOUSE_UNLOCK		0x0006
+#define		VALUE_MOUSE_CHANNEL		0x0008
+#define		VALUE_MOUSE_PUT_RES		0x000e
+#define		VALUE_MOUSE_PUT_SSR		0x0017
+
 #endif /* __LOMOCO_H */