[libhid-discuss] hid_get_input_report(): failed to retrieve report Path wrong?
William Good
bgood256 at adelphia.net
Thu Sep 3 03:26:15 UTC 2009
I am trying to ge to my inputs of my Saitek Radio Panel but get the
following error.
Thanks for any help Bill
Program output
bill at bill-desktop:~/XSaitekRadioPanel/HIDTesting/usbprogs$ ./test_libhid
NOTICE: hid_init(): libhid CGP hack is being initialized.
TRACE: hid_init(): initialising USB subsystem...
TRACE: hid_init(): scanning for USB busses...
TRACE: hid_init(): scanning for USB devices...
libusb.usb_os_find_devices: filename= /dev/bus/usb/001/013
libusb.usb_os_find_devices: filename= /dev/bus/usb/001/012
libusb.usb_os_find_devices: filename= /dev/bus/usb/001/011
libusb.usb_os_find_devices: filename= /dev/bus/usb/001/010
libusb.usb_os_find_devices: filename= /dev/bus/usb/001/006
libusb.usb_os_find_devices: filename= /dev/bus/usb/001/001
libusb.usb_os_find_devices: filename= /dev/bus/usb/002/004
libusb.usb_os_find_devices: filename= /dev/bus/usb/002/003
libusb.usb_os_find_devices: filename= /dev/bus/usb/002/002
libusb.usb_os_find_devices: filename= /dev/bus/usb/002/001
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 001...
TRACE: hid_find_usb_device(): inspecting USB device 001/013[0]...
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: 0x06a3.
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 0x0bac of USB device 001/013[0] does
not match 0x0d05.
TRACE: hid_find_usb_device(): inspecting USB device 001/012[0]...
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: 0x06a3.
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 0x0d67 of USB device 001/012[0] does
not match 0x0d05.
TRACE: hid_find_usb_device(): inspecting USB device 001/011[0]...
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: 0x06a3.
TRACE: hid_compare_usb_device(): inspecting product ID...
TRACE: hid_compare_usb_device(): match on product ID: 0x0d05.
TRACE: hid_compare_usb_device(): no custom matching function supplied.
NOTICE: hid_find_usb_device(): found a matching USB device 001/011[0].
TRACE: hid_force_open(): claiming USB device 001/011[0].
NOTICE: hid_force_open(): successfully claimed USB device 001/011[0].
TRACE: hid_init_parser(): initialising the HID parser for USB Device
001/011[0]...
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/011[0].
TRACE: hid_prepare_hid_descriptor(): initialising the HID descriptor for USB
device 001/011[0]...
TRACE: hid_prepare_hid_descriptor(): retrieving HID descriptor for USB
device 001/011[0]...
NOTICE: hid_prepare_hid_descriptor(): successfully initialised HID
descriptor for USB device 001/011[0] (63 bytes).
TRACE: hid_prepare_report_descriptor(): initialising the report descriptor
for USB device 001/011[0]...
TRACE: hid_prepare_report_descriptor(): retrieving report descriptor for USB
device 001/011[0]...
NOTICE: hid_prepare_report_descriptor(): successfully initialised report
descriptor for USB device 001/011[0].
TRACE: hid_prepare_parser(): setting up the HID parser for USB device
001/011[0]...
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/011[0]...
TRACE: hid_prepare_parser(): dumping the raw report descriptor
TRACE: hid_prepare_parser(): 0x000: 0x05 0x01 0x09 0x00 0xa1 0x01 0x05 0x09
TRACE: hid_prepare_parser(): 0x008: 0x19 0x01 0x29 0x18 0x15 0x00 0x25 0x01
TRACE: hid_prepare_parser(): 0x010: 0x75 0x01 0x95 0x18 0x81 0x02 0x06 0x01
TRACE: hid_prepare_parser(): 0x018: 0x00 0x19 0x01 0x29 0x14 0x15 0x00 0x26
TRACE: hid_prepare_parser(): 0x020: 0xff 0x00 0x75 0x08 0x95 0x14 0xb1 0x02
TRACE: hid_prepare_parser(): 0x028: 0x05 0x09 0x19 0x01 0x29 0x0e 0x15 0x00
TRACE: hid_prepare_parser(): 0x030: 0x25 0x01 0x75 0x01 0x95 0x0e 0xb1 0x02
TRACE: hid_prepare_parser(): 0x038: 0x75 0x02 0x95 0x01 0xb1 0x01 0xc0
TRACE: hid_prepare_parser(): parsing the HID tree of USB device
001/011[0]...
NOTICE: hid_prepare_parser(): successfully set up the HID parser for USB
device 001/011[0].
NOTICE: hid_force_open(): successfully opened USB device 001/011[0].
device identification of HIDInterface 001/011[0]:
dev_handle: 0x0929c680
device: 0x092961f8
location: 001/011
manufacturer: Saitek
product: Pro Flight Radio Panel
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/011[0]...
TRACE: hid_dump_tree(): iterating the parse tree for USB device
001/011[0]...
parse tree of HIDInterface 001/011[0]:
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0x80
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
path: 0x00010000.0x00000000; type: 0xb0
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/011[0]...
TRACE: hid_get_input_report(): looking up report ID...
TRACE: hid_prepare_parse_path(): preparing search path of depth 2 for parse
tree of USB device 001/011[0]...
TRACE: hid_prepare_parse_path(): search path prepared for parse tree of USB
device 001/011[0].
NOTICE: hid_find_object(): found requested item.
TRACE: hid_get_input_report(): retrieving report ID 0x00 (length: 24) from
USB device 001/011[0]...
WARNING: hid_get_input_report(): failed to retrieve report from USB device
001/011[0]:error sending control message: Broken pipe.
hid_get_input_report failed with return code 20
TRACE: hid_close(): closing USB device 001/011[0]...
TRACE: hid_close(): closing handle of USB device 001/011[0]...
NOTICE: hid_close(): successfully closed USB device 001/011[0].
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/011[0]...
TRACE: hid_close(): freeing memory allocated for HID parser...
TRACE: hid_close(): resetting HIDInterface...
NOTICE: hid_cleanup(): successfully deinitialised HID library.
lsusb -d 06a3:0d05 -vvv
Bus 001 Device 011: ID 06a3:0d05 Saitek PLC
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.00
bDeviceClass 0 (Defined at Interface level)
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x06a3 Saitek PLC
idProduct 0x0d05
bcdDevice 1.80
iManufacturer 1 Saitek
iProduct 2 Pro Flight Radio Panel
iSerial 0
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 34
bNumInterfaces 1
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
(Bus Powered)
MaxPower 220mA
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 3 Human Interface Device
bInterfaceSubClass 0 No Subclass
bInterfaceProtocol 0 None
iInterface 0
HID Device Descriptor:
bLength 9
bDescriptorType 33
bcdHID 1.00
bCountryCode 0 Not supported
bNumDescriptors 1
bDescriptorType 34 Report
wDescriptorLength 63
Report Descriptor: (length is 63)
Item(Global): Usage Page, data= [ 0x01 ] 1
Generic Desktop Controls
Item(Local ): Usage, data= [ 0x00 ] 0
Undefined
Item(Main ): Collection, data= [ 0x01 ] 1
Application
Item(Global): Usage Page, data= [ 0x09 ] 9
Buttons
Item(Local ): Usage Minimum, data= [ 0x01 ] 1
Button 1 (Primary)
Item(Local ): Usage Maximum, data= [ 0x18 ] 24
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x18 ] 24
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= [ 0x01 0x00 ] 1
Generic Desktop Controls
Item(Local ): Usage Minimum, data= [ 0x01 ] 1
Pointer
Item(Local ): Usage Maximum, data= [ 0x14 ] 20
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0xff 0x00 ]
255
Item(Global): Report Size, data= [ 0x08 ] 8
Item(Global): Report Count, data= [ 0x14 ] 20
Item(Main ): Feature, 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= [ 0x01 ] 1
Button 1 (Primary)
Item(Local ): Usage Maximum, data= [ 0x0e ] 14
(null)
Item(Global): Logical Minimum, data= [ 0x00 ] 0
Item(Global): Logical Maximum, data= [ 0x01 ] 1
Item(Global): Report Size, data= [ 0x01 ] 1
Item(Global): Report Count, data= [ 0x0e ] 14
Item(Main ): Feature, data= [ 0x02 ] 2
Data Variable Absolute No_Wrap
Linear
Preferred_State No_Null_Position
Non_Volatile Bitfield
Item(Global): Report Size, data= [ 0x02 ] 2
Item(Global): Report Count, data= [ 0x01 ] 1
Item(Main ): Feature, data= [ 0x01 ] 1
Constant Array Absolute No_Wrap
Linear
Preferred_State No_Null_Position
Non_Volatile Bitfield
Item(Main ): End Collection, data=none
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 10
Device Status: 0x0000
(Bus Powered)
Here is my program
#include <hid.h>
#include <stdio.h>
#include <string.h>
bool match_serial_number(struct usb_dev_handle* usbdev, void* custom,
unsigned int len)
{
bool ret;
char* buffer = (char*)malloc(len);
usb_get_string_simple(usbdev,
usb_device(usbdev)->descriptor.iSerialNumber,
buffer, len);
ret = strncmp(buffer, (char*)custom, len) == 0;
free(buffer);
return ret;
}
int main(void)
{
HIDInterface* hid;
hid_return ret;
HIDInterfaceMatcher matcher = { 0x06a3, 0x0d05, NULL, NULL, 0 };
/* see include/debug.h for possible values */
hid_set_debug(HID_DEBUG_ALL);
hid_set_debug_stream(stderr);
/* passed directly to libusb */
hid_set_usb_debug(0);
ret = hid_init();
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_init failed with return code %d\n", ret);
return 1;
}
hid = hid_new_HIDInterface();
if (hid == 0) {
fprintf(stderr, "hid_new_HIDInterface() failed, out of memory?\n");
return 1;
}
ret = hid_force_open(hid, 0, &matcher, 3);
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_force_open failed with return code %d\n", ret);
return 1;
}
ret = hid_write_identification(stdout, hid);
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_write_identification failed with return code %d\n",
ret);
return 1;
}
ret = hid_dump_tree(stdout, hid);
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_dump_tree failed with return code %d\n", ret);
return 1;
}
/*** trying to get at the 24 inputs in the Device Decriptor ***/
const int PATH_OUT[2] = { 0x00010000, 0x00000000 };
unsigned int PATHLEN=2;
char packet[24];
unsigned int RECV_PACKET_LEN=24;
ret = hid_get_input_report(hid, PATH_OUT, PATHLEN, packet,
RECV_PACKET_LEN);
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_get_feature_report failed with return code %d\n",
ret);
}
ret = hid_close(hid);
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_close failed with return code %d\n", ret);
return 1;
}
hid_delete_HIDInterface(&hid);
ret = hid_cleanup();
if (ret != HID_RET_SUCCESS) {
fprintf(stderr, "hid_cleanup failed with return code %d\n", ret);
return 1;
}
return 0;
}
More information about the libhid-discuss
mailing list