Raw HID keyboard forwarder to turn the Pi 400 into a USB keyboard

Overview

Raspberry Pi 400 as a USB HID Keyboard

Hook your Pi 400 up to your PC somehow, using a USB Type-C cable into the power port. Anker make good ones- I used a 3m white one for my tests.

Our USB-C to USB-A is great if you're using a USB-A port (but make sure it's a high power one): https://shop.pimoroni.com/products/usb-c-to-usb-a-cable-1m-black

This project started out life as a gist - https://gist.github.com/Gadgetoid/5a8ceb714de8e630059d30612503653f

Thank you to all the people who dropped by with kind words, suggestions and improvements.

Quickstart (Ish)

Add dtoverlay=dwc2 to /boot/config.txt

Reboot!

sudo modprobe libcomposite

wget https://github.com/Gadgetoid/pi400kb/blob/main/pi400kb?raw=true

chmod +x pi400kb

sudo ./pi400kb

YOUR PI 400 IS NOW A FREAKING KEYBOARD FOR YOUR PC WHAAAAT!?

Your keyboard input will be detached from your Pi while it's forwarded to your host computer.

Press Ctrl + Raspberry to exit and restore your keyboard on the Pi.

Building & Contributing

Building

sudo apt install libconfig-dev
git clone https://github.com/Gadgetoid/pi400kb
cd pi400kb
git submodule update --init
mkdir build
cd build
cmake ..
make
Issues
  • Error on run: usbg_init() no such file or directory.

    Error on run: usbg_init() no such file or directory.

    Happens on both mouse connected and disconnected.

    The full message I got:

    Found keyboard at: /dev/hidraw0
    Failed to open mouse device
    usbg_init()  No such file or directory: couldn't init gadget state
     
    Error on usbg init
    Error: USBG_ERROR_NOT_FOUND : Not found (file or directory removed)
    
    opened by ArsenicBismuth 2
  • fix compile warning

    fix compile warning

    This fixes the following compile warning:

    pi400kb/pi400.c: In function ‘modprobe_libcomposite’:                                                                                                                                         
    pi400kb/pi400.c:82:37: warning: passing argument 2 of ‘execv’ from incompatible pointer type [-Wincompatible-pointer-types]                                                                   
       82 |         execv("/usr/sbin/modprobe", argv);                                                                                                                                            
          |                                     ^~~~                                                                                                                                              
          |                                     |                                                                                                                                                 
          |                                     const char **                                                                                                                                     
    In file included from pi400kb/pi400.c:14:                                                                                                                                                     
    /usr/include/unistd.h:563:51: note: expected ‘char * const*’ but argument is of type ‘const char **’                                                                                          
      563 | extern int execv (const char *__path, char *const __argv[])                                                                                                                           
          |                                       ~~~~~~~~~~~~^~~~~~~~                                                                                                                            
    
    opened by DeeNewcum 1
  • Thanks, I can now type with pi 400 on my Ipad while ssh/vnc-ing to it

    Thanks, I can now type with pi 400 on my Ipad while ssh/vnc-ing to it

    Hi @Gadgetoid, really appreciate you made this, you pointed me to learning about libusbgx. I added ECM so that i could ssh/vnc to the PI 400 so that it's not just a "dumb" keyboard while not relying on known WIFI either. With ipad pro it's wickedly nifty and geeky ;)

    Having portable access to full linux and arm with GPIO while also act as portable keyboard for Ipad.....priceless

    Cheers

    opened by ahasani 1
  • Toggle hook

    Toggle hook

    Use -DHOOK_PATH with cmake to define a path to a .sh script (or binary) to run on grab/ungrab.

    See hook.sh for details. "Grab" calls the script with a 1, "Ungrab" calls it with a 0.

    opened by Gadgetoid 0
  • The raw file returns a 404 error

    The raw file returns a 404 error

    Hi there,

    When trying to install yesterday I got a 404 error at the wget point. With or without sudo before the command. Is the link offline? Is there another link?

    2022-02-16-153452_1360x768_scrot

    opened by arm-ARMY 3
  • Is it okay to implement keystroke record / playback?

    Is it okay to implement keystroke record / playback?

    It would be nice to have complex macros like the QMK / ZMK keyboard firmware, but I'm not ready to implement that. But I'm definitely interested in keystroke recording/playback, as a primitive macro system. Would that be welcomed as part of this project?

    opened by DeeNewcum 7
  • improve error handling

    improve error handling

    This adds two new errors:

    • "Error: ./pi400 must be run as root"
    • "Error: This must be added to /boot/config.txt and the system rebooted: dtoverlay=dwc2"

    Without this error-checking, the beginner user gets some strange errors that don't really correspond to what they need to fix to proceed.

    opened by DeeNewcum 3
  • Q: possible to use with USB Type A?

    Q: possible to use with USB Type A?

    Nice work guys! Is it possible to use Pi400 as keyboard using USB Type A, keeping the Type C connected to power supply? It would be perfect for my needs

    opened by GianlucaPaolocci 1
Releases(v0.0.1)
  • v0.0.1(Feb 4, 2022)

    This is the very first release, in order to move the binary out of the repository and provide 32bit/64bit versions- in theory.

    64bit TBC!

    If you find this useful I'd appreciate a dollar or two - https://patreon.com/gadgetoid

    What's Changed

    • Add basic build by @Gadgetoid in https://github.com/Gadgetoid/pi400kb/pull/3
    • Mouse support for #1 by @Gadgetoid in https://github.com/Gadgetoid/pi400kb/pull/2
    • use poll() to avoid 100% CPU load by @normen in https://github.com/Gadgetoid/pi400kb/pull/14
    • Toggle hook by @Gadgetoid in https://github.com/Gadgetoid/pi400kb/pull/9
    • fix compile warning by @DeeNewcum in https://github.com/Gadgetoid/pi400kb/pull/22
    • Prep for attached release files by @Gadgetoid in https://github.com/Gadgetoid/pi400kb/pull/23

    New Contributors

    • @Gadgetoid made their first contribution in https://github.com/Gadgetoid/pi400kb/pull/3
    • @normen made their first contribution in https://github.com/Gadgetoid/pi400kb/pull/14
    • @DeeNewcum made their first contribution in https://github.com/Gadgetoid/pi400kb/pull/22

    Full Changelog: https://github.com/Gadgetoid/pi400kb/commits/v0.0.1

    Source code(tar.gz)
    Source code(zip)
    pi400kb-v0.0.1-32bit-armv7l.zip(35.18 KB)
Owner
Philip Howard
Philip Howard
ESP8266 software USB host through general IO pins. We can connect up to 2 USB-LS HID (keyboard mouse joystick) devices simultaneously.

esp8266_usb_soft_host Test for esp8266 usb host . Works with ESP-IDF v3.4 80MHz and 160MHz. WorkInProgress Test run with mouse & combined mouse & keyb

Samsonov Dima 25 Apr 21, 2022
C/C++ Application to solve irrigation rotation whatever two-turn rotation or three-turn rotation, longitudinal section design, hydraulic calculations, and design of hydraulic structures like weirs and tail escape.

Irrigation works C/C++ Application to solve irrigation rotation whatever two-turn rotation or three-turn rotation, longitudinal section design, hydrau

Mohamed Jamal Ghayyad 1 Jun 24, 2022
esp32S2 USB HID host example.

Simple usb host HID example Since usb host support is still beta stage and include file is in private_include i copied component to this example. Code

null 14 Jun 11, 2022
IR2USB - IR to USB HID Converter based on ATtiny45/85

IR2USB - IR to USB HID Converter based on ATtiny45/85 IR2USB receives signals from an infrared remote control and converts them into keyboard inputs,

Stefan Wagner 11 Jun 24, 2022
A USB proxy based on raw-gadget and libusb

usb-proxy This software is a USB proxy based on raw-gadget and libusb. It is recommended to run this repo on a computer that has an USB OTG port, such

Aristo Chen 22 Jun 14, 2022
Turn 2 esp32 boards into pixhawk telemetry for use with Ardupilot/Ardurover Mission Planner.

RoverLink Turn 2 esp32 boards into pixhawk telemetry for use with Ardupilot/Ardurover Mission Planner I used to use these cheap Chinese 900mhz Pixhawk

Jeffrey Berezin 2 Jan 18, 2022
Turn images into text better than caca/aalib

hiptext hiptext is command line tool for rendering images and videos inside terminals. Dependencies You need clang or gcc >=4.7. You also need to inst

Justine Tunney 661 Jun 28, 2022
Turn your ESP32 into a easy to use micro web-server allowing to interact with any GPIO by simple http(s) calls.

WebhooksTriggeredESP32WiFi Turn your ESP32 into an easy to use and manage wireless micro web-server allowing it to process reliably and asynchronouly

JayDeLux 4 Jun 1, 2022
Use Atari keyboard as USB keyboard with a Teensy 3.6

Atari Keyboard Convert an Atari 600/800/1200 XL into a USB keyboard. I bricked my Atari mainboard. My goal is to use the keyboard of the Atari on a Ra

Jos Koenis 2 Dec 3, 2021
Tiny and portable usb host and device stack for mcu with usb ip

Tiny and portable usb host and device stack for mcu with usb ip

sakumisu 364 Jun 28, 2022
USB-C_PCB_experiments - USB-C ports made from a flex PCB and an ATtiny84A

USB-C PCB Experiments This is part of an ongoing series of projects involving creative interpretations of the USB mechanical standards. You've probabl

Sam Ettinger 22 May 21, 2022
Anotter USB temperature logger that can record up to four channels with thermocouple or NTCs connected via CDC directly or SCPI to USB.

temperature-logger Anotter USB temperature logger that can record up to four channels with thermocouple or NTCs connected via CDC directly or SCPI to

Jana Marie Hemsing 47 Apr 6, 2022
Ramp is a HID attack program that steals all connected WiFi passwords within 13 seconds.

Ramp Ramp is a HID attack program that steals all connected WiFi passwords within 13 seconds. Tested Windows 10 Warning Ramp has been created for the

Md. Ridwanul Islam Muntakim 18 Jun 10, 2022
To turn on and off the pump, most people use a manual switch.

To turn on and off the pump, most people use a manual switch. As a result, people forget to switch off the pump from time to time, resulting in water overflow. They may forget to switch on the motor at times, resulting in a water problem later on. It also wastes a lot of electricity. To solve this problem, we need a smart device to control the pump.

Md. Asad Chowdhury Dipu 1 Oct 14, 2021
ESP32S2 Arduino USB host printer, MIDI, and keyboard demos

ESP32 S2 USB Host Jumpstart A collection of experiments and demos using Espressif ESP32 S2 in USB host mode. Most of the sketches have little or no C+

null 14 Jun 17, 2022
USB2Sun - USB keyboard/mouse to Sun Converter

USB2Sun While I've found many projects for connecting the Sun serial based keyboards to a modern machine via USB, I've never found anything to connect

Joakim L. Gilje 5 May 27, 2022
A fully-functional open source and open hardware mechanical USB computer keyboard with only three keys!

threeboard threeboard is a fully-functional open source and open hardware mechanical USB computer keyboard with only three keys. It supports multiple

Conor Taylor 97 May 23, 2022
Basic definitions and utility functions for GNSS raw measurement processing

gnss_comm Authors/Maintainers: CAO Shaozu (shaozu.cao AT gmail.com) The gnss_comm package contains basic definitions and utility functions for GNSS ra

HKUST Aerial Robotics Group 54 May 24, 2022
A dataset containing synchronized visual, inertial and GNSS raw measurements.

GVINS-Dataset Author/Maintainer: CAO Shaozu (shaozu.cao AT gmail.com), LU Xiuyuan (xluaj AT connect.ust.hk) This repository hosts dataset collected du

HKUST Aerial Robotics Group 100 Jun 18, 2022