From owner-freebsd-usb@FreeBSD.ORG Thu Jun 13 11:40:08 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 279CF39B for ; Thu, 13 Jun 2013 11:40:08 +0000 (UTC) (envelope-from natbsd@instinctive.eu) Received: from mail-we0-x234.google.com (mail-we0-x234.google.com [IPv6:2a00:1450:400c:c03::234]) by mx1.freebsd.org (Postfix) with ESMTP id B0C2717CF for ; Thu, 13 Jun 2013 11:40:07 +0000 (UTC) Received: by mail-we0-f180.google.com with SMTP id w56so7713608wes.25 for ; Thu, 13 Jun 2013 04:40:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type :content-disposition:content-transfer-encoding:user-agent :x-gm-message-state; bh=t4tzavGxHh48kWM9p+i7bEk7q94AwCapyzcxRh5UZ/I=; b=ZVhKhxpVfDhTQSc/hmFCx4fgTtQGPX3Q5mxQqXUODqVIc+pduOGUzdx4XPRF9ZJ8XH n3wKJzsmlz2L23PUC4Ph4wFPfyFBQp9f15uFv4/UjydNagjsh2hdOqyp/rIx+9uT0RMX 9FHhblxXQgIU8tFpcKaX9xDATWz0iZS15NCIaJOd7CxhfphQgpSJoKPFfSKY16HZAiSv N7HD/i3VmK947T3fHMX/nVFEDBN9Rrsa+uoHGTWsV+VJsL/pp8J6iFmAW7RozrnmjxLT lcHgU+007rpkQ/bH79Saa/TIQ76c2hCb0sf+PuteK5xWWoYzpHteM6ChebTt9i3nSrcM b+NA== X-Received: by 10.180.39.233 with SMTP id s9mr290327wik.25.1371123606399; Thu, 13 Jun 2013 04:40:06 -0700 (PDT) Received: from sigil.instinctive.eu ([2001:758:f00:340:78:41:233:119]) by mx.google.com with ESMTPSA id en3sm30753627wid.1.2013.06.13.04.40.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 13 Jun 2013 04:40:05 -0700 (PDT) Date: Thu, 13 Jun 2013 13:40:00 +0200 From: Natacha =?iso-8859-1?Q?Port=E9?= To: freebsd-usb@freebsd.org Subject: Logitech G110 keyboard Message-ID: <20130613113959.GA62104@sigil.instinctive.eu> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="azLHFNyN32YCQGCU" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQlzkz2i8wPKOfz4UJGR1h5Z0LdOl4mV27z7bJHRCW8pOzUmDa/bi8flyAGBldUUBh7o0d4F X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Jun 2013 11:40:08 -0000 --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: at usbus3 uhub6: on usbus3 uhub6: MTT enabled uhub6: 4 ports with 4 removable, bus powered ugen3.8: at usbus3 ukbd1: on usbus3 kbd3 at ukbd1 uhid1: on usbus3 device_attach: uhid1 attach returned 12 ugen3.9: at usbus3 ukbd2: on usbus3 kbd4 at ukbd2 uhid1: 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--