Browse Source

Added support for uploading to a networked ad2usb in ad2-firmwareupload.

pyserial_fix
Scott Petersen 10 years ago
parent
commit
e9de0ff73b
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      bin/ad2-firmwareupload

+ 8
- 3
bin/ad2-firmwareupload View File

@@ -37,7 +37,7 @@ def main():
baudrate = 115200

if len(sys.argv) < 2:
print "Syntax: {0} <firmware> [interface] [baudrate]".format(sys.argv[0])
print "Syntax: {0} <firmware> [device path or hostname:port] [baudrate]".format(sys.argv[0])
sys.exit(1)

firmware = sys.argv[1]
@@ -49,8 +49,13 @@ def main():

print "Flashing device: {0} - {2} baud\r\nFirmware: {1}".format(device, firmware, baudrate)

dev = alarmdecoder.devices.SerialDevice(interface=device)
dev.open(baudrate=baudrate, no_reader_thread=True)
if ':' in device:
hostname, port = device.split(':')
dev = alarmdecoder.devices.SocketDevice(interface=(hostname, int(port)))
dev.open()
else:
dev = alarmdecoder.devices.SerialDevice(interface=device)
dev.open(baudrate=baudrate, no_reader_thread=True)

time.sleep(3)
alarmdecoder.util.Firmware.upload(dev, firmware, handle_firmware)


Loading…
Cancel
Save