View | Details | Raw Unified | Return to bug 117911 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/usb/hid.c (-5 / +20 lines)
Lines 72-77 Link Here
72
	int multi;
72
	int multi;
73
	int multimax;
73
	int multimax;
74
	int kindset;
74
	int kindset;
75
	int usage;
75
};
76
};
76
77
77
static void
78
static void
Lines 115-121 Link Here
115
}
116
}
116
117
117
int
118
int
118
hid_get_item(struct hid_data *s, struct hid_item *h)
119
hid_get_item(struct hid_data *s, u_int32_t u, struct hid_item *h)
119
{
120
{
120
	struct hid_item *c = &s->cur;
121
	struct hid_item *c = &s->cur;
121
	unsigned int bTag, bType, bSize;
122
	unsigned int bTag, bType, bSize;
Lines 193-198 Link Here
193
		case 0:			/* Main */
194
		case 0:			/* Main */
194
			switch (bTag) {
195
			switch (bTag) {
195
			case 8:		/* Input */
196
			case 8:		/* Input */
197
				if (s->usage != u >>16 && u != 0)
198
					break;
199
196
				if (!(s->kindset & (1 << hid_input)))
200
				if (!(s->kindset & (1 << hid_input)))
197
					continue;
201
					continue;
198
				c->kind = hid_input;
202
				c->kind = hid_input;
Lines 223-228 Link Here
223
					return (1);
227
					return (1);
224
				}
228
				}
225
			case 9:		/* Output */
229
			case 9:		/* Output */
230
				if (s->usage != u >>16 && u != 0)
231
					break;
232
226
				if (!(s->kindset & (1 << hid_output)))
233
				if (!(s->kindset & (1 << hid_output)))
227
					continue;
234
					continue;
228
				c->kind = hid_output;
235
				c->kind = hid_output;
Lines 232-242 Link Here
232
				c->kind = hid_collection;
239
				c->kind = hid_collection;
233
				c->collection = dval;
240
				c->collection = dval;
234
				c->collevel++;
241
				c->collevel++;
242
				if (c->collevel > 0 && u != 0)
243
					s->usage = c->_usage_page >> 16;
235
				*h = *c;
244
				*h = *c;
236
				hid_clear_local(c);
245
				hid_clear_local(c);
237
				s->nu = 0;
246
				s->nu = 0;
238
				return (1);
247
				return (1);
239
			case 11:	/* Feature */
248
			case 11:	/* Feature */
249
				if (s->usage != u >>16 && u != 0)
250
					break;
251
240
				if (!(s->kindset & (1 << hid_feature)))
252
				if (!(s->kindset & (1 << hid_feature)))
241
					continue;
253
					continue;
242
				c->kind = hid_feature;
254
				c->kind = hid_feature;
Lines 258-263 Link Here
258
			switch (bTag) {
270
			switch (bTag) {
259
			case 0:
271
			case 0:
260
				c->_usage_page = dval << 16;
272
				c->_usage_page = dval << 16;
273
274
				if (u != 0 && u>>16 == dval)
275
					s->usage = dval;
261
				break;
276
				break;
262
			case 1:
277
			case 1:
263
				c->logical_minimum = dval;
278
				c->logical_minimum = dval;
Lines 364-370 Link Here
364
}
379
}
365
380
366
int
381
int
367
hid_report_size(void *buf, int len, enum hid_kind k, u_int8_t *idp)
382
hid_report_size(void *buf, int len, u_int32_t u, enum hid_kind k, u_int8_t *idp)
368
{
383
{
369
	struct hid_data *d;
384
	struct hid_data *d;
370
	struct hid_item h;
385
	struct hid_item h;
Lines 372-378 Link Here
372
387
373
	id = 0;
388
	id = 0;
374
	hi = lo = -1;
389
	hi = lo = -1;
375
	for (d = hid_start_parse(buf, len, 1<<k); hid_get_item(d, &h); )
390
	for (d = hid_start_parse(buf, len, 1<<k); hid_get_item(d, u, &h); )
376
		if (h.kind == k) {
391
		if (h.kind == k) {
377
			if (h.report_ID != 0 && !id)
392
			if (h.report_ID != 0 && !id)
378
				id = h.report_ID;
393
				id = h.report_ID;
Lines 399-405 Link Here
399
	struct hid_data *d;
414
	struct hid_data *d;
400
	struct hid_item h;
415
	struct hid_item h;
401
416
402
	for (d = hid_start_parse(desc, size, 1<<k); hid_get_item(d, &h); ) {
417
	for (d = hid_start_parse(desc, size, 1<<k); hid_get_item(d, u, &h); ) {
403
		if (h.kind == k && !(h.flags & HIO_CONST) && h.usage == u) {
418
		if (h.kind == k && !(h.flags & HIO_CONST) && h.usage == u) {
404
			if (loc != NULL)
419
			if (loc != NULL)
405
				*loc = h.loc;
420
				*loc = h.loc;
Lines 452-458 Link Here
452
	if (hd == NULL)
467
	if (hd == NULL)
453
		return (0);
468
		return (0);
454
469
455
	err = hid_get_item(hd, &hi) &&
470
	err = hid_get_item(hd, usage, &hi) &&
456
	    hi.kind == hid_collection &&
471
	    hi.kind == hid_collection &&
457
	    hi.usage == usage;
472
	    hi.usage == usage;
458
	hid_end_parse(hd);
473
	hid_end_parse(hd);
(-)sys/dev/usb/hid.h (-2 / +2 lines)
Lines 82-89 Link Here
82
82
83
struct hid_data *hid_start_parse(void *d, int len, int kindset);
83
struct hid_data *hid_start_parse(void *d, int len, int kindset);
84
void hid_end_parse(struct hid_data *s);
84
void hid_end_parse(struct hid_data *s);
85
int hid_get_item(struct hid_data *s, struct hid_item *h);
85
int hid_get_item(struct hid_data *s, u_int32_t u, struct hid_item *h);
86
int hid_report_size(void *buf, int len, enum hid_kind k, u_int8_t *id);
86
int hid_report_size(void *buf, int len, u_int32_t u, enum hid_kind k, u_int8_t *id);
87
int hid_locate(void *desc, int size, u_int32_t usage,
87
int hid_locate(void *desc, int size, u_int32_t usage,
88
		    enum hid_kind kind, struct hid_location *loc,
88
		    enum hid_kind kind, struct hid_location *loc,
89
		    u_int32_t *flags);
89
		    u_int32_t *flags);
(-)sys/dev/usb/ucycom.c (-3 / +3 lines)
Lines 221-229 Link Here
221
	}
221
	}
222
222
223
	/* get report sizes */
223
	/* get report sizes */
224
	sc->sc_flen = hid_report_size(urd, urdlen, hid_feature, &sc->sc_fid);
224
	sc->sc_flen = hid_report_size(urd, urdlen, 0, hid_feature, &sc->sc_fid); /* NEED TO BE FIXX ????? */
225
	sc->sc_ilen = hid_report_size(urd, urdlen, hid_input, &sc->sc_iid);
225
	sc->sc_ilen = hid_report_size(urd, urdlen, 0, hid_input, &sc->sc_iid);	/* NEED TO BE FIXX ????? */
226
	sc->sc_olen = hid_report_size(urd, urdlen, hid_output, &sc->sc_oid);
226
	sc->sc_olen = hid_report_size(urd, urdlen, 0, hid_output, &sc->sc_oid);	/* NEED TO BE FIXX ????? */
227
227
228
	if (sc->sc_ilen > UCYCOM_MAX_IOLEN || sc->sc_olen > UCYCOM_MAX_IOLEN) {
228
	if (sc->sc_ilen > UCYCOM_MAX_IOLEN || sc->sc_olen > UCYCOM_MAX_IOLEN) {
229
		device_printf(dev, "I/O report size too big (%zu, %zu, %u)\n",
229
		device_printf(dev, "I/O report size too big (%zu, %zu, %u)\n",
(-)sys/dev/usb/uhid.c (-3 / +3 lines)
Lines 320-328 Link Here
320
320
321
	(void)usbd_set_idle(iface, 0, 0);
321
	(void)usbd_set_idle(iface, 0, 0);
322
322
323
	sc->sc_isize = hid_report_size(desc, size, hid_input,   &sc->sc_iid);
323
	sc->sc_isize = hid_report_size(desc, size, 0, hid_input,   &sc->sc_iid);
324
	sc->sc_osize = hid_report_size(desc, size, hid_output,  &sc->sc_oid);
324
	sc->sc_osize = hid_report_size(desc, size, 0, hid_output,  &sc->sc_oid);
325
	sc->sc_fsize = hid_report_size(desc, size, hid_feature, &sc->sc_fid);
325
	sc->sc_fsize = hid_report_size(desc, size, 0, hid_feature, &sc->sc_fid);
326
326
327
	sc->sc_repdesc = desc;
327
	sc->sc_repdesc = desc;
328
	sc->sc_repdesc_size = size;
328
	sc->sc_repdesc_size = size;
(-)sys/dev/usb/ums.c (-1 / +3 lines)
Lines 358-364 Link Here
358
		hid_locate(desc, size, HID_USAGE2(HUP_BUTTON, i),
358
		hid_locate(desc, size, HID_USAGE2(HUP_BUTTON, i),
359
				hid_input, &sc->sc_loc_btn[i-1], 0);
359
				hid_input, &sc->sc_loc_btn[i-1], 0);
360
360
361
	sc->sc_isize = hid_report_size(desc, size, hid_input, &sc->sc_iid);
361
	sc->sc_isize = hid_report_size(desc, size, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_MOUSE),
362
					hid_input, &sc->sc_iid);
362
	sc->sc_ibuf = malloc(sc->sc_isize, M_USB, M_NOWAIT);
363
	sc->sc_ibuf = malloc(sc->sc_isize, M_USB, M_NOWAIT);
363
	if (!sc->sc_ibuf) {
364
	if (!sc->sc_ibuf) {
364
		printf("%s: no memory\n", device_get_nameunit(sc->sc_dev));
365
		printf("%s: no memory\n", device_get_nameunit(sc->sc_dev));
Lines 393-398 Link Here
393
	 * descriptor), it seems that report id 17 contains the necessary
394
	 * descriptor), it seems that report id 17 contains the necessary
394
	 * mouse information(3-buttons,X,Y,wheel) so we specify it manually.
395
	 * mouse information(3-buttons,X,Y,wheel) so we specify it manually.
395
	 */
396
	 */
397
	/* IS IT NESSESARY ??? NEED TO BE RECHECK !!!!!!! AND EXCLUDE */
396
	if (uaa->vendor == USB_VENDOR_MICROSOFT &&
398
	if (uaa->vendor == USB_VENDOR_MICROSOFT &&
397
	    uaa->product == USB_PRODUCT_MICROSOFT_WLNOTEBOOK3) {
399
	    uaa->product == USB_PRODUCT_MICROSOFT_WLNOTEBOOK3) {
398
		sc->flags = UMS_Z;
400
		sc->flags = UMS_Z;

Return to bug 117911