Forwarded message:
Greetings to all of you.

I am having problem sending report using hid_set_output_report function which always results in USB error: error sending control message: Broken pipe

Its an HID device with multiple interfaces. I have blacklisted the device on the kernel.

It works OK with hid_interrupt_write function.

I am able to send reports using hiddev interfaces successfully too.

I am not sure, if the Usage path is correct.

Any insights would be greatly appreciated.

I have attached lsusb output, /proc/bus/usb/devices/, test code and debug output all in one log file.

Thanks in advance.
Muthu Velu

Greetings to all of you.

I am having problem sending report using hid_set_output_report function which 
always results in USB error: error sending control message: Broken pipe 

Its an HID device with multiple interfaces. I have blacklisted the device on 
the kernel.

It works OK with hid_interrupt_write function.

I am able to send reports using hiddev interfaces successfully too.

I am not sure, if the Usage path is correct.

Any insights would be greatly appreciated.

Thanks in advance.
Muthu Velu


Here is cat /proc/bus/usb/devices

T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 18 Spd=12  MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=32 #Cfgs=  1
P:  Vendor=153a ProdID=000b Rev= 0.01
S:  Manufacturer=WMS Gaming Inc.
S:  Product=SBG Panel
C:* #Ifs= 4 Cfg#= 1 Atr=c0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=10ms
E:  Ad=01(O) Atr=03(Int.) MxPS=  64 Ivl=10ms
I:  If#= 1 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=82(I) Atr=03(Int.) MxPS=   4 Ivl=10ms
E:  Ad=02(O) Atr=03(Int.) MxPS=  64 Ivl=10ms
I:  If#= 2 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=83(I) Atr=03(Int.) MxPS=   4 Ivl=10ms
E:  Ad=03(O) Atr=03(Int.) MxPS=  64 Ivl=10ms
I:  If#= 3 Alt= 0 #EPs= 2 Cls=03(HID  ) Sub=00 Prot=00 Driver=(none)
E:  Ad=84(I) Atr=03(Int.) MxPS=   4 Ivl=10ms
E:  Ad=04(O) Atr=03(Int.) MxPS=  64 Ivl=10ms
 


Here is the lsusb output

# lsusb -d 0x153a:0x000b -vvv
 
Bus 004 Device 017: ID 153a:000b
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0
  bDeviceProtocol         0
  bMaxPacketSize0        32
  idVendor           0x153a
  idProduct          0x000b
  bcdDevice            0.01
  iManufacturer           1 WMS Gaming Inc.
  iProduct                2 SBG Panel
  iSerial                 0
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength          137
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      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
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      34
          Report Descriptor: (length is 34)
            Item(Global): Usage Page, data= [ 0xa0 0xff ] 65440
                            (null)
            Item(Local ): Usage, data= [ 0xa5 ] 165
                            (null)
            Item(Main  ): Collection, data= [ 0x01 ] 1
                            Application
            Item(Local ): Usage, data= [ 0xa6 ] 166
                            (null)
            Item(Local ): Usage, data= [ 0xa7 ] 167
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x40 ] 64
            Item(Main  ): Input, data= [ 0x02 ] 2
                            Data Variable Absolute No_Wrap Linear
                            Preferred_State No_Null_Position Non_Volatile 
Bitfield
            Item(Local ): Usage, data= [ 0xa9 ] 169
                            (null)
            Item(Global): Logical Minimum, data= [ 0x00 ] 0
            Item(Global): Logical Maximum, data= [ 0xff ] 255
            Item(Global): Report Size, data= [ 0x08 ] 8
            Item(Global): Report Count, data= [ 0x40 ] 64
            Item(Main  ): Output, data= [ 0x02 ] 2
                            Data Variable 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     0x0040  bytes 64 once
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0040  bytes 64 once
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      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
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      34
cannot get report descriptor
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0004  bytes 4 once
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0040  bytes 64 once
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           2
      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
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      34
cannot get report descriptor
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0004  bytes 4 once
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0040  bytes 64 once
        bInterval              10
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           2
      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
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength      34
cannot get report descriptor
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0004  bytes 4 once
        bInterval              10
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x04  EP 4 OUT
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               none
          Usage Type               Data
        wMaxPacketSize     0x0040  bytes 64 once
        bInterval              10
  Language IDs: (length=4)
     0409 English(US)


Here is the code.
int main(void)
{
  HIDInterface* hid;
  hid_return ret;

  HIDInterfaceMatcher matcher = { 0x153A, 0x000B, NULL, NULL, 0 };

  hid_set_debug(HID_DEBUG_ALL);
  hid_set_usb_debug(5);
  
  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;
  }

  ret = hid_set_idle(hid, 250, 0 );

    int const PATH_IN[] = { 0xffa000a5, 0xffa000a6, 0xffa000a7 };
    unsigned int const PATH_IN_LEN = sizeof(PATH_IN)/sizeof(PATH_IN[0]);
    char  PACKET[64];
    printf("Size of PATH_IN is %d \n", PATH_IN_LEN);
    PACKET[0] = 0x50;
    PACKET[1] = 0x02;
    PACKET[2] = 0x00;
    PACKET[3] = 0x02;

    unsigned int const SEND_PACKET_LEN = sizeof(PACKET)/sizeof(PACKET[0]);
    printf("Size of PACKET is %d \n", SEND_PACKET_LEN);

    ret = hid_set_output_report(hid, PATH_IN, PATH_IN_LEN, PACKET, 
SEND_PACKET_LEN);

    //******** hid_interrupt_write works OK 
****************************************
    ret = hid_interrupt_write( hid, USB_ENDPOINT_OUT+1, PACKET, 64, 25 );

    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;
}


Here is the output

# ./test_libhid
usb_set_debug: Setting debugging level to 5 (on)
usb_os_init: Found USB VFS at /proc/bus/usb
usb_os_find_busses: Found 005
usb_os_find_busses: Found 004
usb_os_find_busses: Found 003
usb_os_find_busses: Found 002
usb_os_find_busses: Found 001
usb_os_find_busses: Skipping non bus directory devices
usb_os_find_devices: Found 001 on 005
usb_os_find_devices: Found 018 on 004
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 001 on 004
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 095 on 003
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 094 on 003
usb_os_find_devices: Found 004 on 003
skipped 1 class/vendor specific interface descriptors
skipped 1 class/vendor specific interface descriptors
usb_os_find_devices: Found 002 on 003
usb_os_find_devices: Found 001 on 003
error obtaining child information: Inappropriate ioctl for device
error obtaining child information: Inappropriate ioctl for device
usb_os_find_devices: Found 001 on 002
usb_os_find_devices: Found 002 on 001
usb_os_find_devices: Found 001 on 001
error obtaining child information: Inappropriate ioctl for device
Check that you have permissions to write to 005/001 and, if you don't, that you 
set up hotplug (http://linux-hotplug.sourceforge.net/) correctly.
USB error: could not claim interface 0: Device or resource busy
device identification of HIDInterface 004/018[0]:
  dev_handle:    0x093e9658
  device:        0x093f1220
  location:      004/018
  manufacturer:  WMS Gaming Inc.
  product:       SBG Panel
parse tree of HIDInterface 004/018[0]:
  path: 0xffa000a5.0xffa000a6; type: 0x80
  path: 0xffa000a5.0xffa000a7; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0x00000000; type: 0x80
  path: 0xffa000a5.0xffa000a9; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
  path: 0xffa000a5.0x00000000; type: 0x90
Size of PATH_IN is 3
Size of PACKET is 64
USB error: error sending control message: Broken pipe






--
Charles Lepple
[EMAIL PROTECTED]


_______________________________________________
libhid-discuss mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/libhid-discuss

Reply via email to