• Hi there !

    I am currently working in a project that involves acting as a keyboard+mouse combo & sending data over serial.
    Since I only have an original Espruino boardon hand & a soldered HC-05 module ( NOT flashed with a RN42 firmware .. ), I can't:

    • set the HC-05 to some hid device ( I could by flashing it with the RN42 firmware, and also be able to choose whether to describe itself as spp or hid by setting the GPIO11 pin high on power up, but not spp+hid combo here )
    • use the Espruino USBKeyboard or USBMouse since theses don't work for the original Espruino board.

    I ended up writing a little nodejs app to forward & parse serial stuff to either websockets or xdotool:

    • using xdotool, the keyboard & mouse events are OS-wide & seems to work flawlessly
    • using websockets, the client ( running in a web page ) creates the necessary DOM events

    This solution is quite nice for quick tries & until I get myself a board supporting my needs ;)
    Also, it's API is based on Gordon's USBMouse & USBKeyboard implementations ( thx for the code btw - I didn't forget to mention the original author in the files hosted on the repo ;p ), so usage code is almost identical :)

    It can be found on the following repo: https://github.com/stephaneAG/serialToWe­bsockets

    Last but not least, I'll be looking for an implementation offering Mouse + Keyboard + serial over bluetooth ( and later ble/smart ) & I don't know if I'd be able to do so using, for example, the Puck.js
    ( as a start, an usb hid for serial+mouse+keyboard 'd be neat )

    I now know better how to write hid report descriptors, but I'm not sure of how easy it'd be to have such "composite device" working quickly ;)
    On the hid subject, I had some fun writing a quick ( hugely wip ) helper to generate a descriptor's hex representation ( if anyone better knowing the subject is interested: https://github.com/stephaneAG/usbHidDesc­riptors ) :)

    ps: as the author of https://eleccelerator.com/usbdescreqpars­er/ states it, the official program to generate hid report descriptors is "unlikely anyone's cup of tea", and anyway is only available for windows .. if anyone knows of a web-based implementation, I'l be glad to know :)

    Hoping this helps someone else, any advice is hugely welcome :)
    Happy coding everyone ;p

About

Avatar for stephaneAG @stephaneAG started