embedded - Homemade USB HID pen device only works on Windows 7 / Linux -


i've made (with stm32f4 microcontroller) usb hid pen device. device works on windows 7, or debian 7 (linux).

the problem => doesn't work on windows 8, 8.1, 10, ...

my device recognized "hid stylus", usb view give me no error, pipe open, cursor won't move. worse, don't see packets coming in or out usblyzer !

edit:

 on windows 7 = powerdevice = stay @ d0  on windows 8 = powerdevice = d0 1s = d3 

here how device seen computer (usbview) :

    device descriptor:     bcdusb:             0x0200     bdeviceclass:         0x00     bdevicesubclass:      0x00     bdeviceprotocol:      0x00     bmaxpacketsize0:      0x40 (64)     idvendor:           0xffff     idproduct:          0x0001     bcddevice:          0x0200     imanufacturer:        0x01     0x0409: "homemade"     iproduct:             0x02     0x0409: "homemade usb pen device"     iserialnumber:        0x03     0x0409: "00000000050c"     bnumconfigurations:   0x01      connectionstatus: deviceconnected     current config value: 0x01     device bus speed:     full     device address:       0x0d     open pipes:              1      endpoint descriptor:     bendpointaddress:     0x81  in     transfer type:   interrupt     wmaxpacketsize:     0x000b (11)     binterval:            0x0a      configuration descriptor:     wtotallength:       0x0022     bnuminterfaces:       0x01     bconfigurationvalue:  0x01     iconfiguration:       0x00     bmattributes:         0x80 (bus powered )     maxpower:             0xfa (500 ma)      interface descriptor:     binterfacenumber:     0x00     balternatesetting:    0x00     bnumendpoints:        0x01     binterfaceclass:      0x03 (hid)     binterfacesubclass:   0x01     binterfaceprotocol:   0x02     iinterface:           0x00      hid descriptor:     bcdhid:             0x0111     bcountrycode:         0x00     bnumdescriptors:      0x01     bdescriptortype:      0x22     wdescriptorlength:  0x0092      endpoint descriptor:     bendpointaddress:     0x81  in     transfer type:   interrupt     wmaxpacketsize:     0x000b (11)     binterval:            0x0a 

and here device hid descriptor :

0x05, 0x0d,                         // usage_page (digitizers) 0x09, 0x02,                         // usage (pen)  0xa1, 0x01,                         // collection (application) 0x09, 0x02,                         //   usage (pen)  0xa1, 0x00,                         //   collection (physical)  0x09, 0x42,                         //     usage (tip switch) 0x15, 0x00,                         //     logical_minimum (0) 0x25, 0x01,                         //     logical_maximum (1) 0x75, 0x01,                         //     report_size (1) 0x95, 0x01,                         //     report_count (1) 0x81, 0x02,                         //     input (data,var,abs)  0x95, 0x03,                         //     report_count (3) 0x81, 0x03,                         //     input (cnst,ary,abs)  0x09, 0x32,                         //     usage (in range) 0x95, 0x01,                         //     report_count (1) 0x81, 0x02,                         //     input (data,var,abs)  0x95, 0x03,                         //     report_count (3) 0x81, 0x03,                         //     input (cnst,ary,abs)  0x09, 0x56,                         //     usage (scan time) 0x16, 0x00, 0x00,                   //     logical_minimum (0) 0x26, 0xff, 0x00,                   //     logical_maximum (255) 0x75, 0x08,                         //     report_size (8) 0x95, 0x01,                         //     report_count (1) 0x81, 0x02,                         //     input (data,ary,abs)  // x tilt 0x09, 0x3d,                         //     usage (x tilt) 0x16, 0xd8, 0xdc,                   //     logical_minimum (-9000) 0x26, 0x28, 0x23,                   //     logical_maximum (9000) 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0e,                         //     unit_exponent (-2) 0x65, 0x14,                         //     unit (en dg) 0x36, 0xd8, 0xdc,                   //     physical_minimum (-9000) 0x46, 0x28, 0x23,                   //     physical_maximum (9000) 0x81, 0x02,                         //     input (data,var,abs)  // y tilt 0x09, 0x3e,                         //     usage (y tilt) 0x16, 0xd8, 0xdc,                   //     logical_minimum (-9000) 0x26, 0x28, 0x23,                   //     logical_maximum (9000) 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0e,                         //     unit_exponent (-2) 0x65, 0x14,                         //     unit (en dg) 0x36, 0xd8, 0xdc,                   //     physical_minimum (-9000) 0x46, 0x28, 0x23,                   //     physical_maximum (9000) 0x81, 0x02,                         //     input (data,var,abs)  0x05, 0x01,                         //     usage_page (generic desktop) 0x15, 0x00,                         //     logical_minimum (0) 0x26, 0x08, 0x52,                   //     logical_maximum (21000) /// 0x08, 0x52, = 21000 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0d,                         //     unit_exponent (-3) 0x65, 0x11,                         //     unit (en cm) 0x09, 0x30,                         //     usage (x) 0x35, 0x00,                         //     physical_minimum (0) 0x46, 0x08, 0x52,                   //     physical_maximum (21000)  0x81, 0x02,                         //     input (data,var,abs)  0x15, 0x00,                         //     logical_minimum (0) 0x26, 0xd0, 0x39,                   //     logical_maximum (14800) /// 0xd0, 0x39, = 14800 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0d,                         //     unit_exponent (-3) 0x65, 0x11,                         //     unit (en cm) 0x09, 0x31,                         //     usage (y) 0x35, 0x00,                         //     physical_minimum (0) 0x46, 0xd0, 0x39,                   //     physical_maximum (14800)  0x81, 0x02,                         //     input (data,var,abs)   0xc0,                               //   end_collection 0xc0,                               // end_collection 

i changed many things :

  • change way make padding
  • i don't send scan time anymore
  • .... maybe others many things don't change lot

i make device works !

here usb config descriptor iad (hid pen device + cdc)

/********************** usb configuration descriptor **********************/

0x09,                                 /* blength: configuration descriptor size */ usb_configuration_descriptor_type,    /* bdescriptortype: configuration */ usb_config_desc_size,                 /* wtotallength: bytes returned */ 0x00, 0x03,                                 /*bnuminterfaces: 3 interface*/ 0x01,                                 /*bconfigurationvalue: configuration value*/ 0x01,                                 /*iconfiguration: index of string descriptor describing configuration*/ 0x80,                                 /*bmattributes: self powered  */ 0xfa,                                 /*maxpower 500 ma: current used detecting vbus*/ /* total 09 */ 

/********************** hid digitizer interface **********************/

0x09,                             /*blength: interface descriptor size*/ usb_interface_descriptor_type,    /*bdescriptortype: interface descriptor type*/ 0x00,                             /*binterfacenumber: number of interface*/ 0x00,                             /*balternatesetting: alternate setting*/ 0x01,                             /*bnumendpoints*/ 0x03,                             /*binterfaceclass: hid*/ 0x00,                             /*binterfacesubclass : 1=boot, 0=no boot*/ 0x00,                             /*ninterfaceprotocol : 0=none, 1=keyboard, 2=mouse*/ 0x00,                             /*iinterface: index of string descriptor*/ /* total 18 */ /******************** descriptor of digitizer hid ********************/ 0x09,                             /*blength: hid descriptor size*/ hid_descriptor_type,              /*bdescriptortype: hid*/ 0x11,                             /*bcdhid: hid class spec release number*/ 0x01, 0x00,                             /*bcountrycode: hardware target country*/ 0x01,                             /*bnumdescriptors: number of hid class descriptors follow*/ 0x22,                             /*bdescriptortype*/ hid_digitizer_report_desc_size,   /*witemlength: total length of report descriptor*/ 0x00, /* total 27 */ /******************** descriptor of digitizer endpoint ********************/ 0x07,                             /*blength: endpoint descriptor size*/ usb_endpoint_descriptor_type,     /*bdescriptortype:*/ hid_in_ep,                        /*bendpointaddress: endpoint address (in)*/ 0x03,                             /*bmattributes: interrupt endpoint*/ hid_in_packet_dig,                /*wmaxpacketsize: 4 byte max */ 0x00, 0x03,                             /*binterval: polling interval (3 ms)*/ /* total 34 */   

/***************** interface association descriptor **********************/

0x08,                               // size of descriptor in bytes 0x0b,                               // interface association descriptor type 0x01,                               // first associated interface 0x02,                               // number of contiguous associated interfaces comm_intf,                          // binterfaceclass of first interface abstract_control_model,             // binterfacesubclass of first interface v25ter,                             // binterfaceprotocol of first interface 0x00,                               // interface string index /* total 42 */ 

/***************** descriptor cdc **********************/

// interface descriptor 0x09,                               // size of descriptor in bytes usb_descriptor_interface,           // interface descriptor type cdc_comm_intf_id,                   // interface number 0x00,                               // alternate setting number 0x01,                               // number of endpoints in interface comm_intf,                          // class code abstract_control_model,             // subclass code v25ter,                             // protocol code 0x00,                               // interface string index /* total 51 */  // cdc class specific 0x05,                               // size of descriptor in bytes (5) cs_interface,                       // bdescriptortype dsc_fn_header,                      // bdescriptorsubtype 0x20, 0x01,                         // bcdcdc /* total 56 */  // abstract control management functional descriptor 0x04,                               // size of descriptor in bytes (4) cs_interface,                       // bdescriptortype dsc_fn_acm,                         // bdescriptorsubtype usb_cdc_acm_fn_dsc_val,             // bmcapabilities: (see pstn120.pdf table 4) /* total 60 */  // union functional descriptor 0x05,                               // size of descriptor in bytes (5) cs_interface,                       // bdescriptortype dsc_fn_union,                       // bdescriptorsubtype 0x01,                               // bcontrolinterface 0x02,                               // bsubordinateinterface0 /* total 65 */  // call management functional descriptor 0x05,                               // size of descriptor in bytes (5) cs_interface,                       // bdescriptortype dsc_fn_call_mgt,                    // bdescriptorsubtype 0x00,                               // bmcapabilities 0x02,                               // bdatainterface /* total 70 */  // endpoint descriptor 0x07,                               // size of descriptor in bytes (7) usb_descriptor_endpoint,            // endpoint descriptor cdc_cmd_ep,                           // endpoint address _interrupt,                         // attributes cdc_comm_in_ep_size, 0x00,          // size 0x02,                               // interval /* total 77 */  // cdc data interface 0x09,                               // size of descriptor in bytes (9) usb_descriptor_interface,           // interface descriptor type 0x02,                               // interface number 0x00,                               // alternate setting number 0x02,                               // number of endpoints in interface data_intf,                          // class code 0x00,                               // subclass code no_protocol,                        // protocol code 0x00,                               // interface string index /* total 86 */  // endpoint descriptor 0x07,                               // size of descriptor in bytes usb_descriptor_endpoint,            // endpoint descriptor cdc_out_ep,                          // endpoint address _bulk,                              // attributes desc_config_word(0x40),             // size 0x00,                               // interval /* total 93 */  // endpoint descriptor 0x07,                               // size of descriptor in bytes usb_descriptor_endpoint,            // endpoint descriptor cdc_in_ep,                           // endpoint address _bulk,                              // attributes desc_config_word(0x40),             // size 0x00 /* total 100 */ 

and hid descriptor used :

0x05, 0x0d,                         // usage_page (digitizers) 0x09, 0x01,                         // usage (digitizers) // +4 0xa1, 0x01,                         // collection (application) 0x09, 0x02,                         //   usage (pen) // +4 0xa1, 0x00,                         //   collection (physical) // +2 0x09, 0x42,                         //     usage (tip switch) 0x15, 0x00,                         //     logical_minimum (0) 0x25, 0x01,                         //     logical_maximum (1) 0x75, 0x01,                         //     report_size (1) 0x95, 0x01,                         //     report_count (1) 0x81, 0x02,                         //     input (data,var,abs) // +12 0x09, 0x00,                         //     usage (undefined / padding) 0x75, 0x03,                         //     report_size (3) 0x95, 0x01,                         //     report_count (1) 0x81, 0x03,                         //     input (cnst,var,abs) // +8 0x09, 0x32,                         //     usage (in range) 0x75, 0x01,                         //     report_size (1) 0x95, 0x01,                         //     report_count (1) 0x81, 0x02,                         //     input (data,var,abs) // +8 0x09, 0x00,                         //     usage (undefined / padding) 0x75, 0x03,                         //     report_size (3) 0x95, 0x01,                         //     report_count (1) 0x81, 0x03,                         //     input (cnst,var,abs) // +8 // x tilt 0x09, 0x3d,                         //     usage (x tilt) 0x16, 0xd8, 0xdc,                   //     logical_minimum (-9000) 0x26, 0x28, 0x23,                   //     logical_maximum (9000) 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0e,                         //     unit_exponent (-2) 0x65, 0x14,                         //     unit (en dg) 0x36, 0xd8, 0xdc,                   //     physical_minimum (-9000) 0x46, 0x28, 0x23,                   //     physical_maximum (9000) 0x81, 0x02,                         //     input (data,var,abs) // +24 // y tilt 0x09, 0x3e,                         //     usage (y tilt) 0x16, 0xd8, 0xdc,                   //     logical_minimum (-9000) 0x26, 0x28, 0x23,                   //     logical_maximum (9000) 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0e,                         //     unit_exponent (-2) 0x65, 0x14,                         //     unit (en dg) 0x36, 0xd8, 0xdc,                   //     physical_minimum (-9000) 0x46, 0x28, 0x23,                   //     physical_maximum (9000) 0x81, 0x02,                         //     input (data,var,abs) // +24 0x05, 0x01,                         //     usage_page (generic desktop) 0x15, 0x00,                         //     logical_minimum (0) 0x26, 0x08, 0x52,                   //     logical_maximum (21000) /// 0x08, 0x52, = 21000 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0d,                         //     unit_exponent (-3) 0x65, 0x11,                         //     unit (en cm) 0x09, 0x30,                         //     usage (x) 0x35, 0x00,                         //     physical_minimum (0) 0x46, 0x08, 0x52,                   //     physical_maximum (21000)  0x81, 0x02,                         //     input (data,var,abs) // +24 0x15, 0x00,                         //     logical_minimum (0) 0x26, 0xd0, 0x39,                   //     logical_maximum (14800) /// 0xd0, 0x39, = 14800 0x75, 0x10,                         //     report_size (16) 0x95, 0x01,                         //     report_count (1) 0x55, 0x0d,                         //     unit_exponent (-3) 0x65, 0x11,                         //     unit (en cm) 0x09, 0x31,                         //     usage (y) 0x35, 0x00,                         //     physical_minimum (0) 0x46, 0xd0, 0x39,                   //     physical_maximum (14800)  0x81, 0x02,                         //     input (data,var,abs)  // +22 0xc0,                               //   end_collection 0xc0,                               // end_collection // +2 // total = 142 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

qt - How to embed QML toolbar and menubar into QMainWindow -