Pi Zero as a universal USB stick
Connected
The default settings in /etc/raspi2go.conf
let the Pi Zero assume three roles: It advertises itself as a USB drive, USB Ethernet adapter, and serial USB adapter. Depending on the host settings, a Windows or Linux system then mounts the drive automatically.
It wouldn't make much sense to go through all this trouble for a normal USB stick, but functioning as a USB drive is ideal for installing drivers and application software. For example, Windows needs a suitable program to access the serial port, and it would be possible to provide Putty on the emulated drive of the Pi Zero. This procedure is familiar from commercial UMTS/LTE sticks: When first plugged in, they register as a CD drive with the driver software. After installing the driver, Windows then identifies the stick as a WiFi dongle.
Physically, the mass storage emulated by the Pi Zero is an image file. Do not access it simultaneously on the host and Raspberry Pi – it is not a network drive. However, the Pi Zero can also serve up this kind of drive by NFS or Samba, because it plays the role of an Ethernet adapter with two ends.
Mini-Network
A normal USB Ethernet adapter has a USB plug on one side and a socket for a network cable on the other. The wire usually leads to a router or switch but could also be plugged directly into another computer. The Pi Zero as a network gadget does exactly that – the only difference being that the cable only exists virtually and the computer on the other side is the Zero itself.
Windows and Linux detect the adapter as a network interface. For communication with the Pi Zero to work, both computers need to have addresses on the same subnet. The easiest way to do this is to use Zeroconf/Avahi. If the service is running on both sides, the participating computers negotiate the technical parameters independently; otherwise, manual configuration will do the trick. Simply assign both computers a fixed IP address in your address range.
Once configured, both devices form a mini-network, and you can launch servers (e.g., a storage or web server) on the Pi Zero and make them available to the host. The transfer rates are in the Fast Ethernet range; depending on the direction, iperf
indicates 80-120Mbps as throughput.
Consoles and More
In the third emulation, the Pi Zero pretends to be a serial interface. If the Raspberry Pi starts a virtual console on the port (the raspi2go.sh
script does this automatically), you can access the Raspberry Pi on the host with a terminal emulator (Putty on Windows; Screen or Tio on Linux), which is especially useful if the network configuration is not working correctly.
Another possible application is the simulation of sensor data (for sensors with a UART interface). In this case, a program on the Pi Zero simulates the data and sends it to the host over the serial interface. This scenario is ideal for software development because it not only makes it very easy to process data, but also avoid errors.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Endless OS 6 has Arrived
After more than a year since the last update, the latest release of Endless OS is now available for general usage.
-
Fedora Asahi 40 Remix Available for Macs with Apple Silicon
If you've been anticipating KDE's Plasma 6 for your Apple Silicon-powered Mac, then you're in luck.
-
Red Hat Adds New Deployment Option for Enterprise Linux Platforms
Red Hat has re-imagined enterprise Linux for an AI future with Image Mode.
-
OSJH and LPI Release 2024 Open Source Pros Job Survey Results
See what open source professionals look for in a new role.
-
Proton 9.0-1 Released to Improve Gaming with Steam
The latest release of Proton 9 adds several improvements and fixes an issue that has been problematic for Linux users.
-
So Long Neofetch and Thanks for the Info
Today is a day that every Linux user who enjoys bragging about their system(s) will mourn, as Neofetch has come to an end.
-
Ubuntu 24.04 Comes with a “Flaw"
If you're thinking you might want to upgrade from your current Ubuntu release to the latest, there's something you might want to consider before doing so.
-
Canonical Releases Ubuntu 24.04
After a brief pause because of the XZ vulnerability, Ubuntu 24.04 is now available for install.
-
Linux Servers Targeted by Akira Ransomware
A group of bad actors who have already extorted $42 million have their sights set on the Linux platform.
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.