cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID Device: how to send Unicode?

smoothmanifolds
Associate II

I have a USB HID Device STM32CubeIDE project with the following USB HID Report Descriptor

 

 

	0x05,0x01,       // Usage Page: Generic Desktop Page (0x01), page HID Usage Tables 1.4
	0x09,0x06,       // Usage:      Keyboard (0x06)
	0xa1,0x01,       // Collection: Application
		0x05,0x07,       // Usage Page:      Keyboard/Keypad Page (0x07)
		0x19,0xe0,       // Usage Minimum:   0xe0: kbd lctrl
		0x29,0xe7,       // Usage Maximum:   0xe7: kbd rgui
		0x15,0x00,       // Logical Minimum: 0
		0x25,0x01,       // Logical Maximum: 1

		0x95,0x08,       // Report Count:    8  // 8 keys? mod mask
		0x75,0x01,       // Report Size:     1  // 1 bit each?
		0x81,0x02,       // Input:           Data,Var, Abs,No Wrap,Linear,Preferred State,No Null Position

		0x95,0x01,       // Report Count:    1  // 1 key? pad
		0x75,0x08,       // Report Size:     8  // 8 bits each?
		0x81,0x03,       // Input:           Const,Var, Abs,No Wrap,Linear,Preferred State,No Null Position

		0x05,0x07,       // Usage Page:      Kbrd/Keypad
		0x19,0x00,       // Usage Minimum
		0x29,0xff,       // Usage Maximum  // 0x65 is the max for a boot device?
		0x15,0x00,       // Logical Minimum
		0x26,0xff,0x00,  // Logical Maximum  // 0x65 is the max for a boot device?  // 0x25: int8? 0x26: int16?

		0x95,0x06,       // Report Count:    6  // 6 keys? 6 keys (6KRO)
		0x75,0x08,       // Report Size:     8  // 8 bits each?
		0x81,0x00,       // Input:           Data,Array, Abs,No Wrap,Linear,Preferred State,No Null Position
	0xc0,            // End Collection

 

 
and I can send (say) an "a" key press/release with the following USB HID Report:
 

 

uint8_t hid_report[0x08] = {0x00};

hid_report[0x00] = 0b0000000;
hid_report[0x02] = 0x04;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&hid_report,sizeof(hid_report));
HAL_Delay(50);

hid_report[0x00] = 0b0000000;
hid_report[0x02] = 0x00;
USBD_HID_SendReport(&hUsbDeviceFS, (uint8_t*)&hid_report,sizeof(hid_report));
HAL_Delay(1000);

 

 

Now the USB HID Usage Tables 1.4 document has a Usage Page dedicated to Unicode (Usage Page 0x10) that says that one can send Unicode encoded as UCS-2. But it's unclear to me how the HID Report should look like in that case.

 

So, how exactly does the HID Report look like (for one, or several) Unicode characters?

0 REPLIES 0