tinygo-keyboard icon indicating copy to clipboard operation
tinygo-keyboard copied to clipboard

Want to add BLE support

Open sago35 opened this issue 1 year ago • 6 comments

I would like to add an implementation of the nRF52840 with BLE HID. However, I do not have much knowledge of BLE and do not know how to tackle this issue.

sago35 avatar Oct 12 '23 22:10 sago35

I have tried the following so far

  • Run blehid_keyboard example from Arduino and check with WireShark
    • Adafruit Bluefruit nRF52 Libraries > Peripheral > blehid_keyboard
      • Probably using a different version of this : https://github.com/adafruit/Adafruit_nRF52_Arduino/blob/master/libraries/Bluefruit52Lib/examples/Peripheral/blehid_keyboard/blehid_keyboard.ino
    • But maybe it was encrypted and could not be read properly
      • https://x.com/sago35tk/status/1700104654464627148?s=20

F5f70FrboAAIiq-

sago35 avatar Oct 12 '23 22:10 sago35

i tried to implement it, but i doubt it is possible, as per tinygo bluetooth lib bonding/pairing is still not implemented and i would assume it would be impossible to act as a keyboard on device if you are not paired (at least from my understanding)

i opened meanwhile PR that does implement communication between two halves though, would like some feedback and maybe direction on how to improve it :pray:

funkycode avatar Oct 30 '23 20:10 funkycode

Oops, tinygo-org/bluetooth did not support bonding. Now, how should we proceed?

https://github.com/tinygo-org/bluetooth#api-stability

This package will probably remain unstable until the following has been implemented:

Scan filters. For example, to filter on service UUID. Bonding and private addresses. Full support for all features at least two desktop operating systems. Maybe some Bluetooth Classic support, such as A2DP.

sago35 avatar Oct 31 '23 12:10 sago35

Maybe it helps here https://github.com/bgould/tinygo-model-m

sunxkui avatar Feb 29 '24 13:02 sunxkui

Thank you for the information. This is an example using a device that can be connected via SPI to BLE.

sago35 avatar Feb 29 '24 22:02 sago35

BLE HID Keyboard support has started to work a bit in #22. At least it worked on Android. However, pairing did not work well on Windows. We need to investigate this further in the future.

sago35 avatar Feb 29 '24 22:02 sago35