flipperzero-firmware icon indicating copy to clipboard operation
flipperzero-firmware copied to clipboard

Badusb keyboardlayout support

Open rcv4 opened this issue 3 years ago • 1 comments

Reopen #1525

What's new

  • added a config menu to the badusb application which allows to select the keyboard layout used when emulating a hid and running a badusb script. the selected layout is persisted and reused on subsequent script execution until another layout is selected. some keyboard layouts are provided, layout files can be generated using the tool (here)
  • reworked directory structure on the sd card to avoid mixing scripts and keyboard layout files. new structure and additional sd card files are in "assets/resources/badusb".

Verification

  • copy the content of the "assets/resources/badusb/" folder into the "badusb/" folder of the sd card. if the sd card does not have the new directory hierarchy, the display may be confusing because the file selector will go straight to the root of the sd-card (but still everything will work)
  • on your computer, select a keyboard input language other than english-us.
  • plug the flipperzero to a computer with an usb cable
  • launch the badusb application, select a simple script
  • press run. the script executes, if your computer keyboard is not set to "en-US", you may see some strange character replacement ('q' instead of 'a', 'z' instead of 'y'...)
  • on the flipper, still on the script execution page, press the left button to enter the "config" menu. select a keyboard layout matching the one on your computer. after selecting a layout, you are back to the config menu, you should press back once again to see the script execution view again.
  • on the flipper, press "run". the script executes, you should see exactly what was intended, without character replacements.
  • when you exit the badusb application, you should see a ".badusb.settings" file appear next to the script and layouts folders. this file persists the last used keyboard layout. application should work even if this file does not exist.

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

rcv4 avatar Oct 11 '22 21:10 rcv4

there is still weird behavior: if i let the flipper sit in the work-view for a while the app will freeze and i need to restart the flipper. i am not sure where this comes from and sadly i dont have debugging equipment yet.

if anyone knows how to fix this feel free to help

rcv4 avatar Oct 22 '22 10:10 rcv4