Handle report IDs a little better (but still not right).

This commit is contained in:
augustss 2000-02-22 12:39:22 +00:00
parent d7e9d324f9
commit 18654c9f8e
3 changed files with 9 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: parse.c,v 1.7 1999/10/13 17:48:04 drochner Exp $ */ /* $NetBSD: parse.c,v 1.8 2000/02/22 12:39:22 augustss Exp $ */
/* /*
* Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org> * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
@ -226,6 +226,7 @@ hid_get_item(hid_data_t s, hid_item_t *h)
c->collevel++; c->collevel++;
*h = *c; *h = *c;
hid_clear_local(c); hid_clear_local(c);
c->report_ID = NO_REPORT_ID;
s->nusage = 0; s->nusage = 0;
return (1); return (1);
case 11: /* Feature */ case 11: /* Feature */
@ -238,7 +239,7 @@ hid_get_item(hid_data_t s, hid_item_t *h)
c->kind = hid_endcollection; c->kind = hid_endcollection;
c->collevel--; c->collevel--;
*h = *c; *h = *c;
hid_clear_local(c); /*hid_clear_local(c);*/
s->nusage = 0; s->nusage = 0;
return (1); return (1);
default: default:
@ -364,7 +365,7 @@ hid_report_size(report_desc_t r, enum hid_kind k, int *idp)
*idp = 0; *idp = 0;
memset(&h, 0, sizeof h); memset(&h, 0, sizeof h);
for (d = hid_start_parse(r, 1<<k); hid_get_item(d, &h); ) { for (d = hid_start_parse(r, 1<<k); hid_get_item(d, &h); ) {
if (h.report_ID != 0) { if (h.report_ID != NO_REPORT_ID) {
if (idp) if (idp)
*idp = h.report_ID; *idp = h.report_ID;
id = 8; id = 8;

View File

@ -1,4 +1,4 @@
.\" $NetBSD: usb.3,v 1.9 1999/11/08 22:33:40 augustss Exp $ .\" $NetBSD: usb.3,v 1.10 2000/02/22 12:39:22 augustss Exp $
.\" .\"
.\" Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org> .\" Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
.\" All rights reserved. .\" All rights reserved.
@ -75,7 +75,7 @@ The
.Nm .Nm
library provides routines to extract data from USB Human Interface Devices. library provides routines to extract data from USB Human Interface Devices.
.Ss INTRODUCTION .Ss INTRODUCTION
USB HID devices send and receive data layed out a device dependent USB HID devices send and receive data layed out in a device dependent
way. The way. The
.Nm .Nm
library contains routines to extract the library contains routines to extract the
@ -102,7 +102,7 @@ To parse the report descriptor the
.Fn hid_start_parse .Fn hid_start_parse
function should be called with a report descriptor and a set that function should be called with a report descriptor and a set that
describes which items that are interesting. The set is obtained describes which items that are interesting. The set is obtained
by oring together values by or-ing together values
.Fa "(1 << k)" .Fa "(1 << k)"
where where
.Fa k .Fa k

View File

@ -1,4 +1,4 @@
/* $NetBSD: usb.h,v 1.5 1999/07/02 15:46:53 simonb Exp $ */ /* $NetBSD: usb.h,v 1.6 2000/02/22 12:39:22 augustss Exp $ */
/* /*
* Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org> * Copyright (c) 1999 Lennart Augustsson <augustss@netbsd.org>
@ -45,6 +45,7 @@ typedef struct hid_item {
int unit; int unit;
int report_size; int report_size;
int report_ID; int report_ID;
#define NO_REPORT_ID 0
int report_count; int report_count;
/* Local */ /* Local */
unsigned int usage; unsigned int usage;