Skip to content

Various usb gadget mode stuff for raspberry pi

Notifications You must be signed in to change notification settings

RichardFoo/usb-gadget

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

usb-gadget

Various usb gadget mode stuff for raspberry pi

aoeinit.bash

simple script to connect AoE device to g_mass_storage at bootup

usage: aoeint.sh </path/to/aoe/device>

Will load the g_mass_storage module if needed. Must be run as root

For full instructions see http://www.instructables.com/id/NAS-Access-for-Non-Networked-Devices/

set_id.py

Python script to set hostname and load the g_ether USB gadget module with fix MAC address. Both derived from the Pi's serial number.

While primarily aimed at the Pi zero and zeroW, the hostname functionality can be used with any Pi. USB gadget may be usable on Pi A and A+ but this has not been tested.

Requires dtoverlay=dwc2 in /boot/config.txt.

Run manualy or via root's crontab, /etc/rc.local, etc.

usage: set_id.py [-h] [-p PREFIX] [-r] [-d] [-l LOGFILE] [-H] [-U | -M | -E] [-t]

optional arguments:
  -h, --help            show this help message and exit
  -p PREFIX, --prefix PREFIX
                        hostname prefix. Ignored if -H specified. Defaults to
                        'PI-'
  -r, --reboot          reboot if hostname changed. Ignored if -t or -H
                        specified.
  -d, --debug           Enable debug output
  -l LOGFILE, --logfile LOGFILE
                        log file. This is only useful with -d
  -H, --nohostname      Don't change hostname
  -U, --nousb           Don't start USB gadgets.
  -M, --nomsg           Don't start USB mass storage gadget.
  -E, --noether         Don't start USB ethernet gadget.
  -t, --test            Display changes but do not perform them.

If /boot/hostnames exists, serial number will be matched with those preesent and the corresponding hostname will be used. The new hostname will not be generated from the prefix and serial number.

Serial numbers not found in this file will cause the new hostname to be automatically generated.

hostnames

Sample hostnames file for use with set_id.py

Lines starting with "#" are comments Leading zeros cay be omitted from serial numbers If a serial number appears more than once, only the first will be matched

There is no checking for duplicate hostnames. Use them at your own risk, doing so may complicate DNS lookups on your network.

Format:
serial_number        hostname

About

Various usb gadget mode stuff for raspberry pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.3%
  • Shell 3.7%