From: petermikkelsen10@gmail.com
To: 9front@9front.org
Subject: Support for my mouse in nusb/kb
Date: Sun, 12 Apr 2020 06:26:06 +0200 [thread overview]
Message-ID: <0B1E6B5BE527C4A3AE297F5C09CE837A@gmail.com> (raw)
[-- 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));
reply other threads:[~2020-04-12 4:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0B1E6B5BE527C4A3AE297F5C09CE837A@gmail.com \
--to=petermikkelsen10@gmail.com \
--cc=9front@9front.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).