On Thu, Nov 11, 2021 at 05:09:35PM -0800, Greg Steuck wrote:
> Anton Lindqvist <an...@openbsd.org> writes:
> 
> > On Thu, Nov 11, 2021 at 03:29:15PM +0100, Anton Lindqvist wrote:
> >> Hi,
> >> The second attempt to solve the uhidev claim multiple report ids
> >> conflict didn't work out either as it broke fido(4). Signalling claim
> >> multiple report ids to the match routines using the report id does not
> >> work as all 256 values already have semantic meaning. I instead want to
> >> use `uha->claimed != NULL' to signal that multiple report ids can be
> >> claimed. Before doing so, refactor in order to make an upcoming diff
> >> with the actual fix significantly smaller.
> >> 
> >> No intended^W functional change.
> >> 
> >> Comments? OK?
> >
> > ... and here's the actual fix applied on top of the previous diff.
> 
> The pair of diffs seems to work for me (fido remains operational unlike
> the previous iteration). There's a minor change in dmesg output which is
> not otherwise consequential:

Thanks, some drivers (ums and ukbd for instance) are still missing a
UHIDEV_CLAIM_MULTIPLE_REPORTID conditional. That can be fixed later on.
For now, keep using 255 as the report id when claiming multiple report
ids.

Here's a new iteration of the second diff. Another round of testing
would be much appreciated.

diff --git sys/dev/usb/uhidev.h sys/dev/usb/uhidev.h
index 86217fb8880..b8daf014662 100644
--- sys/dev/usb/uhidev.h
+++ sys/dev/usb/uhidev.h
@@ -75,12 +75,11 @@ struct uhidev_attach_arg {
        struct usb_attach_arg   *uaa;
        struct uhidev_softc     *parent;
        uint8_t                  reportid;
-       uint8_t                  nreports;
+       u_int                    nreports;
        uint8_t                 *claimed;
 };
 
-#define UHIDEV_CLAIM_MULTIPLE_REPORTID(u) \
-       ((u)->reportid == __UHIDEV_CLAIM_MULTIPLE_REPORTID)
+#define UHIDEV_CLAIM_MULTIPLE_REPORTID(u)      ((u)->claimed != NULL)
 #define        __UHIDEV_CLAIM_MULTIPLE_REPORTID        255     /* XXX */
 
 int uhidev_report_type_conv(int);

Reply via email to