summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTat-Chee Wan (USM)2011-05-05 14:52:33 +0800
committerTat-Chee Wan (USM)2011-05-05 14:52:33 +0800
commit641c5640b1fb937fb8a6afdc337c9b5c85848df3 (patch)
tree924e536ea8dd2074ad64fd1cd6a4b46ee372bb3e
parentb8c8045ffdff1e0d5337398563ed6b86d3661040 (diff)
cleaned up debugging output
-rw-r--r--nxt-python-fantom/nxt/fantomglue.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/nxt-python-fantom/nxt/fantomglue.py b/nxt-python-fantom/nxt/fantomglue.py
index 16d9608..c1c9fde 100644
--- a/nxt-python-fantom/nxt/fantomglue.py
+++ b/nxt-python-fantom/nxt/fantomglue.py
@@ -112,7 +112,7 @@ class USBSocket:
# FIXME: The addr is not passed in, so we can't actually create a NXT object later
#self.device = device
self._sock = device
- self.debug = False
+ self.debug = True
def __str__(self):
return 'FantomGlue USB (%s)' % self.device_name()
@@ -152,9 +152,11 @@ class USBSocket:
"""Destroy interface."""
if self._sock is not None:
del self._sock
- print "NXT object deleted"
+ if self.debug:
+ print "NXT object deleted"
else:
- print "No NXT Object when calling __del__ for USBSocket"
+ if self.debug:
+ print "No NXT Object when calling __del__ for USBSocket"
if __name__ == '__main__':
#get_info = False
@@ -168,6 +170,7 @@ if __name__ == '__main__':
print " resource string:", rs
if write_read:
nxt = USBSocket(i)
+ nxt.connect()
import struct
# Write VERSION SYS_CMD.
# Query:
@@ -198,4 +201,5 @@ if __name__ == '__main__':
#rep = nxt.recv(USB_BUFSIZE)
#rep = nxt.recv(7)
#print "read", struct.unpack('%dB' % len(rep), rep)
+ #nxt.close()
del nxt