Replies: 5 comments
-
I've done this a couple of times for personal projects. It's pretty straightforward to implement, depending on how complicated of a device you're wanting to emulate. I've done keyboard, mouse, and generic gamepad for various projects. What type of HID device are you wanting to do? I'd be happy to share some code if what I have is relevant. |
Beta Was this translation helpful? Give feedback.
-
Initially, would like to emulate a composite mouse and keyboard but I would also be interested the gamepad solution as well. Any code that you are willing to share would be gratefully received. Thanks |
Beta Was this translation helpful? Give feedback.
-
I've uploaded a couple of BLE HID examples to a new repository here. For now I've included a very basic touchpad and keyboard. A couple of caveats on these:
You should be able to run these examples on a Moddable Two and pair them with a PC (I've tested on both Windows and macOS) to emulate a touchpad and keyboard, respectively. I have not put in the pieces to make these reconnect gracefully if power-cycled, but that should be pretty straightforward. The magic happens in The HID device descriptor goes into Modifying those is a matter of generating the right device descriptor and propagating your changes through the report characteristic. It's finicky, but no more so than HID anywhere else. :) Good luck! I'll try to get the basic gamepad example posted soon. Let me know if I can offer any further assistance and I look forward to hearing what you end up building! - Andy |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for this! I will let you know how I make out.
|
Beta Was this translation helpful? Give feedback.
-
I'm going to convert this issue into a discussion to clear it out of the issue queue. I would be delighted to continue the conversation in the discussion topic if anyone gives this a shot. |
Beta Was this translation helpful? Give feedback.
-
The ESP-IDF has a BLE HID device demo. (esp-idf/examples/bluetooth/bluedroid/ble/ble_hid_device_demo)
Are there any plans to provide a similar Moddable example?
If not, do you have any advice on how to go about using the Moddable SDK to emulate a BLE HID device?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions