Updating instructions for adding keyboard layouts

This commit is contained in:
dbisu
2021-09-11 20:21:55 -05:00
parent fb4189bb20
commit af822e3f01
3 changed files with 45 additions and 7 deletions

View File

@@ -34,7 +34,7 @@ Install and have your USB Rubber Ducky working in less than 5 minutes.
7. Find a script [here](https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payloads) or [create your own one using Ducky Script](https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Duckyscript) and save it as `payload.dd` in the Pico. 7. Find a script [here](https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Payloads) or [create your own one using Ducky Script](https://github.com/hak5darren/USB-Rubber-Ducky/wiki/Duckyscript) and save it as `payload.dd` in the Pico.
8. Be careful, if your device isn't in [setup mode](#setup-mode), the device will reboot and after half a second, the script will run. 8. Be careful, if your device isn't in [setup mode](#setup-mode), the device will reboot and after half a second, the script will run.
### Setup mode ### Setup mode
@@ -43,9 +43,13 @@ The easiest way to so is by using a jumper wire between those pins as seen bello
![Setup mode with a jumper](images/setup-mode.png) ![Setup mode with a jumper](images/setup-mode.png)
## Adding non-US keybaords
Instructions for adding non-US keyboards can be found [here](keyboard-layouts.md).
## Useful links and resources ## Useful links and resources
### Docs ### Docs
[CircuitPython](https://circuitpython.readthedocs.io/en/6.3.x/README.html) [CircuitPython](https://circuitpython.readthedocs.io/en/6.3.x/README.html)
@@ -59,4 +63,4 @@ The easiest way to so is by using a jumper wire between those pins as seen bello
[USB Rubber Ducky playlist by **Hak5**](https://www.youtube.com/playlist?list=PLW5y1tjAOzI0YaJslcjcI4zKI366tMBYk) [USB Rubber Ducky playlist by **Hak5**](https://www.youtube.com/playlist?list=PLW5y1tjAOzI0YaJslcjcI4zKI366tMBYk)
[CircuitPython tutorial on the Raspberry Pi Pico by **DroneBot Workshop**](https://www.youtube.com/watch?v=07vG-_CcDG0) [CircuitPython tutorial on the Raspberry Pi Pico by **DroneBot Workshop**](https://www.youtube.com/watch?v=07vG-_CcDG0)

View File

@@ -1,8 +1,16 @@
import usb_hid import usb_hid
from adafruit_hid.keyboard import Keyboard from adafruit_hid.keyboard import Keyboard
from adafruit_hid.keyboard_layout_win_de_de import KeyboardLayout kblayout = "DE"
from adafruit_hid.keyboard_layout_win_de_de import KeyboardLayoutWinDeDe
from adafruit_hid.keycode import Keycode if kblayout == "DE":
from keyboard_layout_win_de import KeyboardLayout
from keycode_win_de import Keycode
elif kblayout == "BR":
from keyboard_layout_win_br import KeyboardLayout
from keycode_win_br import Keycode
else:
from adafruit_hid.keyboard_layout_us import KeyboardLayoutUS as KeyboardLayout
from adafruit_hid.keycode import Keycode
import time import time
import digitalio import digitalio
from board import * from board import *
@@ -60,7 +68,7 @@ def parseLine(line):
runScriptLine(newScriptLine) runScriptLine(newScriptLine)
kbd = Keyboard(usb_hid.devices) kbd = Keyboard(usb_hid.devices)
layout = KeyboardLayoutWinDeDe(kbd) layout = KeyboardLayout(kbd)
# sleep at the start to allow the device to be recognized by the host computer # sleep at the start to allow the device to be recognized by the host computer
time.sleep(.5) time.sleep(.5)

26
keyboard-layouts.md Normal file
View File

@@ -0,0 +1,26 @@
## How to install non-US keyboard layouts
Clone Circuitpython_Keyboard_Layouts
`git clone https://github.com/Neradoc/Circuitpython_Keyboard_Layouts`
`cd Circuitpython_Keyboard_Layouts`
Install dependencies
`pip3 install -r requirements-modules.txt`
Install build dependencies
`pip3 install -r requirements-dev.txt`
Build layouts
`python3 build.py`
Copy libraries to pico
`cp _build/circuitpython-keyboard-layouts-6.x-mpy-<date>/lib/*.mpy /<Pico mount point>/lib`
Update duckyinpython.py
Change
`kblayout="US"`
to
`kblayout="<keyboard layout>"`
Update `if kblayout ==` block to include the new keyboard layout if not already included