Package: adfotg
ADF On-The-GoADF On-The-Go (adfotg)converts yourRaspberry Pi Zerointo an
USB drive with a web interface. It organises yourADFimages and
allows you to bundle one or more of them intovirtual USB drives.
You can swap, download, upload and mount ADFs without ever disconnecting
the USB cable from yourGotek, all from any modern web browser.ADF On-The-Go (adfotg)is a HTTP service designed for use in aRaspberry Pi Zero. The RPi must be connected through its USB OTG
port to aGotekFloppy Drive emulator in anAmigacomputer.
ADF On-The-Go can prepare ADF images from files, split big files into
floppy-sized chunks, or just mount the ADF images directly. It allows to
store bundles of ADF files on their own virtual USB drives and swap
multiple virtual USB drives freely. All of this is controlled through a
website interface, by default hosted on a HTTP port41364.There also is a REST API, if you happen to not like the default UI, but
its current status isunstable.----------- Linux ------------  USB  --------- IDE ---------
  | ADF OTG |------>| RPi Zero |------>| Gotek |---->| Amiga |
  -----------       ------------ no+5V ---------     ---------!!! HARDWARE DAMAGE RISK !!!CUT OR BLOCK THE +5V LINE IN THE USB CABLE!This line connects the voltage from the Raspberry Pi to Gotek and powers
up your Gotek and your Amiga. This isundesirable. When Amiga PSU is
OFF, the Amiga will be put in a strange half-state with LEDs lighting up,
but the computer remaining off. The RPi will also reboot. When Amiga PSU
is ON, the +5V USB line will prevent the Amiga's Power LED from dimming
when Amiga reboots.FOR SAFETY MEASURES, CUT OR BLOCK THE +5V LINE!SecurityThis is important!There's no network security provided by the app itself!It doesn't even put a basic HTTP authentication in place. When you host it
on your device, keep it in a private network without remote access.This software requires'root' privilegesto perform certain
operations. While the application will run as a normal user, it will abusesudoto obtain root privileges when needed. Ensure your RPi user cansudowithout password prompt.RequirementsAdfotg supports Raspberry Pi OS 12 (bookworm) since version 0.4.0.Software:Raspberry Pi OS 12 (bookworm) or newerPython 3, pipxmtoolsHardware:Raspberry Pi ZeroGotekAn AmigaOS:sudoprivileges will be requiredPreparing your Raspberry PiThis is mandatory.We need to make sure we are using the dwc2 USB driver,
and thatdwc2andg_mass_storagemodules are enabled.If you have a fresh Raspberry Pi OS, it's enough to do:echo dtoverlay=dwc2 | sudo tee -a /boot/config.txt
  echo dwc2 | sudo tee -a /etc/modules
  echo g_mass_storage | sudo tee -a /etc/modules`Then reboot your RPi.The above is based onhttps://gist.github.com/gbaman/50b6cca61dd1c3f88f41In case of trouble with connecting to Gotek, you may try to
diagnose the USB problems by connecting the RPi to an USB socket
in a PC. When an USB drive image is mounted, the PC should see
the RPi as an USB drive.InstallThis program is designed to be run on aRaspberry Pi Zerowith theRaspberry Pi OS. Installing the release package on anything else is not
recommended, although will succeed and should be harmless (no warranty).On your Raspberry Pi:sudo apt update && sudo apt install mtools pipx
  sudo PIPX_HOME=/opt/adfotg PIPX_BIN_DIR=/usr/local/bin pipx install adfotgThe first time installation may be lengthy (it's only aZero, after all).Integrating with Raspberry Pi OSAfterpipx install adfotgis done, run:sudo adfotg --installThis will:Add 'adfotg' system user to Raspberry Pi OS and allow this user a
password-less sudo privilege.Create adfotg's default config file in/etc/adfotg.conf.Create adfotg's base directory at/var/lib/adfotg.Addadfotg.serviceto systemd; adfotg will start with the system.UpdateMake sure you do this logged in as the same OS user that you
used during the installation.sudo PIPX_HOME=/opt/adfotg PIPX_BIN_DIR=/usr/local/bin pipx upgrade adfotgAdfotg needs to be restarted now. If you integrated it with yourRaspberry Pi OS(see the section below), then it's sufficient to
do this:sudo systemctl restart adfotgUninstallAdfotg needs to be uninstalled manually and this is even more involved
than installing. Depending on how far you've went with installation and
what you wish to keep, you may be skipping some steps.First of all, stop the service:sudo systemctl stop adfotgIf you wish to uninstall, and then install adfotg again, do:sudo PIPX_HOME=/opt/adfotg PIPX_BIN_DIR=/usr/local/bin pipx uninstall adfotgThis will keep the internal Python setup, your config and your ADF/USB library.
Then proceed as if installing for the first time.To remove the internal Python setup, do:sudo rm -rf /opt/adfotgTo uninstall from systemd and to remove the adfotg OS user:sudo rm /usr/local/lib/systemd/system/adfotg.service
  sudo systemctl daemon-reload
  sudo deluser adfotgTo remove the config:sudo rm /etc/adfotg.confTo remove your ADF and USB images library:sudo rm -rf /var/lib/adfotgDevelopmentPlease seeCONTRIBUTING.md.TroubleshootingProblem:Gotek perpetually displays---when connected to RPi,
even though it works with my usual USB drive.Solution:---indicates that you have Cortex firmware installed on
your Gotek. See if you haveSELECTOR.ADFon your USB drive. If yes,
this ADF must also be placed on every mount image you create in adfotg.Problem:I upgraded to a new version, but there are oddities
happening or I don't see any changes.Solution:There may be two reasons for this. Your browser might've
cached the old version of the site or the adfotg service wasn't
restarted. See the "Update" section in README to learn how to restart
the service and clear your browser cache.Problem:This software ceases to work after the system upgrade.Solution:Sorry, both Raspberry Pi OS and the Python rules for
software distribution and installation tend to change. Reinstalling
adfotg from scratch may help. Other than that, contact me for more
help.BackgroundGotekis a hardware floppy-drive replacement for
legacy machines. Instead of using failure-prone floppy disks, it allows
to use a USB flash drive with floppy-disk images. Multiple images can
be stored on a single flash drive and Gotek allows by default to choose
between them through buttons located on the case. While Gotek is an
excellent device that eradicates the inconvenience of floppy disks,
it not only doesn't solve the inconvenience of disk swapping but makes
it worse by replacing labeled floppy-disks with incomprehensible
ordinal numbers (from 0 to 999).Raspberry Pi Zerois a cheap mini-computer
that can run Linux. It has two major features that are in use in this project:WiFiUSB On-The-GoWhile WiFi (or any Ethernet connection) is used here as the access layer
to the ADF On-The-Go software, USB On-The-Go is the real enabler. While
it has many applications, we are only interested in one. It allows to
make the RPi appear to be an USB flash drive - a flash drive which
contents we can fully control and change on-the-fly using Linux command
line tools and which we can program to serve the content we want.Guide for setting up OTG mode on Raspberry Pi can be found here:https://gist.github.com/gbaman/50b6cca61dd1c3f88f41amitoolscontains xdftool,
with which adfotg is capable of manipulating ADF image files to
some extent. Adfotg doesn't depend on amitools, but incorporates
a subset of its source code and installsadfotg-xdftoolas a separate
tool.REST APIREST API documentation is currently a Work-In-Progress.
adfotg is capable of providing the documentation for itself
in a plain-text format through the/helpendpoint.