Jeff Epler's blog2020-09-07T14:31:40ZPhotos, electronics, cnc, and moreJeff Eplerjepler@unpythonic.netPi Zero W USB Proxy2020-09-07T14:31:40Z2020-09-07T14:31:40Zhttps://emergent.unpythonic.net/01599489100
<img src="https://media.unpythonic.net/emergent-files/01599489100/IMG_20200907_093946.jpg">
<p>I'm not sure exactly what to call it, but here's a little something I set
up this weekend.
<p>On my Linux desktop, I have occasional problems where being stopped at the
debugger prompt for a plugged-in USB device hoses the whole computer.
The problem waxes and wanes but on a particularly frustrating day
I decided that maybe a Pi was the answer to the problem.
<p>Using screen I can access the USB-serial devices on the pi, and using sshfs
I can access the files. If the whole pi freezes, I can just reboot it
with essentially no harm done.
<p>I selected a Pi Zero W with a Zero4U hub and Adafruit MiniPiTFT 1.14" attached.
To a base raspbian lite system I added some software, including tio, udiskie,
screen, and Adafruit Blinka; enabled ssh access and disk mounting by the pi
user, and set up GNU screen and my custom script for the LCD which is
(confusingly) also called screen.
<p>The screen shows information about each of the 4 USB connectors.
In brackets "S" is shown if there is a serial device; "D" is shown if there's a partitioned disk, "d" if there's an unpartitioned disk; and "M" is shown if it is mounted. After that, the device name is shown.
<p>Automount can be toggled with the B button (silk screen 23) and any non-mounted disks can be mounted with the A button (silk screen 24)
<p>So far I've only used it lightly, but if it prevents a single crash of my
desktop, it will be worth it.
<p>This isn't a detailed guide so a lot of the setup is omitted. However, here are the scripts that are the essential parts:
<p><script src="https://gist.github.com/jepler/ee50fca98455f26379e5e0ab24ce6ed4.js"></script>
<p><script src="https://gist.github.com/jepler/ae71dffd3aeb4cb6a11a12e8773ee373.js"></script>