[libhid-discuss] Trying to use libHID to access extra keys on USB
keyboard
Michel Lespinasse
walken at zoy.org
Thu Jul 13 11:55:22 UTC 2006
Hi guys,
First let me note that I am not on either of the lists. I wouldnt mind
subscribing, but I could not figure out which of the lists is to be
considered as the active one :) Please copy me in your replies, at least
initially.
I've been trying to figure out how to access the extra keys on an
IBM/lenovo "USB keyboard with UltraNav". From the attached lsusb
information, I believe the extra keys must be somehow readable from
interface number 1 on device vendor/product code 04b3:3018
I installed libhid from the Debian package (version 0.2.15+20060325-2)
and modified test_libhid.c to try to access the extra keys. In the
HIDInterfaceMatcher structure I set the vendor/product ID as needed and
in the hid_force_open call I figured out I needed to set the second
parameter to 1 since that is the interface number I care about.
I have attached the produced output too...
Now it looks like I should be close to getting data out of the extra
keys, but for some reason I did not manage how to make this work.
I tried this, just before the hid_close() call:
#define PATHLEN 2
#define RECV_PACKET_LEN 2
int const PATH_OUT[PATHLEN] = { 0x000c0001, 0x000c00e9 };
char packet[RECV_PACKET_LEN];
ret = hid_get_input_report(hid, PATH_OUT, PATHLEN, packet, RECV_PACKET_LEN);
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_get_input_report failed with return code %d\n", ret);
}
I was hoping this would do something when I press volume increment, but no
such luck - actually it apparently did something bad as all devices connected
to this USB hub stopped being recognized (oops).
I also tried to change the path to 0x000c0001 : 0x000c0002 to access the
'input' field shown by lsusb but that did not work either
(hid_get_input_report failed with return code 20)
Would you by chance have any guesses as to what access path and packet_len
I should try next ???
Should hid_get_input_report be the correct function to call to access the
extra keys in the first place ???
Thanks for any help,
--
Michel "Walken" Lespinasse
"Bill Gates is a monocle and a Persian cat away from being the villain
in a James Bond movie." -- Dennis Miller
-------------- next part --------------
[root:pts/1] Angel:~# lsusb -vvvvv -d 04b3:3018
Bus 001 Device 028: ID 04b3:3018 IBM Corp. UltraNav Keyboard
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x04b3 IBM Corp.
idProduct 0x3018 UltraNav Keyboard
bcdDevice 1.16
iManufacturer 1 Lite-On Tech
iProduct 2 IBM USB Keyboard with UltraNav
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 59
bNumInterfaces 2
bConfigurationValue 1
iConfiguration 0
bmAttributes 0xa0
(Bus Powered)
Remote Wakeup
MaxPower 70mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Devices
bInterfaceSubClass 1 Boot Interface Subclass
bInterfaceProtocol 1 Keyboard
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 65
Report Descriptors:
** UNAVAILABLE **
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0008 1x 8 bytes
bInterval 24
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Devices
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.10
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 85
Report Descriptor: (length is 85)
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x80 ] 128
System Control
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x02 ] 2
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Local ): Usage Minimum, data= [ 0x81 ] 129
System Power Down
Item(Local ): Usage Maximum, data= [ 0x88 ] 136
System Menu Exit
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Global): Usage Page, data= [ 0x0c ] 12
Consumer
Item(Local ): Usage, data= [ 0x01 ] 1
Consumer Control
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Report ID, data= [ 0x03 ] 3
Item(Global): Report Count, data= [ 0x08 ] 8
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Local ): Usage, data= [ 0xe9 ] 233
Volume Increment
Item(Local ): Usage, data= [ 0xea ] 234
Volume Decrement
Item(Local ): Usage, data= [ 0xe2 0x00 ] 226
Mute
Item(Local ): Usage, data= [ 0x24 0x02 ] 548
AC Back
Item(Local ): Usage, data= [ 0x25 0x02 ] 549
AC Forward
Item(Local ): Usage, data= [ 0xb5 ] 181
Scan Next Track
Item(Local ): Usage, data= [ 0xb6 ] 182
Scan Previous Track
Item(Local ): Usage, data= [ 0x92 0x01 ] 402
AL Calculator
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Local ): Usage, data= [ 0x03 ] 3
Programmable Buttons
Item(Main ): Collection, data= [ 0x02 ] 2
Logical
Item(Global): Usage Page, data= [ 0x09 ] 9
Buttons
Item(Local ): Usage Minimum, data= [ 0xf0 ] 240
(null)
Item(Local ): Usage Maximum, data= [ 0xf7 ] 247
(null)
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Global): Usage Page, data= [ 0x09 ] 9
Buttons
Item(Local ): Usage Minimum, data= [ 0xf8 ] 248
(null)
Item(Local ): Usage Maximum, data= [ 0xff ] 255
(null)
Item(Main ): Input, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap Linear
Preferred_State No_Null_Position Non_Volatile Bitfield
Item(Main ): End Collection, data=none
Item(Main ): End Collection, data=none
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x82 EP 2 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0005 1x 5 bytes
bInterval 48
Device Status: 0x0000
(Bus Powered)
-------------- next part --------------
NOTICE: hid_init(): libhid 0.2.15+20060325.0.0 is being initialized.
TRACE: hid_init(): initialising USB subsystem...
TRACE: hid_init(): scanning for USB busses...
TRACE: hid_init(): scanning for USB devices...
NOTICE: hid_init(): successfully initialised HID library.
TRACE: hid_new_HIDInterface(): creating a new HIDInterface instance...
TRACE: hid_force_open(): forcefully opening a device interface according to matching criteria...
TRACE: hid_get_usb_handle(): acquiring handle for a USB device...
TRACE: hid_find_usb_device(): enumerating USB busses...
TRACE: hid_find_usb_device(): enumerating USB devices on bus 002...
TRACE: hid_find_usb_device(): inspecting USB device 002/001[1]...
TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
TRACE: hid_compare_usb_device(): inspecting vendor ID...
TRACE: hid_compare_usb_device(): no match on vendor ID.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): no match on product ID.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): vendor 0x0000 of USB device 002/001[1] does not match 0x04b3.
TRACE: hid_find_usb_device(): inspecting USB device 002/002[1]...
TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
TRACE: hid_compare_usb_device(): inspecting vendor ID...
TRACE: hid_compare_usb_device(): no match on vendor ID.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): no match on product ID.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): vendor 0x058f of USB device 002/002[1] does not match 0x04b3.
TRACE: hid_find_usb_device(): enumerating USB devices on bus 001...
TRACE: hid_find_usb_device(): inspecting USB device 001/001[1]...
TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
TRACE: hid_compare_usb_device(): inspecting vendor ID...
TRACE: hid_compare_usb_device(): no match on vendor ID.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): no match on product ID.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): vendor 0x0000 of USB device 001/001[1] does not match 0x04b3.
TRACE: hid_find_usb_device(): inspecting USB device 001/025[1]...
TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
TRACE: hid_compare_usb_device(): inspecting vendor ID...
TRACE: hid_compare_usb_device(): no match on vendor ID.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): no match on product ID.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): vendor 0x0409 of USB device 001/025[1] does not match 0x04b3.
TRACE: hid_find_usb_device(): inspecting USB device 001/026[1]...
TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
TRACE: hid_compare_usb_device(): inspecting vendor ID...
TRACE: hid_compare_usb_device(): match on vendor ID: 0x04b3.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): no match on product ID.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): product 0x3016 of USB device 001/026[1] does not match 0x3018.
TRACE: hid_find_usb_device(): inspecting USB device 001/027[1]...
TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
TRACE: hid_compare_usb_device(): inspecting vendor ID...
TRACE: hid_compare_usb_device(): no match on vendor ID.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): no match on product ID.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): vendor 0x046d of USB device 001/027[1] does not match 0x04b3.
TRACE: hid_find_usb_device(): inspecting USB device 001/028[1]...
TRACE: hid_compare_usb_device(): comparing match specifications to USB device...
TRACE: hid_compare_usb_device(): inspecting vendor ID...
TRACE: hid_compare_usb_device(): match on vendor ID: 0x04b3.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): match on product ID: 0x3018.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): found a matching USB device 001/028[1].
TRACE: hid_force_open(): claiming USB device 001/028[1].
NOTICE: hid_force_open(): successfully claimed USB device 001/028[1].
TRACE: hid_init_parser(): initialising the HID parser for USB Device 001/028[1]...
TRACE: hid_init_parser(): allocating space for HIDData structure...
TRACE: hid_init_parser(): successfully allocated memory for HIDData strcture.
TRACE: hid_init_parser(): allocating space for HIDParser structure...
TRACE: hid_init_parser(): successfully allocated memory for HIDParser strcture.
NOTICE: hid_init_parser(): successfully initialised the HID parser for USB Device 001/028[1].
TRACE: hid_prepare_hid_descriptor(): initialising the HID descriptor for USB device 001/028[1]...
TRACE: hid_prepare_hid_descriptor(): retrieving HID descriptor for USB device 001/028[1]...
NOTICE: hid_prepare_hid_descriptor(): successfully initialised HID descriptor for USB device 001/028[1] (85 bytes).
TRACE: hid_prepare_report_descriptor(): initialising the report descriptor for USB device 001/028[1]...
TRACE: hid_prepare_report_descriptor(): retrieving report descriptor for USB device 001/028[1]...
NOTICE: hid_prepare_report_descriptor(): successfully initialised report descriptor for USB device 001/028[1].
TRACE: hid_prepare_parser(): setting up the HID parser for USB device 001/028[1]...
TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/028[1]...
TRACE: hid_prepare_parser(): dumping the raw report descriptor
TRACE: hid_prepare_parser(): 0x000: 0x05 0x01 0x09 0x80 0xa1 0x01 0x85 0x02
TRACE: hid_prepare_parser(): 0x008: 0x05 0x01 0x15 0x00 0x25 0x01 0x95 0x08
TRACE: hid_prepare_parser(): 0x010: 0x75 0x01 0x19 0x81 0x29 0x88 0x81 0x02
TRACE: hid_prepare_parser(): 0x018: 0xc0 0x05 0x0c 0x09 0x01 0xa1 0x01 0x85
TRACE: hid_prepare_parser(): 0x020: 0x03 0x95 0x08 0x75 0x01 0x15 0x00 0x25
TRACE: hid_prepare_parser(): 0x028: 0x01 0x09 0xe9 0x09 0xea 0x0a 0xe2 0x00
TRACE: hid_prepare_parser(): 0x030: 0x0a 0x24 0x02 0x0a 0x25 0x02 0x09 0xb5
TRACE: hid_prepare_parser(): 0x038: 0x09 0xb6 0x0a 0x92 0x01 0x81 0x02 0x09
TRACE: hid_prepare_parser(): 0x040: 0x03 0xa1 0x02 0x05 0x09 0x19 0xf0 0x29
TRACE: hid_prepare_parser(): 0x048: 0xf7 0x81 0x02 0x05 0x09 0x19 0xf8 0x29
TRACE: hid_prepare_parser(): 0x050: 0xff 0x81 0x02 0xc0 0xc0
TRACE: hid_prepare_parser(): parsing the HID tree of USB device 001/028[1]...
NOTICE: hid_prepare_parser(): successfully set up the HID parser for USB device 001/028[1].
NOTICE: hid_force_open(): successfully opened USB device 001/028[1].
TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/028[1]...
TRACE: hid_dump_tree(): iterating the parse tree for USB device 001/028[1]...
TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/028[1]...
TRACE: hid_close(): closing USB device 001/028[1]...
TRACE: hid_close(): closing handle of USB device 001/028[1]...
NOTICE: hid_close(): successfully closed USB device 001/028[1].
TRACE: hid_reset_parser(): resetting the HID parser for USB device 001/028[1]...
TRACE: hid_close(): freeing memory allocated for HID parser...
TRACE: hid_close(): resetting HIDInterface...
NOTICE: hid_cleanup(): successfully deinitialised HID library.
device identification of HIDInterface 001/028[1]:
dev_handle: 0x0804e598
device: 0x08052a38
location: 001/028
manufacturer: Lite-On Tech
product: IBM USB Keyboard with UltraNav
parse tree of HIDInterface 001/028[1]:
path: 0x00010080.0x00000000; type: 0x80
path: 0x00010080.0x00000000; type: 0x80
path: 0x00010080.0x00000000; type: 0x80
path: 0x00010080.0x00000000; type: 0x80
path: 0x00010080.0x00000000; type: 0x80
path: 0x00010080.0x00000000; type: 0x80
path: 0x00010080.0x00000000; type: 0x80
path: 0x00010080.0x00000000; type: 0x80
path: 0x000c0001.0x000c00e9; type: 0x80
path: 0x000c0001.0x000c00ea; type: 0x80
path: 0x000c0001.0x000c00e2; type: 0x80
path: 0x000c0001.0x000c0224; type: 0x80
path: 0x000c0001.0x000c0225; type: 0x80
path: 0x000c0001.0x000c00b5; type: 0x80
path: 0x000c0001.0x000c00b6; type: 0x80
path: 0x000c0001.0x000c0192; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
path: 0x000c0001.0x000c0003.0x00000000; type: 0x80
More information about the libhid-discuss
mailing list