From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <4541e42666533df9ef7bcdb09acac1fc@hamnavoe.com> To: 9fans@9fans.net From: Richard Miller <9fans@hamnavoe.com> Date: Mon, 3 Mar 2014 11:24:32 +0000 In-Reply-To: <31bd81dc7f294b2b7f0ba595617fc178@chula.quanstro.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] Raspberry Pi: won't recognize the USB mouse Topicbox-Message-UUID: c16df324-ead8-11e9-9d60-3106f5b1d025 >> old iMac usb keyboard c. 2001 >> Apple 'Pro' keyboard, c. 2004 > > these two work for me using the modifications here: > http://9fans.net/archive/2014/02/202 > setting the langid is critical for some keyboards. Looking at the patch in that 9fans.net posting, I am puzzled. /n/sources/plan9/sys/src/cmd/usb/lib/dev.c:228,233 - dev.c:233,245 memset(buf, 0, Ddevlen); if((nr=usbcmd(d, type, Rgetdesc, Ddev<<8|0, 0, buf, nr)) < 0) return -1; + if(nr == 17){ + print("%s: langid %.4ux\n", argv0, buf[3]<<8|buf[2]); + if((nr = usbcmd(d, type, Rgetdesc, Ddev<<8|0, buf[3]<<8|buf[2], buf, 18)) < 0) + return -1; + print("%s: nr = %d; buf[%d] = %.2ux\n", argv0, nr, nr, buf[nr]); + } + This is in function loaddevdesc which loads a device descriptor, not a string descriptor. The device descriptor doesn't have a language id in offset 2:3, it has bcdUSB and bDeviceClass in those fields. And the specification for the Rgetdesc command says "the wIndex field specifies the LanguageID for string descriptors or is reset to zero for other descriptors".