Let’s try not to get confused, but you can now use Raspberry Pi 400 keyboard PC as a standard USB keyboard, optionally with a mouse attached to it, for your computer, or twisted minds may even connect it to a Raspberry Pi SBC… “But why?” you may ask. Because we can.
That’s now possible thanks to work from Phil Howard (Gadgetoid), software lead of Pimoroni, and his Pi400kb project which implements a raw HID keyboard forwarder that turns the Raspberry Pi 400 into a standard USB keyboard.
- Add dtoverlay=dwc2 to /boot/config.txt in order to use the dwc2 USB device/gadget mode, and reboot your Pi 400
- Load the libcomposite kernel module, get pi400kb binary, and run the program as root:1234sudo modprobe libcompositewget https://github.com/Gadgetoid/pi400kb/blob/main/pi400kb?raw=truechmod +x pi400kbsudo ./pi400kb
- All good! Try typing on your Raspberry Pi 400 keyboard PC to this if that works
You could also connect a USB mouse to the Pi 400 to save on a USB port on your computer, as both HID events from the keyboard and mouse will be forwarded to the PC. Press Ctrl+C to exit the program
If you prefer to build pi400kb from source, you run the following commands in Pi 400 keyboard computer:
sudo apt install libconfig-dev
git clone https://github.com/Gadgetoid/pi400kb
git submodule update --init
It does not make a whole lot of sense to use a Raspberry Pi 400 as a USB keyboard, but it could still be useful as a stopgap. For example, if your keyboard stops working, you could always replace it with the Raspberry’s keyboard (PC) until you get a new proper keyboard.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.