Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Fix another descriptor parsing bug. Thanks to T...
details: https://anonhg.NetBSD.org/src/rev/77610b552b2f
branches: trunk
changeset: 520073:77610b552b2f
user: augustss <augustss%NetBSD.org@localhost>
date: Wed Jan 02 11:10:50 2002 +0000
description:
Fix another descriptor parsing bug. Thanks to Tero Kivinen for
patiently supplying me with debug output.
diffstat:
sys/dev/usb/hid.c | 27 +++++++++++++++------------
1 files changed, 15 insertions(+), 12 deletions(-)
diffs (74 lines):
diff -r 541b78b92213 -r 77610b552b2f sys/dev/usb/hid.c
--- a/sys/dev/usb/hid.c Wed Jan 02 10:38:27 2002 +0000
+++ b/sys/dev/usb/hid.c Wed Jan 02 11:10:50 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hid.c,v 1.20 2001/12/29 18:56:20 augustss Exp $ */
+/* $NetBSD: hid.c,v 1.21 2002/01/02 11:10:50 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/hid.c,v 1.11 1999/11/17 22:33:39 n_hibma Exp $ */
/*
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.20 2001/12/29 18:56:20 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hid.c,v 1.21 2002/01/02 11:10:50 augustss Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -131,6 +131,7 @@
u_char *p;
struct hid_item *hi;
int i;
+ enum hid_kind retkind;
top:
DPRINTFN(5,("hid_get_item: multi=%d multimax=%d\n",
@@ -204,10 +205,15 @@
case 0: /* Main */
switch (bTag) {
case 8: /* Input */
- if (s->kind != hid_input)
+ retkind = hid_input;
+ ret:
+ if (s->kind != retkind) {
+ s->minset = 0;
+ s->nu = 0;
+ hid_clear_local(c);
continue;
- c->kind = hid_input;
- ret:
+ }
+ c->kind = retkind;
c->flags = dval;
if (c->flags & HIO_VARIABLE) {
s->multimax = c->loc.count;
@@ -230,14 +236,13 @@
h->next = NULL;
c->loc.pos +=
c->loc.size * c->loc.count;
+ s->minset = 0;
+ s->nu = 0;
hid_clear_local(c);
- s->minset = 0;
return (1);
}
case 9: /* Output */
- if (s->kind != hid_output)
- continue;
- c->kind = hid_output;
+ retkind = hid_output;
goto ret;
case 10: /* Collection */
c->kind = hid_collection;
@@ -248,9 +253,7 @@
s->nu = 0;
return (1);
case 11: /* Feature */
- if (s->kind != hid_feature)
- continue;
- c->kind = hid_feature;
+ retkind = hid_feature;
goto ret;
case 12: /* End collection */
c->kind = hid_endcollection;
Home |
Main Index |
Thread Index |
Old Index