Index: parse.c =================================================================== RCS file: /home/ncvs/src/lib/libusbhid/parse.c,v retrieving revision 1.10 diff -u -r1.10 parse.c --- parse.c 11 Feb 2004 21:09:13 -0000 1.10 +++ parse.c 16 Feb 2006 12:46:23 -0000 @@ -54,6 +54,7 @@ int multimax; int kindset; int reportid; + int pending; /* * The start of collection item has no report ID set, so save @@ -155,31 +156,43 @@ c = &s->cur; top: - if (s->multimax) { + if (s->pending) { REPORT_SAVED_COLL; - if (c->logical_minimum >= c->logical_maximum) { - if (s->logminsize == 1) - c->logical_minimum =(int8_t)c->logical_minimum; - else if (s->logminsize == 2) - c->logical_minimum =(int16_t)c->logical_minimum; - } - if (s->multi < s->multimax) { - c->usage = s->usages[min(s->multi, s->nusage-1)]; - s->multi++; + if (s->multimax) { + if (c->logical_minimum >= c->logical_maximum) { + if (s->logminsize == 1) + c->logical_minimum =(int8_t)c->logical_minimum; + else if (s->logminsize == 2) + c->logical_minimum =(int16_t)c->logical_minimum; + } + if (s->multi < s->multimax) { + c->usage = s->usages[min(s->multi, s->nusage-1)]; + s->multi++; + *h = *c; + /* + * 'multimax' is only non-zero if the current + * item kind is input/output/feature + */ + h->pos = s->kindpos[c->kind]; + s->kindpos[c->kind] += c->report_size; + h->next = 0; + return (1); + } else { + c->report_count = s->multimax; + s->multimax = 0; + s->nusage = 0; + hid_clear_local(c); + s->pending = 0; + } + } else { *h = *c; - /* - * 'multimax' is only non-zero if the current - * item kind is input/output/feature - */ - h->pos = s->kindpos[c->kind]; - s->kindpos[c->kind] += c->report_size; h->next = 0; - return (1); - } else { - c->report_count = s->multimax; - s->multimax = 0; - s->nusage = 0; + h->pos = s->kindpos[c->kind]; + s->kindpos[c->kind] += + c->report_size * c->report_count; hid_clear_local(c); + s->pending = 0; + return (1); } } for (;;) { @@ -258,19 +271,13 @@ c->usage_maximum = 0; s->minset = 0; } - goto top; } else { if (s->minset) c->usage = c->usage_minimum; - *h = *c; - h->next = 0; - h->pos = s->kindpos[c->kind]; - s->kindpos[c->kind] += - c->report_size * c->report_count; - hid_clear_local(c); s->minset = 0; - return (1); } + s->pending = 1; + goto top; case 9: /* Output */ retkind = hid_output; goto ret; @@ -296,7 +303,6 @@ retkind = hid_feature; goto ret; case 12: /* End collection */ - REPORT_SAVED_COLL; c->kind = hid_endcollection; c->collevel--; *h = *c;