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

[Request for advice] Sending keystrokes from a remote device (Bluetooth COM to USB relay) #83

Closed
ig-sinicyn opened this issue Dec 11, 2023 · 7 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@ig-sinicyn
Copy link
Collaborator

I apologize in advance if this question is going to be offtopic. I'm asking about a feature that may not be a good fit for the project. I'm using a Bluetooth to USB relay to connect a BT keyboard/mouse to android-based projector (bluetooth is in the specs, but it doesn't work on my device).

Now, as a bonus, I would like to add support for sending media keys to the projector from my notebook/home PC.

As I understand it, windows does not support bluetooth server mode, so the best approach would be to send commands via bluetooth SPP profile to the RPi working as Bluetooth COM to USB relay. As a plan B, I can use rest api, but I would prefer to use same protocol everywhere.
I have no problem writing to BT COM port on the windows side, but I can't find a suitable library for the bluetooth com port server on the Raspberry Pi side.

I've tried some projects of https://github.com/ukBaz/python-bluezero/wiki, but most of them are in alpha and the rest look abandoned.
Maybe I'm just using the wrong keywords to search, so I thought I'd ask an expert :)
Could you please suggest which of the existing libraries makes sense to use to create a com-server on the RPi side?

And one more question - would such a feature be useful for Bluetooth to USB relay? I'd be happy to add PR after I get the prototype working.

@quaxalber quaxalber added help wanted Extra attention is needed question Further information is requested labels Dec 12, 2023
@quaxalber
Copy link
Owner

As chance would have it, I am contributing to a project called RelayKeys that might be a perfect fit for your use case :)

You need an inexpensive BLE dongle (e.g., nRF52840 USB Key with TinyUF2 Bootloader) to allow your Windows machine to act as a Bluetooth device. Then you may use RK to send keyboard and mouse commands. Currently there are only a handful of multimedia keys, but the team around @willwade would highly appreciate PRs adding more!

If the team decided to switch to adafruit_hid, there would be more multimedia keys out of the box. But this would require quite a bit of rework.

After all any contribution to RK is for a good cause, with Ace Centre being a charity devoted to developing solutions for people like myself, who are reliant on assistive technology.

Since I can't use my arms anymore, I use an eye-controlled keyboard running on a Windows tablet mounted to my wheelchair. Actually this is intended for speech synthesis. But RelayKeys allows me to turn this tablet into a Bluetooth keyboard. The issued Bluetooth commands are in turn sent to a Pi 0W that is running bluetooth_2_usb and is connected to a KVM switch.

To me my setup sounds quite similar to what you have in mind?

@ig-sinicyn
Copy link
Collaborator Author

Hi @quaxalber!

Thank you so much for both the project and the warm attitude! I'm really glad I asked - it's exactly what I was looking for:)

I've already ordered the nRF52840 dongle, will definitely report back when it arrives and I can try RelayKeys.

@quaxalber
Copy link
Owner

quaxalber commented Dec 12, 2023

Glad to hear :) looking forward to your feedback. In case you need help with setting up let me know!

Closing this. Feel free to comment and/or reopen!

@willwade
Copy link

Nice! Thanks @quaxalber

@ig-sinicyn what media keys are you needing. From memory it would be pretty easy adding missing ones in. Volume we do have. See current keys here https://docs.acecentre.org.uk/products/v/relaykeys/using-relaykeys/relaykeys-cli#command-keypress-key-modifier

let us know how you get on :)

@quaxalber
Copy link
Owner

@ig-sinicyn How have you been getting on with this? Need any help?

@ig-sinicyn
Copy link
Collaborator Author

ig-sinicyn commented Feb 2, 2024

Hi, @quaxalber! Thanks for the great advice, I've managed to use RelayKeys without any issue, works fine!

Also, while waiting for the dongle I've checked some third-party libs and long story short - I have a BLE GATT server that allows to send keystrokes remotely. There's a prototype version but it is not completed yet.

@quaxalber
Copy link
Owner

Great stuff! I bet @willwade is happy about that too!

Curious to learn more about your PR, interesting stuff :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants