[libhid-discuss] inquiry about writing to data location with specific Report ID
Aadit Shrestha
aaditshrestha at gmail.com
Mon Jul 7 05:27:43 UTC 2008
Dear Sirs,
I have a USB-kit board with PIC16C745. I am trying to get the data from the
5-channels of its A/D converter.
The vendors also provide a program in Visual Basic which uses a HIDComm
program and Active X components underneath.
I don't quite know what is in the firmware and I can only make guesses from
the VB program itself.
The Visual Basic program seems to write 1-byte channel number at data
location with Report ID 2.
Then after delay of 71 ms, it reads from the same location, which returns
the 1-byte data from the respective A/D channel number specified before.
I have tried your program test_libhid.c and I can successfully connect to
the device. But I have not been able to write to the specific location of
Report ID 2.
I have tried different Input Paths as specified in your example for the
Phidgets Quad ServoController, but I have not quite gotten it right.
I have tried different things but I seem to end up with report ID 0x00 and
report ID 0x01, and never with the desired report ID 0x02.
This is the part I have added to your program for write and read.
-----------
int const PATH_IN[2] = { 0xff000000,0xff000000};
int const PATH_OUT[2] = {0xff000000,0xff000000};
char const PACKET[1] = {0x02,0x04};
printf("From here ================================================ \n");
ret = hid_set_output_report(hid, PATH_IN, PATHLEN, PACKET, SEND_PACKET_LEN);
if (ret != HID_RET_SUCCESS)
{
fprintf(stderr, "hid_set_output_report failed with return code %d\n", ret);
}
unsigned char const RECV_PACKET_LEN = 2;
//char packet[RECV_PACKET_LEN];
char packet[2];
usleep(71000);
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);
}
printf("To here ================================================ \n");
--------------------
Snippet from the output ....
TRACE: hid_prepare_report_descriptor(): initialising the report descriptor
for USB device 001/008[0]...
TRACE: hid_prepare_report_descriptor(): retrieving report descriptor for
USB device 001/008[0]...
NOTICE: hid_prepare_report_descriptor(): successfully initialised report
descriptor for USB device 001/008[0].
TRACE: hid_prepare_parser(): setting up the HID parser for USB device
001/008[0]...
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/008[0]...
TRACE: hid_prepare_parser(): dumping the raw report descriptor
TRACE: hid_prepare_parser(): 0x000: 0x06 0x00 0xff 0x09 0x00 0xa1 0x01 0x06
TRACE: hid_prepare_parser(): 0x008: 0x00 0xff 0x85 0x01 0x09 0x00 0x15 0x00
TRACE: hid_prepare_parser(): 0x010: 0x26 0xff 0x00 0x75 0x08 0x95 0x01 0x81
TRACE: hid_prepare_parser(): 0x018: 0x02 0x09 0x00 0x75 0x08 0x95 0x01 0x91
TRACE: hid_prepare_parser(): 0x020: 0x02 0x85 0x02 0x09 0x00 0x75 0x08 0x95
TRACE: hid_prepare_parser(): 0x028: 0x01 0x81 0x02 0x09 0x00 0x75 0x08 0x95
TRACE: hid_prepare_parser(): 0x030: 0x01 0x91 0x02 0x85 0x03 0x09 0x00 0x15
TRACE: hid_prepare_parser(): 0x038: 0x00 0x26 0xff 0x00 0x75 0x08 0x95 0x01
TRACE: hid_prepare_parser(): 0x040: 0x81 0x02 0x09 0x00 0x75 0x08 0x95 0x01
TRACE: hid_prepare_parser(): 0x048: 0x91 0x02 0xc0
TRACE: hid_prepare_parser(): parsing the HID tree of USB device
001/008[0]...
NOTICE: hid_prepare_parser(): successfully set up the HID parser for USB
device 001/008[0].
NOTICE: hid_force_open(): successfully opened USB device 001/008[0].
device identification of HIDInterface 001/008[0]:
dev_handle: 0x0804e0c0
device: 0x0804d048
location: 001/008
manufacturer: Innovative Experiment
product: U-Board USB1.0/1.1 Interface
serial number: V1.00
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/008[0]...
TRACE: hid_dump_tree(): iterating the parse tree for USB device
001/008[0]...
parse tree of HIDInterface 001/008[0]:
path: 0xff000000.0xff000000; type: 0x80
path: 0xff000000.0xff000000; type: 0x90
path: 0xff000000.0xff000000; type: 0x80
path: 0xff000000.0xff000000; type: 0x90
path: 0xff000000.0xff000000; type: 0x80
path: 0xff000000.0xff000000; type: 0x90
TRACE: hid_reset_parser(): resetting the HID parser for USB device
001/008[0]...
More information about the libhid-discuss
mailing list