9front - general discussion about 9front
 help / color / mirror / Atom feed
From: cinap_lenrek@felloff.net
To: 9front@9front.org
Subject: Re: [9front] Middle button on usb mice
Date: Sat, 24 Sep 2016 15:03:23 +0200	[thread overview]
Message-ID: <4fe60d0861a45d7f5c70783f1675bd10@felloff.net> (raw)
In-Reply-To: <20160924032604.GA788@speakerbox>

the mouse port prompt on boot doesnt matter... that applies to
ps/2 and serial mouse only. 

usb mice have no fixed protocol, but a blob (hid descriptor) that
describes the bits in the data packet and how they should be interpreted.

to debug this, first, we need to get rid of the automatically spawned
nusb/kb process thats still attached to the device.

run ps -a | grep kb, you'll get something like:

cinap_lenrek   259856    0:00   0:00      156K Pread    kb [readerproc /dev/usb/ep5.1]

that tells you the assigned device address (5 in this case),
then kill that process:

kill kb | rc

next, we run nusb/kb -ddd 5

replace 5 with the address you got from above there... the
-ddd enables some debug prints. the output will look like this:

report descriptor:
	0x05 0x01 0x09 0x02 0xa1 0x01 0x09 0x01 
	0xa1 0x00 0x05 0x09 0x19 0x01 0x29 0x03 
	0x15 0x00 0x25 0x01 0x95 0x03 0x75 0x01 
	0x81 0x02 0x95 0x01 0x75 0x05 0x81 0x01 
	0x05 0x01 0x09 0x30 0x09 0x31 0x09 0x38 
	0x15 0x81 0x25 0x7f 0x75 0x08 0x95 0x03 
	0x81 0x06 0xc0 0x09 0x3c 0x15 0x00 0x25 
	0x01 0x75 0x01 0x95 0x01 0xb1 0x22 0x95 
	0x07 0xb1 0x01 0xc0 
hidparse: t=8 f=2 usage=90001 v=0
hidparse: t=8 f=2 usage=90002 v=0
hidparse: t=8 f=2 usage=90003 v=0
hidparse: t=8 f=6 usage=10030 v=0
hidparse: t=8 f=6 usage=10031 v=1
hidparse: t=8 f=6 usage=10038 v=0
...

my suspicion is that we eigther fail to read the hid
descriptor (then no "report descriptor:" should be
printed with debug on), and then assume the default
bootproto one for mouse, or the descriptor is malformed
in some way that we do not understand.

the code is here: /sys/src/cmd/nusb/kb/kb.c

the code starts with reading the hid descriptor and
setting the protocol in setproto().

then it spawns readerproc which reads packets from the
endpoint and tries to parse it with repparse(), which
takes the descriptor as input and calls hidparse() for
each item described by the descriptor. hidparse() then
extracts the data from the actual packet for the given
item information.

you can add debug prints if you want, run mk, kill the
old process an start a new one with the usb address
as explained before.

--
cinap


  reply	other threads:[~2016-09-24 13:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-24  3:26 lemon
2016-09-24 13:03 ` cinap_lenrek [this message]
2016-09-26 23:13   ` [9front] " lemon
2016-09-26 23:30     ` cinap_lenrek
2016-09-28  2:13       ` lemon
2016-09-28 13:27         ` cinap_lenrek
2016-09-28 14:20         ` cinap_lenrek
2016-09-30  3:47           ` lemon
2016-09-30  6:41             ` cinap_lenrek
2016-10-18  0:46               ` lemon
2016-09-30  7:37             ` cinap_lenrek
2016-09-30  7:40               ` cinap_lenrek

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=4fe60d0861a45d7f5c70783f1675bd10@felloff.net \
    --to=cinap_lenrek@felloff.net \
    --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).