Skip to content

Conversation

@Cutch
Copy link
Contributor

@Cutch Cutch commented Jun 17, 2022

What's new

  • Updated the Bluetooth Report Map to be a composite HID map
  • Report now includes, keyboard, mouse and consumer controls
  • Fixed the Media Player in the bluetooth remote (Volume Up will take camera captures on ios and android)
  • Updated Bluetooth remote to add a mouse and keyboard remote
  • Added a new bluetooth icon to save on space
  • Long pressing back will allow a user to exit or change the remote
  • Update usb hid keys to pull from libusb_stm32 library & update bad usb keys

Notes

Due to the changes, old connections need to be forgotten and the device paired again. Changing the mac address for the profile does work, but to avoid confusion forgetting the old device is probably better.
file: furi_hal_bt.c

if(profile == FuriHalBtProfileHidKeyboard) {
	// Change MAC address for HID profile
	config->mac_address[2]+=2;
	...

Verification

  • Launch the Bluetooth remote app and pair to a desktop or mobile device (android, for set full features)
  • Ensure Long pressing the back button will open the submenu from any remote
    • Ensure clicking stay on the submenu will stay on the current remote
    • Ensure clicking ok on the submenu will open the remote selection menu
    • Ensure clicking back will exit the app
  • Ensure navigation works with the keynote remote
    • Ensure ok will click space
    • Ensure back will click backspace & on mobile will backspace and click the back key
  • Switch to the media player remote
    • Ensure up & down keys control volume
    • Ensure left and right keys control media tracking
    • Ensure ok button press will pause and play
  • Switch to mouse remote
    • Ensure arrow keys can control the cursor
    • Ensure ok button can left click
    • Ensure long ok button press will turn on selection mode (click again to end)
    • Ensure back button will right click
  • Switch to keyboard remote
    • Ensure arrow keys change the selected key
    • Ensure clicking the ok button on selected key will input that key
    • Ensure long ok button press will repeat the keys
    • Ensure clicking a modifier key, ctrl, alt, cmd (Win/Cmd), will both click the key & toggle the key
      • Ensure entering another character will use the toggled modifier(s)
    • Ensure back button will delete the last character
    • Ensure being disconnected will display the title and status, while connecting will show the keyboard
  • Ensure bad usb scripts still work

Checklist (For Reviewer)

  • PR has description of feature/bug or link to Confluence/Jira task
  • Description contains actions to verify feature/bugfix
  • I've built this code, uploaded it to the device and verified feature/bugfix

@RogueMaster

This comment was marked as abuse.

@RogueMaster

This comment was marked as abuse.

@UberGuidoZ
Copy link
Contributor

This build seems to have an error with BadUSB. I can no longer type a comma ( , ) or the less than sign ( < ).
Test file and results attached
Char_Test.txt
Result_Official_Release_0.60.2.txt
Result_Official_Dev_839e52ac.txt
Result_with PR_1330.txt
.

@Cutch
Copy link
Contributor Author

Cutch commented Jun 21, 2022

This build seems to have an error with BadUSB. I can no longer type a comma ( , ) or the less than sign ( < ). Test file and results attached Char_Test.txt Result_Official_Release_0.60.2.txt Result_Official_Dev_839e52ac.txt Result_with PR_1330.txt .

These should be fixed in the latest commit, thanks for the heads up, I went and fixed a couple other misaligned keys as well.

@UberGuidoZ
Copy link
Contributor

Awesome! Thank you.

@skotopes
Copy link
Contributor

skotopes commented Jul 4, 2022

Hi guys, sorry for delay.

I'll try to pack this PR in 0.62, if there will be no issues.

@nminaylov can you take a look?

@vanish125
Copy link

Windows 10, Android 10, Mac 12.3.1 - Work (android not work play button)
Kubuntu 21.10 - Not work

@vanish125
Copy link

Dmesg on linux: Bluetooth: hci0: unexpected SMP command 0x0b from 80:::::05

@skotopes
Copy link
Contributor

skotopes commented Jul 6, 2022

Hi, we can merge this PR only if it will pass current tests. For more details see comment by @vanish125

Also brunch is not in sync with dev.

@Cutch
Copy link
Contributor Author

Cutch commented Jul 6, 2022

This should be up to date with dev. As for the issues noted. I have tested with android 12 and the play button works fine. Make sure media is playing first, at which point you should be able to pause and play it again.
As for the issues with Kubuntu, the error message, "Bluetooth: hci0: unexpected SMP command 0x0b", seems to be an issues with the OS and BLE devices. @vanish125 if you can check against the official branch and see if it is able to connect, ensure that when you test each branch you are forgetting the device first before connecting. Unless a breaking change was introduced I think we can safely ignore this.

@vanish125
Copy link

Android work ok, after start music player.
Linux Mint latest not work

@Cutch
Copy link
Contributor Author

Cutch commented Jul 6, 2022

Android work ok, after start music player. Linux Mint latest not work

Were you able to check if the dev branch worked with linux?

@vanish125
Copy link

Now on linux connect without error, but still not work

@Cutch
Copy link
Contributor Author

Cutch commented Jul 7, 2022

Quick update, it looks like it actually has nothing to do with "Bluetooth: hci0: unexpected SMP command 0x0b", or this at least does not prevent the connection. The issue comes from how the bluez driver handles report ids with composite devices. I have a partial fix, which gets this working with ubuntu (tested 22.04). It does not work on first pairing, but after restarting the app/connection, the functionality works. (The BT report and characteristics match before and after, and the key presses are being received)

I would suggest to move forward with this as is.
Future work may be needed to better setup report ids with BLE.

@DrZlo13
Copy link
Member

DrZlo13 commented Jul 7, 2022

Does not work on MacOS 12.3.1, M1. Previous version (dev) worked fine.

@skotopes
Copy link
Contributor

skotopes commented Jul 7, 2022

Hi @Cutch

We've discussed this PR internally, we really love the idea. The only stopper is that it's not working on all platforms.
I'm not going to merge it into 0.62, but we can try to fix all issues and merge it in 0.63.

Development team is currently busy with other tasks, but we'll try to provide you additional support if you need it.
Feel free to ping me on discord (skotopes#4130) or here.

PS: to be honest we've been trying to combine keyboard and media keys before and decided to keep part that works for all platforms. But it should be doable.

@DrZlo13
Copy link
Member

DrZlo13 commented Jul 7, 2022

Also, @Cutch, you can look at QMK and ZMK projects, this is firmware for mechanical keyboards. They use BLE and works everywhere.

@Cutch
Copy link
Contributor Author

Cutch commented Jul 7, 2022

Ok I got it working across platforms by using separate input reports instead of report ids.
Tested on Win10, Mac OS (10.14), Android 12, Ubuntu 22. Let me know if I missed anything.

@vanish125
Copy link

Ubuntu 21.10:
[Чт июл 7 19:41:47 2022] hid (null): report_id 0 is invalid
[Чт июл 7 19:41:47 2022] hid-generic 0005:0000:0000.0009: report_id 0 is invalid
[Чт июл 7 19:41:47 2022] hid-generic 0005:0000:0000.0009: item 0 1 1 8 parsing failed
[Чт июл 7 19:41:47 2022] hid-generic: probe of 0005:0000:0000.0009 failed with error -22

@Cutch
Copy link
Contributor Author

Cutch commented Jul 7, 2022

Shoot, good catch it should be ok now. Tested Android, Win10, Ubuntu 22.

@vanish125
Copy link

All work. Great job!

gornekich
gornekich previously approved these changes Jul 8, 2022
Copy link
Member

@gornekich gornekich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful work, thank you!

@skotopes skotopes merged commit 6b3625f into flipperdevices:dev Jul 8, 2022
@Cutch Cutch deleted the bt-remote-additions branch July 8, 2022 13:34
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.

7 participants