summaryrefslogtreecommitdiffstats
path: root/dfu.py
diff options
context:
space:
mode:
Diffstat (limited to 'dfu.py')
-rwxr-xr-x[-rw-r--r--]dfu.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/dfu.py b/dfu.py
index 2c422ad..69532c4 100644..100755
--- a/dfu.py
+++ b/dfu.py
@@ -2,6 +2,7 @@
import os
import pexpect
+import sys
import optparse
import time
from intelhex import IntelHex
@@ -49,6 +50,7 @@ class BleDfuUploader(object):
def __init__(self, target_mac, hexfile_path):
self.hexfile_path = hexfile_path
self.ble_conn = pexpect.spawn("gatttool -b '%s' -t random --interactive" % target_mac)
+ self.ble_conn.logfile = sys.stdout
# Connect to peer device.
def scan_and_connect(self):
@@ -60,7 +62,8 @@ class BleDfuUploader(object):
self.ble_conn.sendline('connect')
try:
- res = self.ble_conn.expect('\[CON\].*>', timeout=10)
+ #res = self.ble_conn.expect('\[CON\].*>', timeout=10)
+ res = self.ble_conn.expect('Connection successful', timeout=10)
except pexpect.TIMEOUT, e:
print "timeout"
@@ -189,4 +192,4 @@ if __name__ == '__main__':
time.sleep(1)
# Disconnect from peer device if not done already and clean up.
- ble_dfu.disconnect() \ No newline at end of file
+ ble_dfu.disconnect()