From f8738fd7578af0ce3552bc9da65502397b9faad3 Mon Sep 17 00:00:00 2001 From: mischief Date: Sat, 21 Nov 2020 12:31:54 -0800 Subject: nusb/kb, nusb/joy: dont try to set protocol on nonboot devices the hid 1.11 specification says that for hid devices which arent in the boot subclass (subclass 1), it is only optional to support the set protocol command. for my devices, trying to set protocol results in a stall error and unusable devices. fixes my Tex Shinobi keyboard and Playstation 4 controller. --- sys/src/cmd/nusb/kb/kb.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sys/src/cmd/nusb/kb/kb.c') diff --git a/sys/src/cmd/nusb/kb/kb.c b/sys/src/cmd/nusb/kb/kb.c index 3e2913e34..7b9ed9f2c 100644 --- a/sys/src/cmd/nusb/kb/kb.c +++ b/sys/src/cmd/nusb/kb/kb.c @@ -368,6 +368,14 @@ setproto(Hiddev *f, int eid) } proto = Bootproto; } + + /* + * if a HID's subclass code is 1 (boot mode), it will support + * setproto, otherwise it is not guaranteed to. + */ + if(Subclass(iface->csp) != 1) + return 0; + return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, iface->id, nil, 0); } -- cgit v1.2.3