From owner-freebsd-usb@FreeBSD.ORG Fri Jun 20 07:49:49 2014 Return-Path: Delivered-To: usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 62D4A4AB for ; Fri, 20 Jun 2014 07:49:49 +0000 (UTC) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0E5B520B0 for ; Fri, 20 Jun 2014 07:49:48 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id ADB041FE026; Fri, 20 Jun 2014 09:49:46 +0200 (CEST) Message-ID: <53A3E7AF.7010901@selasky.org> Date: Fri, 20 Jun 2014 09:50:07 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Eitan Adler Subject: Re: weird mouse: acts as keyboard and mouse References: <539E8C51.30903@selasky.org> <539E8E15.90409@selasky.org> <539E8FBF.2090504@selasky.org> <539E937F.3070206@selasky.org> <539F0E00.6090503@selasky.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: "usb@freebsd.org" X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2014 07:49:49 -0000 On 06/20/14 05:43, Eitan Adler wrote: > On 16 June 2014 17:59, Eitan Adler wrote: >> On 16 June 2014 08:32, Hans Petter Selasky wrote: >>> On 06/16/14 17:15, Eitan Adler wrote: >>>> >>>> On 15 June 2014 23:49, Hans Petter Selasky wrote: >>>>> >>>>> On 06/16/14 08:39, Eitan Adler wrote: >>>>>> >>>>>> >>>>>> On 15 June 2014 23:33, Hans Petter Selasky wrote: >>>>>>> >>>>>>> >>>>>>> On 06/16/14 08:30, Eitan Adler wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On 15 June 2014 23:26, Hans Petter Selasky wrote: >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> On 06/16/14 08:21, Eitan Adler wrote: >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On 15 June 2014 23:18, Hans Petter Selasky wrote: >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> On 06/16/14 08:09, Eitan Adler wrote: >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> Hey Hans, >>>>>>>>>>>> >>>>>>>>>>>> I have a >>>>>>>>>>> 2.00/84.01, addr 12> which is reporting itself as both a mouse and >>>>>>>>>>>> a >>>>>>>>>>>> keyboard. I know that the mouse has the ability to remap itself >>>>>>>>>>>> as >>>>>>>>>>>> it >>>>>>>>>>>> used to not do this (I was able to configure this on a mac). >>>>>>>>>>>> >>>>>>>>>>>> The annoying effect is that the "back" and "forward" keys now >>>>>>>>>>>> report >>>>>>>>>>>> themselves as "[" and "]" keys. >>>>>>>>>>>> >>>>>>>>>>>> [1645919] ugen0.2: at usbus0 >>>>>>>>>>>> [1645919] ums0: >>>>>>>>>>> 2.00/84.01, addr 12> on usbus0 >>>>>>>>>>>> [1645919] ums0: 16 buttons and [XYZT] coordinates ID=0 >>>>>>>>>>>> [1645919] ukbd0: >>>>>>>>>>> rev >>>>>>>>>>>> 2.00/84.01, addr 12> on usbus0 >>>>>>>>>>>> [1645919] kbd2 at ukbd0 >>>>>>>>>>>> >>>>>>>>>>>> I think it would be a good idea to write a utility to configure >>>>>>>>>>>> this >>>>>>>>>>>> stuff on FreeBSD. What information do I need to obtain / how >>>>>>>>>>>> should >>>>>>>>>>>> I >>>>>>>>>>>> obtain it? I'm guessing its possible to talk to the mouse over >>>>>>>>>>>> USB >>>>>>>>>>>> but I'm not sure how. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> Hi, >>>>>>>>>>> >>>>>>>>>>> Can you check the configuration descriptor first? >>>>>>>>>>> >>>>>>>>>>> usbconfig -d X.Y dump_device_desc dump_curr_config_desc >>>>>>>>>>> >>>>>>>>>>> Possibly you need to issue some HID command (set report descriptor) >>>>>>>>>>> to >>>>>>>>>>> make >>>>>>>>>>> the device change behaviour. >>>>>>>>>>> >>>>>>>>>>> --HPS >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> >>>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> USB descriptors look sane. >>>>>>>>> >>>>>>>>> Add: >>>>>>>>> >>>>>>>>> usbconfig -d X.Y add_quirk UQ_KBD_IGNORE >>>>>>>>> usbconfig -d X.Y add_quirk UQ_UMS_IGNORE >>>>>>>>> >>>>>>>>> Then re-plug the device. >>>>>>>>> >>>>>>>>> Now you should have /dev/uhidX >>>>>>>>> >>>>>>>>> Run: >>>>>>>>> >>>>>>>>> usbhidctl -f /dev/uhidX -rvx >>>>>>>>> >>>>>>>>> For both uhid devices. >>>>>>>>> >>>>>>>>> Thank you! >>>>>>>>> >>>>>>>>> --HPS >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> [10054 root@gravity .../eitan/svn/fbsd/ports !2!]#usbhidctl -f >>>>>>>> /dev/uhid0 -rvx >>>>>>>> (svn:ports)-[head:357806] >>>>>>>> Report descriptor: >>>>>>>> Collection type=Application page=Generic_Desktop usage=Mouse >>>>>>>> Collection type=Physical page=Generic_Desktop usage=Pointer >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_1, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_2, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_3, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_4, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_5, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_6, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_7, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_8, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_9, logical range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_10, logical >>>>>>>> range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_11, logical >>>>>>>> range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_12, logical >>>>>>>> range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_13, logical >>>>>>>> range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_14, logical >>>>>>>> range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_15, logical >>>>>>>> range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=1 count=1 page=Button usage=Button_16, logical >>>>>>>> range >>>>>>>> 0..1 >>>>>>>> Input rid=0 size=16 count=1 page=Generic_Desktop usage=X, logical >>>>>>>> range -32767..32767 >>>>>>>> Input rid=0 size=16 count=1 page=Generic_Desktop usage=Y, logical >>>>>>>> range -32767..32767 >>>>>>>> Input rid=0 size=8 count=1 page=Generic_Desktop usage=Wheel, logical >>>>>>>> range -127..127 >>>>>>>> Input rid=0 size=8 count=1 page=Consumer usage=AC_Pan, logical range >>>>>>>> -127..127 >>>>>>>> End collection >>>>>>>> End collection >>>>>>>> Total input size 8 bytes >>>>>>>> Total output size 0 bytes >>>>>>>> Total feature size 0 bytes >>>>>>>> [10055 root@gravity /home/eitan/svn/fbsd/ports ]#usbhidctl -f >>>>>>>> /dev/uhid1 -rvx >>>>>>>> 41s (svn:ports)-[head:357806] >>>>>>>> Report descriptor: >>>>>>>> Collection type=Application page=Generic_Desktop usage=Keyboard >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftControl, >>>>>>>> logical range 0..1 >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftShift, >>>>>>>> logical range 0..1 >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard usage=Keyboard_LeftAlt, >>>>>>>> logical range 0..1 >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard usage=Keyboard_Left_GUI, >>>>>>>> logical range 0..1 >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard >>>>>>>> usage=Keyboard_RightControl, logical range 0..1 >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard usage=Keyboard_RightShift, >>>>>>>> logical range 0..1 >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard usage=Keyboard_RightAlt, >>>>>>>> logical range 0..1 >>>>>>>> Input rid=1 size=1 count=1 page=Keyboard usage=Keyboard_Right_GUI, >>>>>>>> logical range 0..1 >>>>>>>> Input rid=1 size=8 count=5 page=Keyboard >>>>>>>> usage=Reserved_(no_event_indicated) Array, logical range 0..164 >>>>>>>> End collection >>>>>>>> Collection type=Application page=Consumer usage=Consumer_Control >>>>>>>> Input rid=3 size=16 count=2 page=Consumer usage=Consumer_Control >>>>>>>> Array, logical range 1..652 >>>>>>>> End collection >>>>>>>> Collection type=Application page=Microsoft usage=0x0001 >>>>>>>> Input rid=16 size=8 count=6 page=Microsoft usage=0x0001 Array, >>>>>>>> logical range 0..255 >>>>>>>> Output rid=16 size=8 count=6 page=Microsoft usage=0x0001 Array, >>>>>>>> logical range 0..255 >>>>>>>> End collection >>>>>>>> Collection type=Application page=Microsoft usage=0x0002 >>>>>>>> Input rid=17 size=8 count=19 page=Microsoft usage=0x0002 Array, >>>>>>>> logical range 0..255 >>>>>>>> Output rid=17 size=8 count=19 page=Microsoft usage=0x0002 Array, >>>>>>>> logical range 0..255 >>>>>>>> End collection >>>>>>>> Total input size 20 bytes >>>>>>>> Total output size 20 bytes >>>>>>>> Total feature size 0 bytes >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> Hi, >>>>>>> >>>>>>> Looks like a real keyboard. If you add a quirk to hide the keyboard, >>>>>>> does >>>>>>> the mouse function like it should? >>>>>> >>>>>> >>>>>> >>>>>> If I remove the IGNORE_UMS quirk then the mouse works as normal until >>>>>> I try to press the 'back' or 'forward' keys then the entire mouse >>>>>> freezes: not even moment or normal mouse keys work >>>>>> >>>>> >>>>> I guess that's because this mouse does not have very intelligent firmware >>>>> :-) >>>>> >>>>> Try reading from the HID device which corresponds to the keyboard: >>>>> >>>>> dd if=/dev/uhid0 of=/dev/null bs=20 & >>>>> >>>>> bs= must be correct. >>>>> >>>>> Does that help? >>>> >>>> >>>> Yes it does: although the back/forward keys still don't work. >>>> >>> >>> Hi, >>> >>> I'm unsure what to do next. The USB firmware makers are simply getting more >>> and more creative :-) The surely didn't ask me if doing a USB mouse that way >>> would be clever :-) >> >> It appears the mac utility can cause the mouse to enter different >> modes. I'm curious if there is any usb sniffer I can use for OSX to >> see what commands it sends to the mouse. >> >> >>> Have you checked if "uhidd" might work better with your device? >> >> I havn't tried this, but will do so when I can > > Any suggestions for ways to talk to the mouse? I could try brute > forcing configuration options: Its shameful if we need to use a mac to > fix these sorts of problems. > Hi, There is something called set report in the HID world which might change the behaviour. Just grep in usb_request.c. Else try google the product and vendor ID. Perhaps someone has already seen or has a solution for this issue already? --HPS