2014-11-27 4 views
1

저는 (STM32F4 마이크로 컨트롤러를 사용하여) USB HID 펜 장치를 만들었습니다. 내 장치는 Windows 7 또는 Debian 7 (Linux)에서 정상적으로 작동합니다.수제 USB HID 펜 장치는 Windows 7/Linux에서만 작동합니다.

문제는 => 그것은 윈도우 8, 8.1, 10에서 작동하지 않습니다되고, ...

내 장치가 "HID 스타일러스"로 인식되고

, USB보기 나에게 오류를주지 파이프입니다 열기는되지만 커서는 움직이지 않습니다. 더 나쁜 것은, UsbLyzer로 들어오고 나가는 패킷이 보이지 않습니다!

편집 :

여기
On windows 7 = PowerDevice = stay @ D0 
On windows 8 = PowerDevice = D0 1s an then = D3 

내 장치가 컴퓨터 (usbview)에서 볼 방법 :

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 
+0

내 문제는 내가 (활성) D0 이외의 전원 상태를 처리 할 수없는 경우가있는 것으로 생각합니다. HID Windows 드라이버에서 요구하는 전원 수준 'PowerDeviceD3'을 거부 할 수있는 방법을 검색하지만 실제로 수행 할 수 있는지 여부는 알 수 없습니다. – user2629409

답변

0

I : 여기

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 

을 그리고 내 장치 HID 설명입니다 많은 변경됨 :

  • 변경 방법은 내가 패딩
  • 내가

마침내 장치를 만들 어쩌면

  • .... 다른 사람을 더 이상 많이 변경하지 않는 많은 것들을 스캔 시간을 보내지 않는 확인 그 작품! 여기

    *이 IAD (HID 펜 장치 + CDC)

    /********************** USB 구성 디스크립터 내 USB의 구성 서술자 *********************/

    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 the configuration*/ 
    0x80,         /*bmAttributes: self powered */ 
    0xFA,         /*MaxPower 500 mA: this current is used for detecting Vbus*/ 
    /* Total 09 */ 
    

    /******************** ** HID 디지타이저 인터페이스 **********************/

    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 to 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 */ 
    

    /************** *** 인터페이스 연관 기술자 *********************/

    ,
    0x08,        // Size of this descriptor in bytes 
    0x0B,        // Interface association descriptor type 
    0x01,        // First associated interface 
    0x02,        // Number of contiguous associated interfaces 
    COMM_INTF,       // bInterfaceClass of the first interface 
    ABSTRACT_CONTROL_MODEL,    // bInterfaceSubClass of the first interface 
    V25TER,        // bInterfaceProtocol of the first interface 
    0x00,        // Interface string index 
    /* Total 42 */ 
    

    /***************** CDC에 대한 설명자 **********************/

    // Interface Descriptor 
    0x09,        // Size of this descriptor in bytes 
    USB_DESCRIPTOR_INTERFACE,   // Interface descriptor type 
    CDC_COMM_INTF_ID,     // Interface number 
    0x00,        // Alternate setting number 
    0x01,        // Number of endpoints in this 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 this descriptor in bytes (5) 
    CS_INTERFACE,      // bDescriptorType 
    DSC_FN_HEADER,      // bDescriptorSubtype 
    0x20, 0x01,       // bcdCDC 
    /* Total 56 */ 
    
    // Abstract Control Management Functional Descriptor 
    0x04,        // Size of this 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 this descriptor in bytes (5) 
    CS_INTERFACE,      // bDescriptorType 
    DSC_FN_UNION,      // bDescriptorSubtype 
    0x01,        // bControlInterface 
    0x02,        // bSubordinateInterface0 
    /* Total 65 */ 
    
    // Call Management Functional Descriptor 
    0x05,        // Size of this descriptor in bytes (5) 
    CS_INTERFACE,      // bDescriptorType 
    DSC_FN_CALL_MGT,     // bDescriptorSubtype 
    0x00,        // bmCapabilities 
    0x02,        // bDataInterface 
    /* Total 70 */ 
    
    // Endpoint Descriptor 
    0x07,        // Size of this 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 this descriptor in bytes (9) 
    USB_DESCRIPTOR_INTERFACE,   // Interface descriptor type 
    0x02,        // Interface number 
    0x00,        // Alternate setting number 
    0x02,        // Number of endpoints in this interface 
    DATA_INTF,       // Class code 
    0x00,        // Subclass code 
    NO_PROTOCOL,      // Protocol code 
    0x00,        // Interface string index 
    /* Total 86 */ 
    
    // Endpoint Descriptor 
    0x07,        // Size of this 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 this descriptor in bytes 
    USB_DESCRIPTOR_ENDPOINT,   // Endpoint descriptor 
    CDC_IN_EP,       // Endpoint address 
    _BULK,        // Attributes 
    DESC_CONFIG_WORD(0x40),    // Size 
    0x00 
    /* Total 100 */ 
    

    그리고 마지막으로 내가 사용하는 HID 설명 :

    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