Can windows (HidLibrary.dll) send packet to USB HID (Keyboard + vendor-defined)?

I’m trying to write a usb device by stm32f103c8t6, which is detected as keyboard to send key code to windows, and vendor-defined to send-receive custom data.

But only keyboard work.

Here is usb treeview:
usb view

Here is descriptors:

static __code const unsigned char _USB_HID_Custom_ReportDecriptor_Data[] = {
/*Usage Page (vendor define),                        */ 0x06, 0x00, 0xFF,
/*Usage (id 1),                                      */ 0x09, 1,
/*Collection (Application),                          */ 0xA1, 0x01,
/*  Usage Minimum (1),                               */ 0x19, 1,
/*  Usage Maximum (1),                               */ 0x29, 1,
/*  Logical Minimum (0),                             */ 0x15, 0,
/*  Logical Maximum (255),                           */ 0x25, 255,
/*  Report Size (8),                                 */ 0x75, 8,
/*  Report Count (8),                                */ 0x95, 8,
/*  Input (Data, Variable, Absolute), ;Modifier byte */ 0x81, 0x02,
/*  Usage Minimum (1),                               */ 0x19, 1,
/*  Usage Maximum (1),                               */ 0x29, 1,
/*  Output(Data, Variable, Absolute), ;Modifier byte */ 0x91, 0x02,
/*End Collection                                     */ 0xC0,
};

static __code const unsigned char _USB_HID_Keyboard_ReportDecriptor_Data[] = {
/*Usage Page (Generic Desktop),                      */ 0x05, 0x01,
/*Usage (Keyboard),                                  */ 0x09, 0x06,
/*Collection (Application),                          */ 0xA1, 0x01,
/*  Usage Page (Key Codes);                          */ 0x05, 0x07,
/*  Report ID (0x01)                                 */ 0x85, 0x01,
/*  Usage Minimum (224),                             */ 0x19, 0xE0,
/*  Usage Maximum (231),                             */ 0x29, 0xE7,
/*  Logical Minimum (0),                             */ 0x15, 0x00,
/*  Logical Maximum (1),                             */ 0x25, 0x01,
/*  Report Size (1),                                 */ 0x75, 0x01,
/*  Report Count (8),                                */ 0x95, 0x08,
/*  Input (Data, Variable, Absolute), ;Modifier byte */ 0x81, 0x02,
/*  Usage Page (Key Codes),                          */ 0x05, 0x07,
/*  Usage Minimum (0),                               */ 0x19, 0x00,
/*  Usage Maximum (101),                             */ 0x29, 0x65,
/*  Logical Minimum (0),                             */ 0x15, 0x00,
/*  Logical Maximum(101),                            */ 0x25, 0x65,
/*  Report Count (6),                                */ 0x95, 0x06,
/*  Report Size (8),                                 */ 0x75, 0x08,
/*  Input (Data, Array), ;Key arrays (6 bytes)       */ 0x81, 0x00,
/*End Collection                                     */ 0xC0,
};
static __code const unsigned char _USB_DeviceDescriptor_Data[] = {
/*bLength                  */ 0x12,             //(18 bytes)
/*bDescriptorType          */ 0x01,             //(Device Descriptor)
/*bcdUSB                   */ 0x00, 0x02,       //(USB Version 2.0) -> but device is Low-Speed only
/*bDeviceClass             */ 0x00,             //(defined by the interface descriptors)
/*bDeviceSubClass          */ 0x00,
/*bDeviceProtocol          */ 0x00,
/*bMaxPacketSize0          */ 0x40,              //(64 bytes)
/*idVendor                 */ 'M', 'S',
/*idProduct                */ 0, 'D',
/*bcdDevice                */ 0x01, 0x00,
/*iManufacturer            */ 0x01,             //(String Descriptor 1)
/*iProduct                 */ 0x02,             //(String Descriptor 2)
/*iSerialNumber            */ 0x00,             //(No String Descriptor)
/*bNumConfigurations       */ 0x01,             //(1 Configuration)
};
static __code const unsigned char _USB_ConfigurationDescription_Data[] = {
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x02,             //(Configuration Descriptor)
/*wTotalLength             */ 9   + 9 + 9 + 7   + 9 + 9 + 7, 0x00,
/*bNumInterfaces           */ 0x02,             //(2 Interfaces)
/*bConfigurationValue      */ 0x01,             //(Configuration 1)
/*iConfiguration           */ 0x00,             //(No String Descriptor)
/*bmAttributes             */ 0x00,
/*MaxPower                 */ 0x32,             //(100 mA)
//-----------------------------------
//-----------------------------------
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x04,             //(Interface Descriptor)
/*bInterfaceNumber         */ 0x00,             //(Interface 0)
/*bAlternateSetting        */ 0x00,
/*bNumEndpoints            */ 0x01,             //(1 Endpoint)
/*bInterfaceClass          */ 0x03,             //(HID - Human Interface Device)
/*bInterfaceSubClass       */ 0x01,             //(Boot Interface)
/*bInterfaceProtocol       */ 0x01,             //(Keyboard)
/*iInterface               */ 0x00,             //(No String Descriptor)
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x21,             //(HID Descriptor)
/*bcdHID                   */ 0x11, 0x01,       //(HID Version 1.11)
/*bCountryCode             */ 0x00,             //(00 = not localized)
/*bNumDescriptors          */ 0x01,
/*bDescriptorType          */ 0x22,             //(Class=Report)
/*wDescriptorLength        */ sizeof(_USB_HID_Keyboard_ReportDecriptor_Data), 0x00,
//-----------------------------------
/*bLength                  */ 0x07,             //(7 bytes)
/*bDescriptorType          */ 0x05,             //(Endpoint Descriptor)
/*bEndpointAddress         */ 0x81,             //(Direction=IN EndpointID=1)
/*bmAttributes             */ 0x03,             //(TransferType=Interrupt)
/*wMaxPacketSize           */ 0x08, 0x00,
/*bInterval                */ 0x0A,             //(10 ms)
//-----------------------------------
//-----------------------------------
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x04,             //(Interface Descriptor)
/*bInterfaceNumber         */ 0x01,             //(Interface 1)
/*bAlternateSetting        */ 0x00,
/*bNumEndpoints            */ 0x01,             //(1 Endpoint)
/*bInterfaceClass          */ 0x03,             //(HID - Human Interface Device)
/*bInterfaceSubClass       */ 0x00,             //(None)
/*bInterfaceProtocol       */ 0x00,             //(None)
/*iInterface               */ 0x00,             //(No String Descriptor)
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x21,             //(HID Descriptor)
/*bcdHID                   */ 0x11, 0x01,       //(HID Version 1.11)
/*bCountryCode             */ 0x00,             //(00 = not localized)
/*bNumDescriptors          */ 0x01,
/*bDescriptorType          */ 0x22,             //(Class=Report)
/*wDescriptorLength        */ sizeof(_USB_HID_Custom_ReportDecriptor_Data), 0x00,
//-----------------------------------
/*bLength                  */ 0x07,             //(7 bytes)
/*bDescriptorType          */ 0x05,             //(Endpoint Descriptor)
/*bEndpointAddress         */ 0x01,             //(Direction=OUT EndpointID=1)
/*bmAttributes             */ 0x03,             //(TransferType=Interrupt)
/*wMaxPacketSize           */ 0x08, 0x00,
/*bInterval                */ 0x0A,             //(10 ms)
};

If only use vendor-defined is work too: HidDevice send to stm32

Do I have to send anyway from computer to stm32 device?

OMG, i find a solution

bring vendor-defined descriptor interface before keyboard interface, that’s DONE =))

unbelievable

static __code const unsigned char _USB_HID_Custom_ReportDecriptor_Data[] = {
/*Usage Page (vendor define),                        */ 0x06, 0x00, 0xFF,
/*Usage (id 1),                                      */ 0x09, 1,
/*Collection (Application),                          */ 0xA1, 0x01,
/*  Usage Minimum (1),                               */ 0x19, 1,
/*  Usage Maximum (1),                               */ 0x29, 1,
/*  Logical Minimum (0),                             */ 0x15, 0,
/*  Logical Maximum (255),                           */ 0x25, 255,
/*  Report Size (8),                                 */ 0x75, 8,
/*  Report Count (8),                                */ 0x95, 8,
/*  Input (Data, Variable, Absolute), ;Modifier byte */ 0x81, 0x02,
/*  Usage Minimum (1),                               */ 0x19, 1,
/*  Usage Maximum (1),                               */ 0x29, 1,
/*  Output(Data, Variable, Absolute), ;Modifier byte */ 0x91, 0x02,
/*End Collection                                     */ 0xC0,
};

static __code const unsigned char _USB_HID_Keyboard_ReportDecriptor_Data[] = {
/*Usage Page (Generic Desktop),                      */ 0x05, 0x01,
/*Usage (Keyboard),                                  */ 0x09, 0x06,
/*Collection (Application),                          */ 0xA1, 0x01,
/*  Usage Page (Key Codes);                          */ 0x05, 0x07,
/*  Report ID (0x01)                                 */ 0x85, 0x01,
/*  Usage Minimum (224),                             */ 0x19, 0xE0,
/*  Usage Maximum (231),                             */ 0x29, 0xE7,
/*  Logical Minimum (0),                             */ 0x15, 0x00,
/*  Logical Maximum (1),                             */ 0x25, 0x01,
/*  Report Size (1),                                 */ 0x75, 0x01,
/*  Report Count (8),                                */ 0x95, 0x08,
/*  Input (Data, Variable, Absolute), ;Modifier byte */ 0x81, 0x02,
/*  Usage Page (Key Codes),                          */ 0x05, 0x07,
/*  Usage Minimum (0),                               */ 0x19, 0x00,
/*  Usage Maximum (101),                             */ 0x29, 0x65,
/*  Logical Minimum (0),                             */ 0x15, 0x00,
/*  Logical Maximum(101),                            */ 0x25, 0x65,
/*  Report Count (6),                                */ 0x95, 0x06,
/*  Report Size (8),                                 */ 0x75, 0x08,
/*  Input (Data, Array), ;Key arrays (6 bytes)       */ 0x81, 0x00,
/*End Collection                                     */ 0xC0,
};
static __code const unsigned char _USB_DeviceDescriptor_Data[] = {
/*bLength                  */ 0x12,             //(18 bytes)
/*bDescriptorType          */ 0x01,             //(Device Descriptor)
/*bcdUSB                   */ 0x00, 0x02,       //(USB Version 2.0) -> but device is Low-Speed only
/*bDeviceClass             */ 0x00,             //(defined by the interface descriptors)
/*bDeviceSubClass          */ 0x00,
/*bDeviceProtocol          */ 0x00,
/*bMaxPacketSize0          */ 0x40,              //(64 bytes)
/*idVendor                 */ 'M', 'S',
/*idProduct                */ 0, 'D',
/*bcdDevice                */ 0x01, 0x00,
/*iManufacturer            */ 0x01,             //(String Descriptor 1)
/*iProduct                 */ 0x02,             //(String Descriptor 2)
/*iSerialNumber            */ 0x00,             //(No String Descriptor)
/*bNumConfigurations       */ 0x01,             //(1 Configuration)
};
static __code const unsigned char _USB_ConfigurationDescription_Data[] = {
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x02,             //(Configuration Descriptor)
/*wTotalLength             */ 9   + 9 + 9 + 7   + 9 + 9 + 7, 0x00,
/*bNumInterfaces           */ 0x02,             //(2 Interfaces)
/*bConfigurationValue      */ 0x01,             //(Configuration 1)
/*iConfiguration           */ 0x00,             //(No String Descriptor)
/*bmAttributes             */ 0x80,
/*MaxPower                 */ 0x32,             //(100 mA)
//-----------------------------------
//-----------------------------------
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x04,             //(Interface Descriptor)
/*bInterfaceNumber         */ 0x00,             //(Interface 0)
/*bAlternateSetting        */ 0x00,
/*bNumEndpoints            */ 0x01,             //(1 Endpoint)
/*bInterfaceClass          */ 0x03,             //(HID - Human Interface Device)
/*bInterfaceSubClass       */ 0x00,             //(None)
/*bInterfaceProtocol       */ 0x00,             //(None)
/*iInterface               */ 0x00,             //(No String Descriptor)
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x21,             //(HID Descriptor)
/*bcdHID                   */ 0x11, 0x01,       //(HID Version 1.11)
/*bCountryCode             */ 0x00,             //(00 = not localized)
/*bNumDescriptors          */ 0x01,
/*bDescriptorType          */ 0x22,             //(Class=Report)
/*wDescriptorLength        */ sizeof(_USB_HID_Custom_ReportDecriptor_Data), 0x00,
//-----------------------------------
/*bLength                  */ 0x07,             //(7 bytes)
/*bDescriptorType          */ 0x05,             //(Endpoint Descriptor)
/*bEndpointAddress         */ 0x01,             //(Direction=OUT EndpointID=1)
/*bmAttributes             */ 0x03,             //(TransferType=Interrupt)
/*wMaxPacketSize           */ 0x08, 0x00,
/*bInterval                */ 0x0A,             //(10 ms)
//-----------------------------------
//-----------------------------------
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x04,             //(Interface Descriptor)
/*bInterfaceNumber         */ 0x01,             //(Interface 1)
/*bAlternateSetting        */ 0x00,
/*bNumEndpoints            */ 0x01,             //(1 Endpoint)
/*bInterfaceClass          */ 0x03,             //(HID - Human Interface Device)
/*bInterfaceSubClass       */ 0x01,             //(Boot Interface)
/*bInterfaceProtocol       */ 0x01,             //(Keyboard)
/*iInterface               */ 0x00,             //(No String Descriptor)
//-----------------------------------
/*bLength                  */ 0x09,             //(9 bytes)
/*bDescriptorType          */ 0x21,             //(HID Descriptor)
/*bcdHID                   */ 0x11, 0x01,       //(HID Version 1.11)
/*bCountryCode             */ 0x00,             //(00 = not localized)
/*bNumDescriptors          */ 0x01,
/*bDescriptorType          */ 0x22,             //(Class=Report)
/*wDescriptorLength        */ sizeof(_USB_HID_Keyboard_ReportDecriptor_Data), 0x00,
//-----------------------------------
/*bLength                  */ 0x07,             //(7 bytes)
/*bDescriptorType          */ 0x05,             //(Endpoint Descriptor)
/*bEndpointAddress         */ 0x82,             //(Direction=IN EndpointID=2)
/*bmAttributes             */ 0x03,             //(TransferType=Interrupt)
/*wMaxPacketSize           */ 0x08, 0x00,
/*bInterval                */ 0x0A,             //(10 ms)
};

0

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật