Author Topic: winusb bad?  (Read 5068 times)

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
winusb bad?
« on: January 31, 2018, 08:41:09 am »
Can anyone shed some light on winusb? I noticed that hidusb driver works well on windows but the winusb does not play well with feature reports. I have no technical data on this but I do know that every win10 computer that has winusb instead of hidusb crashes on control transfers sending feature reports. In this case they are sent via hidapi.dll
 

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: winusb bad?
« Reply #1 on: January 31, 2018, 12:38:49 pm »
Feature reports are specific to HID-class devices with bmRequestType indicating a Class request.

WinUSB supports generic, vendor-defined control transfers, which could contain the same data as a HID Feature report.


ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: winusb bad?
« Reply #2 on: January 31, 2018, 02:45:10 pm »
All of my reports are vendor-defined reports but all stall with winUSB. Also the PID interface is stalling (i.e. force feedback out/in reports).


this report for example stalls with winUSB not with hidUSB (PID)

Quote

0x05,0x0F,    //    Usage Page Physical Interface
    0x09,0x89,    //    Usage Block Load Status
    0xA1,0x02,    //    Collection Datalink
       0x85,0x02,    //    Report ID 2
       0x09,0x22,    //    Usage Effect Block Index
       0x25,0x28,    //    Logical Maximum 28h (40d)
       0x15,0x01,    //    Logical Minimum 1
       0x35,0x01,    //    Physical Minimum 1
       0x45,0x28,    //    Physical Maximum 28h (40d)
       0x75,0x08,    //    Report Size 8
       0x95,0x01,    //    Report Count 1
       0xB1,0x02,    //    Feature (Variable)
       0x09,0x8B,    //    Usage Block Load Full
       0xA1,0x02,    //    Collection Datalink
          0x09,0x8C,    //    Usage Block Load Error
          0x09,0x8D,    //    Usage Block Handle
          0x09,0x8E,    //    Usage PID Block Free Report
          0x25,0x03,    //    Logical Maximum 3
          0x15,0x01,    //    Logical Minimum 1
          0x35,0x01,    //    Physical Minimum 1
          0x45,0x03,    //    Physical Maximum 3
          0x75,0x08,    //    Report Size 8
          0x95,0x01,    //    Report Count 1
          0xB1,0x00,    //    Feature
       0xC0     ,                   // End Collection
       0x09,0xAC,                   //    Usage Undefined
       0x15,0x00,                   //    Logical Minimum 0
       0x27,0xFF,0xFF,0x00,0x00,    //    Logical Maximum FFFFh (65535d)
       0x35,0x00,                   //    Physical Minimum 0
       0x47,0xFF,0xFF,0x00,0x00,    //    Physical Maximum FFFFh (65535d)
       0x75,0x10,                   //    Report Size 10h (16d)
       0x95,0x01,                   //    Report Count 1
       0xB1,0x00,                   //    Feature
    0xC0     ,    //    End Collection


these are my custom reports and they all fail.

Quote
0x09,0x01, // USAGE (Vendor Usage 1)
   0xa1, 0x01,                    // COLLECTION (Application)
   0x15, 0x00,                    //   LOGICAL_MINIMUM (0)
   0x26, 0xff, 0x00,              //   LOGICAL_MAXIMUM (255)
   0x75, 0x08,                    //   REPORT_SIZE (8)
 
       //get pressure
      0x85, 0x15,                    //   REPORT_ID (21)
      0x95, 0x0D,                    //   REPORT_COUNT (13)
      0x09, 0x00,                    //   USAGE (Undefined)
      0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
      
      //get info
      0x85, 0x11,                    //   REPORT_ID (17)
      0x95, 0x04,                    //   REPORT_COUNT (4
      0x09, 0x00,                    //   USAGE (Undefined)
      0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)

      //get info
      0x85, 0x17,                    //   REPORT_ID (23)
      0x95, 0x30,                    //   REPORT_COUNT (48)
      0x09, 0x00,                    //   USAGE (Undefined)
      0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
      
       //get DC LCD
      0x85, 0x13,                    //   REPORT_ID (19)
      0x95, 0xc0,                    //   REPORT_COUNT (192)
      0x09, 0x00,                    //   USAGE (Undefined)
      0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)

       //get data
      0x85, 0x16,                    //   REPORT_ID (22)
      0x95, 0x22,                    //   REPORT_COUNT (34)
      0x09, 0x00,                    //   USAGE (Undefined)
      0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
      
      //send data
      0x85, 0x12,                    //   REPORT_ID (18)
      0x95, 0x24,                    //   REPORT_COUNT (36) 32+(rid,command, 0, 0)
      0x09, 0x00,                    //   USAGE (Undefined)
      0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
   
      //send DC LCD
      0x85, 0x14,                    //   REPORT_ID (20)
      0x95, 0xc4,                    //   REPORT_COUNT (196) 192+(rid,command, 0, 0)
      0x09, 0x00,                    //   USAGE (Undefined)
      0xb2, 0x02, 0x01,              //   FEATURE (Data,Var,Abs,Buf)
   0xc0,                           // END_COLLECTION
   
« Last Edit: January 31, 2018, 02:59:27 pm by ulao »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: winusb bad?
« Reply #3 on: January 31, 2018, 05:47:47 pm »
WinUSB doesn't support HID reports though you can use WinUSB control transfers to send and request generic data.

ulao

  • Frequent Contributor
  • ****
  • Posts: 172
Re: winusb bad?
« Reply #4 on: February 01, 2018, 08:26:40 am »
Then I'm confused on the terms here.

What is a "HID report"
vs
"Control transfer"

Are the above reports not all control transfers? I thought all feature reports were control transfers?


------------------------------------------------------
oh wait.. I think I see where I failed to connect the dots. So winusb is not going to work with my c# HIDapi wrapper. I was thinking that they were agnostic of each other. I would need to find a winusb wrapper so it sends the "winusb Control transfer" instead of the "hid Control transfer". is this right?

I guess my issue is my application is using the hidapi.dll to send data but with a system that has winusb, that is not going to work? I package the hidapi.dll with my application so I would assume that it uses that but maybe the system is using winusb and somehow messing things up?

« Last Edit: February 01, 2018, 10:52:21 am by ulao »

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: winusb bad?
« Reply #5 on: February 01, 2018, 11:03:21 am »
Yes, WinUSB does not understand HID APIs. You will also need to change the device firmware, as WinUSB doesn't use class requests.