Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward mouse events from USB over Bluetooth #1732

Open
MonsieurLanza opened this issue Apr 5, 2023 · 2 comments
Open

Forward mouse events from USB over Bluetooth #1732

MonsieurLanza opened this issue Apr 5, 2023 · 2 comments

Comments

@MonsieurLanza
Copy link

Hello,

I may have a edge case here, so context:

  • I am left handed and use a left handed ergonomic mouse -> (Contour Unimouse Wireless) which has a 2.4Ghz dongle.
  • I often switch between 3 or more PCs.
  • I use a bépo (sort of french dvorak) layout.

I currently use a USB ergodox. Every switch is a pain in the a**, so I ended up using barrier/input-leap, which is not a smooth experience (layout incompatibilities), and is not very conform on a professional laptop.

So the perfect combination would be a bluetooth (split) keyboard, with mouse dongle plugged in a keyboard’s USB port, and have ZMK forward mouse HID event over Bluetooth. A keyboard switch of bluetooth bond would also switch the mouse.

I can also imagine, using a bluetooth mouse, being able to directly pair the mouse with the keyboard.

So questions and consideration :

  • Is that feasible at all ? (I think so, but who knows)
  • Dongle consumption may hurt.
  • Where do I start ?
@callym
Copy link

callym commented Apr 5, 2023

I've been looking for something that'd be able to do this for a while.

My use-case is that I have 3 devices I want to switch between but my bluetooth mouse only lets me switch between two, so being able to connect the mouse to a keyboard that can then switch between 3+ devices and forward the mouse connection would be great.

I think it's technically possible to transparently forward the HID events, not sure what processing would need to be done on them to merge the mouse and keyboard events?

@xudongzheng
Copy link
Contributor

Connecting Bluetooth mouse would be the easiest and not require additional hardware. Stock ZMK central supports connecting to one ZMK peripheral, #836 extends that to multiple ZMK peripherals, and extending that to support generic HID peripherals is a matter of implementation. One does need to consider the total amount of CPU/radio time available. Connecting too many peripherals simultaneously will likely increase latency.

Integrating a USB HID device would require USB host support. That's not yet in Zephyr but appears to be under development with new USB stack zephyrproject-rtos/zephyr#42066. In terms of hardware, the easiest would be Nordic nRF52 with a chip like MAX3421E for USB host support. There are lots of alternatives such as using RP2040 for USB host https://github.com/sekigon-gonnoc/Pico-PIO-USB and defining your own communication protocol, or reimplementing the RP2040 PIO USB parts in Zephyr and using Zephyr's split host/controller setup for Bluetooth.

USB host support can be useful for other HID devices (foot pedals, joysticks), MIDI input, among other stuff. It can also be useful for a dongle similar to the Hasu USB to USB converter and allow ZMK to be used for arbitrary USB keyboards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants