From fbc22932fac67518ca57445e5d028c77ae3104e9 Mon Sep 17 00:00:00 2001 From: Scott Petersen Date: Mon, 10 Jun 2013 10:21:36 -0700 Subject: [PATCH] Firmware upload needs totally reworked but this helps a bit for now. --- pyad2usb/util.py | 6 ++++-- test.py | 7 ++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pyad2usb/util.py b/pyad2usb/util.py index 893bcae..1eafbaf 100644 --- a/pyad2usb/util.py +++ b/pyad2usb/util.py @@ -77,7 +77,7 @@ class Firmware(object): if progress_callback is not None: progress_callback(Firmware.STAGE_UPLOADING) - time.sleep(0.05) + time.sleep(0.0) def read_until(pattern, timeout=0.0): """ @@ -134,10 +134,12 @@ class Firmware(object): stage_callback(Firmware.STAGE_WAITING) time.sleep(1) + time.sleep(1) + # Reboot the device and wait for the boot loader. stage_callback(Firmware.STAGE_BOOT) dev.write("=") - read_until('!boot', timeout=15.0) + read_until('......', timeout=15.0) # Get ourselves into the boot loader and wait for indication # that it's ready for the firmware upload. diff --git a/test.py b/test.py index 038cbeb..8010122 100755 --- a/test.py +++ b/test.py @@ -75,14 +75,15 @@ def upload_usb(): dev = pyad2usb.ad2usb.devices.USBDevice() dev.open(no_reader_thread=True) - pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu_V2_2a_6.hex', handle_firmware) + #pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu_V2_2a_6.hex', handle_firmware) dev.close() def upload_serial(): - dev = pyad2usb.ad2usb.devices.SerialDevice(interface='/dev/ttyUSB2') + dev = pyad2usb.ad2usb.devices.SerialDevice(interface='/dev/ttyUSB0') - dev.open() + dev.open(no_reader_thread=True) pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu_V2_2a_6.hex', handle_firmware) + #pyad2usb.ad2usb.util.Firmware.upload(dev, 'tmp/ademcoemu-V2-2a-5-beta20-C4.hex', handle_firmware) dev.close() def upload_usb_serial():