Heerkog / MicroPythonBLEHID

Human Interface Device (HID) over Bluetooth Low Energy (BLE) GATT library for MicroPython.
GNU General Public License v3.0
238 stars 32 forks source link

Mouse and keyboard? #20

Closed aloneguid closed 2 months ago

aloneguid commented 2 months ago

Is it possible to act as a mouse and keyboard at the same time? I have managed to make it work exclusively as keyboard or exclusively as mouse, but not simultaneously. HID spec is hard to understand, wondering if you can help please 🙏

Heerkog commented 2 months ago

Yes, but this functionality is not offered 'out of the box'. In order to have a mouse + keyboard, you will need to subclass HumanInterfaceDevice to create a device with service and report descriptors that support mouse and keyboard functionalities.

You can follow the same structure as the Keyboard class. The resources section of the readme has a good tutorial on how to create a descriptor for such a multi-device.

Once you have a multi-device descriptor, your input report should match the bytes for that descriptor.

aloneguid commented 2 months ago

Thank you, great tutorial by the way. I have managed to create keyboard and mouse running on pico now.

Heerkog commented 2 months ago

Excellent! A pull request with this functionality would probably be appreciated by many others!

dahanzimin commented 1 month ago

@aloneguid Thank you for your success. Would you be willing to share how to configure the keyboard and mouse to work together? Thank you