Hi Tomek, On 5/9/23, Tomek CEDRO <to...@cedro.info> wrote: > On Tue, May 9, 2023 at 7:04 PM Alan C. Assis wrote: >> Hi Everyone, (sending again with right subject) >> Since many here probably faced similar challenge in the past let me ask: >> How to export HID buttons events from NuttX to Linux? > > USB HID and/or Bluetooth HID ? :-) > > https://www.usb.org/hid > > https://www.bluetooth.com/specifications/specs/human-interface-device-profile-1-1-1/ >
As I said ESP32 doesn't have USB (only ESP32-S2 and ESP32-S3), ESP32-C3/C6 has USB/JTAG/Serial, not an option. Bluetooth HID seems a good option, actually my Mi Band is detected as an input device: /dev/input/event18 bustype : BUS_BLUETOOTH vendor : 0x157 product : 0x5b version : 257 name : "Mi Smart Band 6" phys : "XX:XX:c1:12:XX:XX" uniq : "XX:XX:18:22:XX:XX" bits ev : (null) (null) (null) > > There is an example app in NuttX Apps for USB HID Keyboard.. but I did > not use it myself.. mouse works similar way :-) > > https://github.com/apache/nuttx-apps/tree/master/examples/hidkbd > Yes, I already used it some time ago: search for NuttX Steer-by-Wire on Google and you will find it. > >> Explaining the issue: I have an ESP32 board with LCD and touchscreen >> and I want to create a low cost alternative to Elgato StreamDeck, but >> unfortunately ESP32 doesn't have USB. > > Is Bluetooth HID an option? That would require no external hardware / > modifications, just a standard Bluetooth HID implementation that > should work out of the box on all platforms with no additional custom > drivers. > Yes, my initial idea was Bluetooth HID, but it is more complex than using WiFi and netstick > Also you can leverage WiFi block and transport HID over TCP/IP somehow > and that would provide even broader access but that would require some > driver/software/daemon on the target machine. > > As for USB, in a perfect situation you would have USB Device block in > the MCU and you can create set of logical devices each for a given > function (one physical USB connection can host many logical devices > for instance mouse, keyboard, uart/cdc, mass storage, etc) that you > describe with a descriptors and those tell what endpoints are > read/write sink/sources of a function data (kind of similar to BLE). > One physical device can have several configurations that change on the > fly so you can switch logical functions as you wish. But you need a > USB Device block for that. I miss that part in ESP32 too :-( > > The most common solution in that situation is to use MCU with USB > Device or external chip that would enable USB HID functionality but > that may cost similar to cheapest MCU with USB Device block. > > The ESP32-C3 or ESP32-C6 seems to have some sort of USB-JTAG/UART > block. I did not play with this one yet.. but for compatibility > reasons it may use USB HID transport for UART and JTAG.. if so maybe > it would be possible to cheat the MCU block somehow in order to > provide USB HID mouse/keyboard functionality :-P > This USB is cannot be used as HID or anything else, think it as a USB/Serial serial, you cannot reprogram it. > >> So I think I need something similar to Microsoft VHF (bad name >> Microsoft, shame on you) >> https://learn.microsoft.com/en-us/windows-hardware/drivers/hid/virtual-hid-framework--vhf- >> >> AFAIK Linux doesn't support Virtual HID (at least not yet). >> >> The best option I found was netstick: >> https://github.com/moslevin/netstick > > I would go for Bluetooth HID (widely adopted standard but short > range), or the HID over WiFi using above projects (custom part on the > target machine but more versatile) :-) > > Good luck and have fun! :-) > Thank you! BR, Alan