Date: Thu, 13 Jun 2013 13:40:00 +0200 From: Natacha =?iso-8859-1?Q?Port=E9?= <natbsd@instinctive.eu> To: freebsd-usb@freebsd.org Subject: Logitech G110 keyboard Message-ID: <20130613113959.GA62104@sigil.instinctive.eu>
next in thread | raw e-mail | index | archive | help
--azLHFNyN32YCQGCU Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit Hello, I have recently bought a Logitech G110 keyboard, and while the basic keyboard functionality works fine out-of-the-box, I was hoping to get the rest working too. I have C experience, so if it has to come down to that, I'm not afraid to write code, although I will need pointer since I've never looked at FreeBSD code yet. Physically, the device has the usual 104/105 keys, a multimedia key block, backlight, and extra keys labelled G1 to G12, M1 to M3, and MR. The purpose of the extra keys is gaming macros: M1 to M3 select a "macro page", each of them having 12 slots accessed through G1 to G12. Pressing MR before Gn lets one record a macro, and pressing Gn replays the macro. I don't know how much of this is handled by the windows driver, however one advertised point of the G110 is that macros are stored in the keyboard, so configuration is preserved when plugging the keyboard in another computer (e.g. in LAN parties). However my personal needs don't go anywhere that far, and I would be happy with merely remapping G1..12 to F13..24 or numeric pad keycodes. Logically, the device registers itself as a USB hub, behind which are two HID devices, one USB audio (which works fine out-of-the-box too) and one physical USB socket on the keyboard. Each HID device has a keyboard interface followed by a consumer-control interface. One of them, registered as "Gaming Keyboard G110", transmits events for the standard keys through the keyboard interface (and works fine with ukbd) and for the multimedia keys through the CC interface (requires tinkering with uhidd but otherwise fine too). The other is registered as "LOGITECH G110 G-keys" and is much more mysterious. By default ukbd recognizes the keyboard part, and sends F1..12 keycodes when respective G1..12 is pressed, while M? keys are inert. uhid tries to attach to the CC part, but fails with error code 12, maybe because the CC part doesn't have IN interrupt ep. Looking around the internet for drivers, I have found some sequences and reverse-engineered mappings. So I have some `usbconfig do_request` lines to manipulate backlight color and individual backlighting of M? keys, which is as much as can be visibly done on this keyboard. Moreover, whenever a G? or a M? key is pressed, two reports are transmitted through the keyboard interface endpoint. Report Id 1 seems to have a keyboard-like behavior, with 6 bytes containing numbers designated keys that are currently down, and Report Id 2 is a three-byte bitfield whose first two bytes indicate the status of each of the 16 G? and M? keys. Attached here are dmesg output relevant to the keyboard when it is plugged in, and uhidd output on the G-key HID. At this point, would anyone have any idea or pointer on how I can help improve support for the extra function of my new keybaord? Thanks in advance for your help, Natacha Porté --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="dmesg.txt" ugen3.7: <vendor 0x05e3> at usbus3 uhub6: <vendor 0x05e3 USB2.0 Hub, class 9/0, rev 2.00/8.01, addr 7> on usbus3 uhub6: MTT enabled uhub6: 4 ports with 4 removable, bus powered ugen3.8: <LOGITECH> at usbus3 ukbd1: <LOGITECH G110 G-keys, class 0/0, rev 2.00/1.01, addr 8> on usbus3 kbd3 at ukbd1 uhid1: <LOGITECH G110 G-keys, class 0/0, rev 2.00/1.01, addr 8> on usbus3 device_attach: uhid1 attach returned 12 ugen3.9: <vendor 0x046d> at usbus3 ukbd2: <vendor 0x046d Gaming Keyboard G110, class 0/0, rev 2.00/1.00, addr 9> on usbus3 kbd4 at ukbd2 uhid1: <vendor 0x046d Gaming Keyboard G110, class 0/0, rev 2.00/1.00, addr 9> on usbus3 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="uhidd.txt" # uhidd -Dd -vvv -kmohu /dev/ugen3.8 uhidd[94589]: open /usr/local/etc/uhidd.conf failed: No such file or directory uhidd[94589]: proceed without configuration file ugen3.8[0]-> HID interface ugen3.8[0]-> Report descriptor size = 99 ugen3.8[0]-> Report descriptor dump: USAGE PAGE Generic Desktop(0x1) USAGE Keypad(0x7)[Generic Desktop(0x1)] COLLECTION Application(1) USAGE PAGE Keyboard(0x7) USAGE MINIMUM Reserved (no event indicated)(0) USAGE MAXIMUM Keyboard Right GUI(231) LOGICAL MINIMUM 0 LOGICAL MAXIMUM 231 REPORT SIZE 8 REPORT COUNT 6 REPORT ID 1 INPUT ( Data Array Absolute ) (0) END COLLECTION USAGE PAGE Microsoft(0xff00) USAGE Unknown Usage(0)[Microsoft(0xff00)] COLLECTION Application(1) REPORT ID 2 REPORT COUNT 3 LOGICAL MAXIMUM 255 USAGE Unknown Usage(0x4)[Microsoft(0xff00)] INPUT ( Data Variable Absolute ) (2) USAGE Unknown Usage(0x5)[Microsoft(0xff00)] REPORT ID 3 REPORT COUNT 1 FEATURE ( Data Variable Absolute ) (2) USAGE Unknown Usage(0x6)[Microsoft(0xff00)] REPORT ID 4 REPORT COUNT 12 OUTPUT ( Data Variable Absolute ) (2) USAGE Unknown Usage(0x7)[Microsoft(0xff00)] REPORT ID 6 REPORT COUNT 3 LOGICAL MAXIMUM 255 OUTPUT ( Data Variable Absolute ) (2) REPORT COUNT 1 LOGICAL MAXIMUM 64 USAGE Unknown Usage(0x7)[Microsoft(0xff00)] OUTPUT ( Data Variable Absolute ) (2) REPORT ID 7 USAGE Unknown Usage(0x8)[Microsoft(0xff00)] REPORT COUNT 3 LOGICAL MAXIMUM 255 FEATURE ( Data Variable Absolute ) (2) REPORT COUNT 1 LOGICAL MAXIMUM 100 USAGE Unknown Usage(0x8)[Microsoft(0xff00)] FEATURE ( Data Variable Absolute ) (2) END COLLECTION ugen3.8[0]-> Kernel driver is not active ugen3.8[0]-> Find IN interrupt ep: 0x81 packet_size=0x8 ugen3.8[1]-> HID interface ugen3.8[1]-> Report descriptor size = 31 ugen3.8[1]-> Report descriptor dump: USAGE PAGE Consumer(0xc) USAGE Consumer Control(0x1)[Consumer(0xc)] COLLECTION Application(1) USAGE Unassigned(0)[Consumer(0xc)] LOGICAL MINIMUM -128 LOGICAL MAXIMUM 127 REPORT SIZE 8 REPORT COUNT 8 OUTPUT ( Data Variable Absolute ) (2) USAGE Unassigned(0)[Consumer(0xc)] LOGICAL MINIMUM -128 LOGICAL MAXIMUM 127 REPORT SIZE 8 REPORT COUNT 8 FEATURE ( Data Variable Absolute ) (2) END COLLECTION ugen3.8[1]-> Kernel driver is not active ugen3.8[1]-> does not have IN interrupt ep HID APPLICATION COLLECTION (Keypad) size(26) HID REPORT: ID 1 INPUT: POS:0 SIZE:8 COUNT:6 [ARRAY] USAGE [0 -> 231] (Keyboard) HID APPLICATION COLLECTION (Unknown Usage) size(73) HID REPORT: ID 2 INPUT: POS:0 SIZE:8 COUNT:3 [VARIABLE] USAGE Unknown Usage USAGE Unknown Page USAGE Unknown Page HID REPORT: ID 3 FEATURE: POS:0 SIZE:8 COUNT:1 [VARIABLE] USAGE Unknown Usage HID REPORT: ID 4 OUTPUT: POS:0 SIZE:8 COUNT:12 [VARIABLE] USAGE Unknown Usage USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page USAGE Unknown Page HID REPORT: ID 6 OUTPUT: POS:0 SIZE:8 COUNT:3 [VARIABLE] USAGE Unknown Usage USAGE Unknown Page USAGE Unknown Page POS:24 SIZE:8 COUNT:1 [VARIABLE] USAGE Unknown Usage HID REPORT: ID 7 FEATURE: POS:0 SIZE:8 COUNT:3 [VARIABLE] USAGE Unknown Usage USAGE Unknown Page USAGE Unknown Page POS:24 SIZE:8 COUNT:1 [VARIABLE] USAGE Unknown Usage uhidd[94589]: cuse4bsd initiailzed. ugen3.8[0]-> vhid device created: uvhid0 ugen3.8[0]-> vhid device created: uvhid1 ugen3.8[0]-> HID interface task started --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="uhidd-g1-down.txt" ugen3.8[0]-> received data(7): 01 58 00 00 00 00 00 hid_appcol_recv_data: len(7) 0x01 0x3a 0x00 0x00 0x00 0x00 0x00 ugen3.8[0]-> uvhid0 received data: 1 58 0 0 0 0 0 ugen3.8[0]-> received data(4): 02 01 00 00 hid_appcol_recv_data: len(4) 0x02 0x01 0x00 0x00 ugen3.8[0]-> uvhid1 received data: 2 1 0 0 --azLHFNyN32YCQGCU Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="uhidd-g1-up.txt" ugen3.8[0]-> received data(7): 01 00 00 00 00 00 00 hid_appcol_recv_data: len(7) 0x01 0x00 0x00 0x00 0x00 0x00 0x00 ugen3.8[0]-> uvhid0 received data: 1 0 0 0 0 0 0 ugen3.8[0]-> received data(4): 02 00 00 00 hid_appcol_recv_data: len(4) 0x02 0x00 0x00 0x00 ugen3.8[0]-> uvhid1 received data: 2 0 0 0 --azLHFNyN32YCQGCU--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130613113959.GA62104>