USB drive copier example project for the Adafruit 128x64 OLED Raspberry Pi bonnet, using a USB hub such as the Zero4U shield.
Uses the Adafruit OLED Bonnet Toolkit to implement an asynchronous UI for USB drive copying/formatting, controlled by the D-pad and A/B buttons.
The USB copier application, showing highlighted menus (arranged using the layout system).
On the build machine:
git clone https://github.com/lukehutch/Adafruit-OLED-Bonnet-Toolkit.gitcd Adafruit-OLED-Bonnet-Toolkit ; mvn install ; cd ..git clone https://github.com/lukehutch/usb-copier.gitcd usb-copier ; mvn package ; cd ..- Then copy
usb-copier/target/usb-copier-0.0.2-jar-with-dependencies.jarto/home/pion the Raspberry Pi.
On the Raspberry Pi:
- Run
raspi-configand enableInterfacing Options -> Advanced Options -> i2c apt-get install openjdk-11-jdk wiringpi pigpio nano udevilsudo nano /etc/cmdline.txt- add kernel option: (otherwise GPIO handler cannot access /dev/mem)
iomem=relaxed
- add kernel option: (otherwise GPIO handler cannot access /dev/mem)
sudo nano /etc/config.txt- add options:
dtparam=i2c_arm=ondtparam=i2c_baudrate=1000000
- add options:
- Extract libpi4j-pigpio.so to
/home/pi(this is needed due to a bug in the library loading code)cd ; unzip -j /path/to/usb-copier-0.0.2-jar-with-dependencies.jar lib/armhf/libpi4j-pigpio.so
- Add to /etc/rc.local :
sudo bash -c 'nohup java -Dpi4j.library.path=/home/pi -jar /home/pi/usb-copier-0.0.2-jar-with-dependencies.jar &'
(Some steps may need to be tweaked a little...)