|
|
@@ -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) |
|
|
|