Lacking a usb device proxy (usbip as of Feb 2016 does not appear to be very portable) another method is to install
avrdude on the Arduino-connected system (REMOTE). If this is possible, then the Arduino IDE running system (CLIENT) can be instructed to call a program that connects to
avrdude on REMOTE. Downsides: requires fiddling around in the Arduino IDE configuration files, probably fragile, will require additional work to support things like
arduinoOTA and so on...
CLIENT (Arduino IDE) -> ssh -> REMOTE (avrdude) -> usb -> arduino
The Arduino IDE should contain
platform.txt configuration files (located for example under
Arduino.app/Contents/Java/hardware/arduino/avr on the mac version). What we need in these files is a new programmer that will make a connection to REMOTE and pass along the data to upload, and then on REMOTE to issue the actual
avrdude programmer command using the data passed from the CLIENT system.
Java/hardware/arduino/avr/programmers.txt add something like
More complicatedly, in
Java/hardware/arduino/avr/platform.txt duplicate all the
tools.avrdude. containing lines and adjust these to instead be named
tools.avrrelay. and where necessary instead call
avrrelay-client (most of these lines are not necessary but it's probably easier to sub all of them than to figure out which are necessary):
... many more of these not shown, e.g. the verbose one ...
Then in the
Java/hardware/tools/avr/bin directory (which should be identical to the
runtime.tools.avrdude.path config option) create
avrrelay-client and make it executable:
# send the only argument (which should be the *.hex file) to avrrelay-remote
# this will need to use public key auth, or expect to automatically fill
# in any password promptes
ssh theremotehost avrrelay-remote < "$1"
The Arduino IDE has a preference option to show verbose output during the upload, which will reveal the command that is run.
-v -patmega328p -cstk500v2 -Pusb \
This command can be copied and adapted for the code on REMOTE, though
avrdude(1) indicates that a filename must be specified, so the copied data will need to be placed in a tmp file, and that fed to
avrdude; this is the
avrrelay-remote program called by the CLIENT; it will need to be
chmod +x and called by full path or located in a SSH-available
FLASH=`mktemp /tmp/avrrelay.XXXXXXXXXX` || exit 1
# assume data passed via standard input
cat > "$FLASH"
# these flags will vary depending on programmer, etc
avrdude -C /path/to/avrdude.conf -v -patmega328p -cstk500v2 -Pusb \
In theory, restart the Arduino IDE and try using the new "AVR RELAY" programmer. Use your mad debugging skills to figure out where it breaks down, repeat.
remote serial monitor
For the serial monitor to work remotely, a likely option would be to forward that via
Unbuffered socat command to connect serial ports in remote machines and log the data