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

WIP: BLE HID #22

Closed
wants to merge 15 commits into from
Closed

WIP: BLE HID #22

wants to merge 15 commits into from

Conversation

sago35
Copy link
Owner

@sago35 sago35 commented Nov 16, 2023

This PR adds support for BLE HID.

To make it work correctly, you need to change the max_len in github.com/funkycode/bluetooth's gatts_d.go to 144.

At least on Android 14, it seems to be working reasonably well.
It's not working on Windows.

Here's what is added in this PR:

Connect to the host using BLE HID.
Connect split keyboards to each other using BLE.

Please check the implementation examples below.
However, there is still a possibility of changes to the API, etc.

  • Connect to the host using BLE HID.
  • Connect split keyboards to each other using BLE.
    • d.AddBleSplitKeyboard(0x12, bluetooth.DefaultAdapter, "xiao-kb01-0.1.0", [][]keyboard.Keycode{
      {
      jp.KeyA, jp.KeyB, jp.KeyC, jp.KeyD,
      jp.KeyE, jp.KeyF, jp.KeyG, jp.KeyH,
      jp.KeyI, jp.KeyJ, jp.KeyK, jp.KeyL,
      jp.KeyMediaVolumeDec, jp.KeyMediaVolumeInc,
      jp.WheelDown, jp.WheelUp,
      jp.MouseLeft, jp.MouseRight,
      },
      })
    • bk := ble.NewSplitKeyboard(usb.Product)
      err := bk.Connect()
      if err != nil {
      return err
      }
      d.Keyboard = bk

@sago35
Copy link
Owner Author

sago35 commented Nov 16, 2023

Media keys sometimes work, but sometimes they don't.
The mouse still doesn't work.
Layer keys (KeyModX and KeyTo) are working.

@sago35 sago35 marked this pull request as draft November 16, 2023 23:51
@sago35 sago35 changed the title WIP: Blehid WIP: BLE HID Nov 16, 2023
@sago35 sago35 mentioned this pull request Feb 29, 2024
@sago35
Copy link
Owner Author

sago35 commented Sep 2, 2024

I have created a rebased version on the latest origin/main using the patched version of tinygo.org/x/bluetooth mentioned in #48. I will close this PR.

@sago35 sago35 closed this Sep 2, 2024
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

Successfully merging this pull request may close these issues.

1 participant