summaryrefslogtreecommitdiff
path: root/Host
diff options
context:
space:
mode:
authorTC Wan2011-03-25 10:23:31 +0800
committerTC Wan2011-03-25 10:23:31 +0800
commitf20912eb58be089e1c6d1ec04f9d1d88fe5b8f11 (patch)
treeb109685f454fb4687faf349802c12fec8393f55a /Host
parent110b7562fef3ef9efe37c04dd9d86a34d4bdf53b (diff)
fixed blocking message exchange logic
Diffstat (limited to 'Host')
-rwxr-xr-xHost/nxt-gdb-server.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Host/nxt-gdb-server.py b/Host/nxt-gdb-server.py
index 4babdb9..ee03899 100755
--- a/Host/nxt-gdb-server.py
+++ b/Host/nxt-gdb-server.py
@@ -25,6 +25,7 @@ import struct
DEFAULT_PORT = 2828
SELECT_TIMEOUT = 0.1
DEBUG = True
+DEBUG2 = False
NXT_RECV_ERR = -1
# Libusb 0.12.x blocks on USB reads
@@ -152,12 +153,16 @@ class NXTGDBServer:
# Some pyusb are buggy, ignore some "errors".
if e.args != ('No error', ):
raise e
- if s and LIBUSB_RECEIVE_BLOCKING:
+ if segments != [] and LIBUSB_RECEIVE_BLOCKING:
+ if DEBUG2:
+ print "Accessing Blocking sock.recv()"
data = self.reassemble (brick.sock)
else:
client.close ()
client = None
if not LIBUSB_RECEIVE_BLOCKING:
+ if DEBUG2:
+ print "Accessing Non-Blocking sock.recv()"
data = self.reassemble (brick.sock)
# Is there something from NXT brick?