[libhid-discuss] broken pipe error

Christopher raccoonone at procyongames.com
Tue Aug 26 06:54:22 UTC 2008


Now that I've got my code compiling (thanks, Marian), I've having some 
problems talking to the USB device I've got connected. 
hid_interrupt_read seems to work just fine, but I keep getting "broken 
pipe" errors when I use hid_get_input_report(). I seem to have the path 
right, but I'm totally new to USB programming so I could be messing up 
something really basic.
Thanks for any help,
Christopher

This is the message I get:
  TRACE: hid_get_input_report(): looking up report ID...
  TRACE: hid_prepare_parse_path(): preparing search path of depth 3 for 
parse tree of USB device 001/002[0]...
  TRACE: hid_prepare_parse_path(): search path prepared for parse tree 
of USB device 001/002[0].
 NOTICE: hid_find_object(): found requested item.
  TRACE: hid_get_input_report(): retrieving report ID 0x00 (length: 
1024) from USB device 001/002[0]...
WARNING: hid_get_input_report(): failed to retrieve report from USB 
device 001/002[0]:error sending control message: Broken pipe.

This is the function I use to call hid_get_input_report:
hid_return ReadReport(HIDInterface *hid, int const *path, int const pathlen)
{
    /* trys to get a 16byte report from the specified path. */
    int const RECV_PACKET_LEN = 16;
    char packet[RECV_PACKET_LEN];
    int i;
    hid_return result;
    printf("Attempting to read from");
    for(i = 0; i < pathlen; i++)
    {
        printf(" 0x%08x", path[i]);
    }
    printf("\n");
    result = hid_get_input_report(hid, path, pathlen, packet, 
RECV_PACKET_LEN);
    if (result != HID_RET_SUCCESS)
    {
        printf("hid_get_input_report() failed. Error code: %d\n", result);
    }
    else
    {
        printf("Input report: %s\n", packet);
    }
    return result;
}

And then I call it like this:
    int const PATHIN_1[PATHLEN] = { 0xffa00001, 0xffa00002, 0xffa10003 };
    ReadReport(hid, PATHIN_1, PATHLEN);

PATHLEN is #defined as 3



More information about the libhid-discuss mailing list