Using Raspberry Pi 400 keyboard PC as a USB keyboard for your PC

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.

Raspberry Pi 400 USB keyboardAll you need to do is to find a USB-C to USB-A cable to connect the Raspberry Pi 400 to one of the USB ports on your computer, change some Raspberry Pi OS configuration, and install and run pi400kb.

  1. Add dtoverlay=dwc2 to /boot/config.txt in order to use the dwc2 USB device/gadget mode, and reboot your Pi 400
  2. Load the libcomposite kernel module, get pi400kb binary, and run the program as root:
  3. 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:


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.

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK 5 ITX RK3588 mini-ITX motherboard

8 Replies to “Using Raspberry Pi 400 keyboard PC as a USB keyboard for your PC”

  1. This is something that devices like the Pinebook Pro are missing out on.
    Cheap laptop, with USB gadget capabilities, and enough CSI lanes to do decent video input. It would make a perfect crashcart-type device.
    As an alternative, a USB or network attached (USB powered) device that has video (HDMI and/orVGA) in and a USB UDC-capable device on board (like a Max3421E or some of the CH-family of chips) could also do the job.

    1. Indeed! The Odroid, Orange, Banana, and Pine folks typically can only clone the existing functionality already introduced by Raspberry Pi.

  2. It looks cool… but barrier is far easier to switch from rpi to pc and viceversa. And you dont need to compile anything… and for the user that critize pbp bc of this nonsense.. just use fucking barrier buddy, and stop crying, you have way better hw than a potato 4.

  3. Is the UK Government now paying otherwise productive citizens to stay home and not work like the US Government is here in the US? If yes, that explains why this useless idea was realized.

    1. It’s not useless at all. If you travel a lot, having a keyboard with you can be very helpful. Packing a Pi 400 instead of a portable USB keyboard, is not a terrible idea.

      The code does need some work, namely a GUI toggle or way to have a keyboard trigger. On the Wormhole Switch family of USB keyboard sharing dongles, you hit Control-S and can toggle between host and client at any time.

  4. It is a great start, but to be useful needs a couple of last mile features. It would be nice if a future revision allowed a hardware toggle on the keyboard, so when the OS loads, you could then use the switch on the keyboard to toggle between keyboard for host, and keyboard for client.

    As I mentioned downthread, Wormhole Switch does this via a USB dongle rather well already. You hit Ctrl-S and that sends a software toggle to the OS on the device, delegating control of the keyboard back and forth between host and client (you also can mouse between screens by moving to a designated edge – which transfers keyboard control).

  5. Yeah, my RPi400 is sitting forlorn, and the problem, so to speak, is that the less I use it, the less I use it. If I can use it as a daily driver for something, anything, than those little RPi projects, like I originally intended for it, will percolate because the darn thing will be in front of me. At least, that’s what I’m hoping for.
    Unfortunately my nephew grabbed the cute little mouse, and I’m wondering if he’s trying to send us a message about his gender orientation by decorating his PCs with literally fruity, effeminately-colored peripherals. Good for him, I guess, but completely alien to my generation’s experiences growing up. Maybe I’m old-fashioned, although I can’t be the only person to make this conceptual connection to the not-exactly-pink but red and white RiP400s.

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC