The Raspberry Pi Zero can be used as an USB device, like a keyboard. One usecase could be: automation.

USB Gadgets

The Raspberry Pi Zero can be turned in a series of USB devices: a mouse, an external GPIO expander, a serial port, an Ethernet device, a MIDI audio device, and so on.

If you search on the web, you can find a bunch of information, like here https://www.isticktoit.net/?p=1383 and here https://learn.adafruit.com/turning-your-raspberry-pi-zero-into-a-usb-gadget/

Testing Fedora release candidates

A lot of validation testing in Fedora is automated.

It is still highly useful to download a candidate compose ISO, burn it on an USB stick and install the system on a bare metal (laptop/desktop) machine.

Obviously this is a lot of manual and repetitive work, especially when we are around the beta and final release.

As said, a lot of validation testing in Fedora is automated, but it is performed inside virtual machines. However, openQA does actually have the capacity to run tests in other environments. But it is a lot of effort for a simple user that want to perform a test.

So, what about automating the keyboard strokes?

The handcraft automated keyboard

RaspberryPiZero

Searching the web you can find many tutorials talking about how to turn a Raspberry Pi Zero into a USB Keyboard (HID), like this one: https://randomnerdtutorials.com/raspberry-pi-zero-usb-keyboard-hid/

The idea was to build a Python script, like the one in the last link, but I found that it doesn’t perform very well (uppercase strokes appears like lowercase, I didn’t find a way to hit the Super key, missed keystrokes), so I pivoted to a series of bash scripts invoking this program https://github.com/aagallag/hid_gadget_test

Still a bit of manual work (mainly in order to write down the initial keystrokes sequence and timing), but even a home user without too many knowledge about testing automation, programming languages and so on, can still play the game.

So the process is roughly this: you connect the Raspberry Pi Zero to the machine you want to install, you boot the USB stick with the release candidate, you connect via SSH to the RPi e you launch the script.

Example script

This is only an example (an excerpt).

This one configure the network with a static address.

#!/bin/bash

function press {
    echo "$1" | ./hid_gadget_test /dev/hidg0 keyboard
    sleep 0.1
}

press "--left-meta"
sleep 1
press "n e t "
press "--left-meta"
sleep 1
press "--left-meta"
sleep 1
press "n e t "
sleep 1
press "--down"
sleep 1
press "--enter"
sleep 2
press "--tab"
press "--tab"
press "--space"
press "--right"
press "--tab"
press "--down"
press "--tab"
press "--tab"

press "1 0 period "
press "1 0 period "
press "0 period "
press "1 5 "
press "--tab"
press "2 4 "
press "--tab"
press "1 0 period "
press "1 0 period "
press "0 period "
press "1 "

press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "space "
press "--tab"

press "1 0 period "
press "1 0 period "
press "0 period "
press "2 "
press "comma "
press "1 0 period "
press "1 0 period "
press "0 period "
press "3 "

sleep 0.5
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--tab"
press "--right"
press "--tab"
press "--down"
press "--down"
sleep 0.5
press "--enter"
sleep 0.5

press "--left-ctrl q "

press "--left-alt --tab "