weird mouse: acts as keyboard and mouse

Eitan Adler lists at eitanadler.com
Fri Jun 20 03:43:37 UTC 2014


On 16 June 2014 17:59, Eitan Adler <lists at eitanadler.com> wrote:
> On 16 June 2014 08:32, Hans Petter Selasky <hps at selasky.org> wrote:
>> On 06/16/14 17:15, Eitan Adler wrote:
>>>
>>> On 15 June 2014 23:49, Hans Petter Selasky <hps at selasky.org> wrote:
>>>>
>>>> On 06/16/14 08:39, Eitan Adler wrote:
>>>>>
>>>>>
>>>>> On 15 June 2014 23:33, Hans Petter Selasky <hps at selasky.org> wrote:
>>>>>>
>>>>>>
>>>>>> On 06/16/14 08:30, Eitan Adler wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 15 June 2014 23:26, Hans Petter Selasky <hps at selasky.org> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 06/16/14 08:21, Eitan Adler wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 15 June 2014 23:18, Hans Petter Selasky <hps at selasky.org> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 06/16/14 08:09, Eitan Adler wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Hey Hans,
>>>>>>>>>>>
>>>>>>>>>>> I have a <Logitech G500s Laser Gaming Mouse, class 0/0, rev
>>>>>>>>>>> 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: <Logitech> at usbus0
>>>>>>>>>>> [1645919] ums0: <Logitech G500s Laser Gaming Mouse, class 0/0, rev
>>>>>>>>>>> 2.00/84.01, addr 12> on usbus0
>>>>>>>>>>> [1645919] ums0: 16 buttons and [XYZT] coordinates ID=0
>>>>>>>>>>> [1645919] ukbd0: <Logitech G500s Laser Gaming Mouse, class 0/0,
>>>>>>>>>>> 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 at 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 at 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.

-- 
Eitan Adler


More information about the freebsd-usb mailing list