Page 1 of 1

USB HID keyboard 'search' function

Posted: Tue Apr 23, 2024 5:19 am
by Kahvinkeitin
I have previosly used this library https://github.com/T-vK/ESP32-BLE-Keyboard to send keystrokes to an android through ble. Now i wanted to start using usb connection instead and got an S3 for the purpose which works otherwise but i cannot send one specific command which i was able to on ble.

So i need to open the search bar in the androids settings and in the ble library it was as simple as calling KEY_MEDIA_WWW_SEARCH, but no matter what i do i cant get it to work on usb. To my understanding the ble library sends the search key as 2 bites which are 0x21, 0x02 and these should correspond to 0x0221 (CONSUMER_CONTROL_SEARCH in the USBHIDConsumerControls). How ever this does not work.

I know this is badly explained but im hoping someone would know more of this than i do.

Re: USB HID keyboard 'search' function

Posted: Tue Apr 23, 2024 8:52 am
by tore-espressif
Hi,
The USB HID protocol offers 2 interfaces
1. BOOT protocol: simple and easy protocols for keyboards. Does not support media keyds
2. HID custom protocol: You must define the additional (media) HID reports yourself, but you can send all kind of reports

Here is a nice thread, where users tried to implement media keys with ESP32 and Arduino https://forum.espruino.com/conversations/365217/ .
It can serve as a nice starting point

Re: USB HID keyboard 'search' function

Posted: Tue Apr 23, 2024 9:37 am
by Kahvinkeitin
Thank you for the response, i will read it thoroughly and try to implement the feture.