2024-12-14 04:44 AM - edited 2024-12-14 04:50 AM
Hello,
Recently, I have been working with the SensorTile module (STEVAL-STLCS01V1) featuring the STM32L476JG and BlueNRG-MS. I successfully created standalone HID devices for both keyboard and mouse. However, when I attempted to implement a composite HID device, the computer failed to recognize it properly.
I would like to know if BLE supports HID composite devices.
Could you provide some guidance or suggest possible solutions? Thank you!
I will paste my hid_report_map below.
/* USER CODE BEGIN PV */
#define FEATURE_SUPPORT_MULTIMEDIA_KEYBOARD 1 //composite hid
#define use_mouse 1
#define use_keybord 1
#if FEATURE_SUPPORT_MULTIMEDIA_KEYBOARD
#define HIDS_KB_REPORT_ID 0x01 //0x01
#define HIDS_MM_KB_REPORT_ID 0x02
#endif
static uint8_t hid_report_map[] =
{
#if use_keybord
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x06, // USAGE (Keyboard)
0xa1, 0x01, // COLLECTION (Application)
#if FEATURE_SUPPORT_MULTIMEDIA_KEYBOARD //composite hid
// 0x85, HIDS_KB_REPORT_ID, // REPORT_ID (1)
#endif
0x05, 0x07, // USAGE_PAGE (Keyboard)
// bitmap of modifiers
0x75, 0x01, // Report Size (1),
0x95, 0x08, // Report Count (8),
0x19, 0xE0, // Usage Minimum (224),
0x29, 0xE7, // Usage Maximum (231),
0x15, 0x00, // Logical Minimum (0),
0x25, 0x01, // Logical Maximum (1),
0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte
// 1 Reserved byte
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x08, // REPORT_SIZE (8)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
// LEDs for num lock etc
0x95, 0x05, // REPORT_COUNT (5)
0x75, 0x01, // REPORT_SIZE (1)
0x05, 0x08, // USAGE_PAGE (LEDs)
0x19, 0x01, // USAGE_MINIMUM (Num Lock)
0x29, 0x05, // USAGE_MAXIMUM (Kana)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
// Reserved 3 bits
0x95, 0x01, // REPORT_COUNT (1)
0x75, 0x03, // REPORT_SIZE (3)
0x91, 0x03, // OUTPUT (Cnst,Var,Abs)
/* Slots for 6 keys that can be pressed down at the same time */
0x95, 0x06, // REPORT_COUNT (6)
0x75, 0x08, // REPORT_SIZE (8)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x65, // LOGICAL_MAXIMUM (101)
0x05, 0x07, // USAGE_PAGE (Keyboard)
0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
0x81, 0x00, // INPUT (Data,Ary,Abs)
0xC0, // END_COLLECTION
#endif
#if use_mouse
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x02, // USAGE (Mouse)
0xa1, 0x01, // COLLECTION (Application)
#if FEATURE_SUPPORT_MULTIMEDIA_KEYBOARD //composite hid
0x85, HIDS_MM_KB_REPORT_ID, // REPORT_ID (2)
#endif
0x09, 0x01, // USAGE (Pointer) 鼠标指针的控制
0xa1, 0x00, // COLLECTION (Physical)
0x05, 0x09, // Usage Page (Buttons)
0x19, 0x01, // Usage Minimum (1)
0x29, 0x03, // Usage Maximum (3)
0x15, 0x00, // Logical Minimum (0)
0x25, 0x01, // Logical Maximum (1)
0x95, 0x03, // Report Count (3)
0x75, 0x01, // Report Size (1)
0x81, 0x02, // Input(Data, Variable, Absolute); 3 button bits
0x95, 0x01, // Report Count(1)
0x75, 0x05, // Report Size(5)
0x81, 0x03, // Input(Constant); 5 bit padding
0x75, 0x08, // Report Size (8)
0x95, 0x03, // Report Count (3)
0x05, 0x01, // Usage Page (Generic Desktop)
0x09, 0x30, // Usage (X)
0x09, 0x31, // Usage (Y)
0x09, 0x38, // Usage (Wheel)
0x15, 0x81, // Logical Minimum (-127)
0x25, 0x7F, // Logical Maximum (127)
0x81, 0x06, // Input(Data, Variable, Relative); 3 position bytes (X,Y,Wheel)
0xc0, // END_COLLECTION
0xc0 // END_COLLECTION
#endif
};
2024-12-14 05:07 AM
This is the packet captured on Wireshark.
I hope it do help.