On Fri, May 28, 2021 at 09:52:57PM -0500, joshua stein wrote:
> On Wed, 26 May 2021 at 08:13:52 +0200, Anton Lindqvist wrote:
> > On Tue, May 25, 2021 at 08:31:14AM +0200, Anton Lindqvist wrote:
> > > On Mon, May 24, 2021 at 09:17:26AM -0500, joshua stein wrote:
> > > > This is useful for parsing the report descriptor with a different 
> > > > tool to find issues with our HID parser.
> > > > 
> > > > I've found https://eleccelerator.com/usbdescreqparser/ to be 
> > > > helpful.
> > > > 
> > > > 
> > > > diff --git usr.bin/usbhidctl/usbhid.c usr.bin/usbhidctl/usbhid.c
> > > > index 921f211a280..bd0b5da0222 100644
> > > > --- usr.bin/usbhidctl/usbhid.c
> > > > +++ usr.bin/usbhidctl/usbhid.c
> > > > @@ -106,6 +106,11 @@ static struct {
> > > >  #define REPORT_MAXVAL 2
> > > >  };
> > > >  
> > > > +struct report_desc {
> > > > +       uint32_t size;
> > > > +       uint8_t data[1];
> > > > +};
> > > 
> > > This structure is defined in lib/libusbhid/usbvar.h which is not
> > > installed. Maybe it should and avoid this repetition and potential ABI
> > > breaks (quite unlikely but still)?
> > 
> > Another approach which keeps the structure opaque is the extend the
> > usbhid(3) API with something like:
> > 
> >     void
> >     hid_get_report_desc_data(report_desc_t d, uint8_t **data, uint32_t 
> > *size)
> >     {
> >             *data = d->data;
> >             *size = d->size;
> >     }
> 
> Here's a version of that:

libusbhid needs a minor bump:

Index: lib/libusbhid/shlib_version
===================================================================
RCS file: /cvs/src/lib/libusbhid/shlib_version,v
retrieving revision 1.8
diff -u -p -r1.8 shlib_version
--- lib/libusbhid/shlib_version 12 May 2014 17:03:28 -0000      1.8
+++ lib/libusbhid/shlib_version 30 May 2021 07:04:33 -0000
@@ -1,2 +1,2 @@
 major=7
-minor=0
+minor=1
Index: distrib/sets/lists/base/mi
===================================================================
RCS file: /cvs/src/distrib/sets/lists/base/mi,v
retrieving revision 1.1022
diff -u -p -r1.1022 mi
--- distrib/sets/lists/base/mi  27 May 2021 05:51:50 -0000      1.1022
+++ distrib/sets/lists/base/mi  30 May 2021 07:04:51 -0000
@@ -675,7 +675,7 @@
 ./usr/lib/libtermcap.so.14.0
 ./usr/lib/libtermlib.so.14.0
 ./usr/lib/libtls.so.21.0
-./usr/lib/libusbhid.so.7.0
+./usr/lib/libusbhid.so.7.1
 ./usr/lib/libutil.so.15.0
 ./usr/lib/libz.so.5.0
 ./usr/lib/locate

Reply via email to