* Support for my mouse in nusb/kb
@ 2020-04-12 4:26 petermikkelsen10
0 siblings, 0 replies; only message in thread
From: petermikkelsen10 @ 2020-04-12 4:26 UTC (permalink / raw)
To: 9front
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
Hello,
I have recently installed 9front on my laptop and only some USB mice seems to work.
After a bit of investigation it turned out to be a problem with the devices which also presented part of them as a keyboard,
so I looked a bit at the USB hid spec. It seems that some things that nusb/kb does (like setting the idle time) is not
always supported by all devices, so this patch changes those things. It fixes the problem for me and now I can use my
new mouse :)
Sysinfo is attached.
[-- Attachment #2.1: Type: text/plain, Size: 325 bytes --]
from postmaster@plan9:
The following attachment had content that we can't
prove to be harmless. To avoid possible automatic
execution, we changed the content headers.
The original header was:
Content-Disposition: attachment; filename=usb.patch
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit
[-- Attachment #2.2: usb.patch.suspect --]
[-- Type: application/octet-stream, Size: 1221 bytes --]
diff -r 22dd54063d2c sys/src/cmd/nusb/kb/kb.c
--- a/sys/src/cmd/nusb/kb/kb.c Sat Apr 11 18:09:48 2020 +0200
+++ b/sys/src/cmd/nusb/kb/kb.c Sun Apr 12 04:35:20 2020 +0200
@@ -330,12 +330,21 @@
iface = f->dev->usb->ep[eid]->iface;
- /*
- * DWC OTG controller misses some split transaction inputs.
- * Set nonzero idle time to return more frequent reports
- * of keyboard state, to avoid losing key up/down events.
+ /* Appendix G of the USB Hid spec says that only boot mouse and boot keyboards
+ * are required to support setting the protocol, so only try it for those.
*/
- usbcmd(f->dev, Rh2d|Rclass|Riface, Setidle, 8<<8, iface->id, nil, 0);
+ if (iface->csp != KbdCSP && iface->csp != PtrCSP)
+ return 0;
+
+ /* Only set the idle time keyboards since only those are required to support it */
+ if (iface->csp == KbdCSP) {
+ /*
+ * DWC OTG controller misses some split transaction inputs.
+ * Set nonzero idle time to return more frequent reports
+ * of keyboard state, to avoid losing key up/down events.
+ */
+ usbcmd(f->dev, Rh2d|Rclass|Riface, Setidle, 8<<8, iface->id, nil, 0);
+ }
f->nrep = usbcmd(f->dev, Rd2h|Rstd|Riface, Rgetdesc, Dreport<<8, iface->id,
f->rep, sizeof(f->rep));
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-04-12 4:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-12 4:26 Support for my mouse in nusb/kb petermikkelsen10
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).