X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFET.py;h=8c5d945d645c958caaa6ab64babb4139e7ee8bc7;hp=4e42bc53cb3408e7e2228fc3428b4b695ad0d1b7;hb=670d14e88094aa5230087cacc420db1381711432;hpb=1733535635d911911b889d9096c282f4378af38b;ds=sidebyside diff --git a/client/GoodFET.py b/client/GoodFET.py index 4e42bc5..8c5d945 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -52,7 +52,7 @@ class GoodFETbtser: """py-bluez class for emulating py-serial.""" def __init__(self,btaddr): import bluetooth; - while btaddr==None or btaddr=="none" or btaddr=="bluetooth": + if btaddr==None or btaddr=="none" or btaddr=="bluetooth": print "performing inquiry..." nearby_devices = bluetooth.discover_devices(lookup_names = True) print "found %d devices" % len(nearby_devices) @@ -60,10 +60,11 @@ class GoodFETbtser: print " %s - '%s'" % (addr, name) if name=='FireFly-A6BD': btaddr=addr; + print "Please set $GOODFET to the address of your device."; + sys.exit(); print "Identified GoodFET at %s" % btaddr; - # BlueFET doesn't run the Service Discovery Protocol. - # Instead we manually use the portnumber. + # Manually use the portnumber. port=1; print "Connecting to %s on port %i." % (btaddr, port); @@ -83,10 +84,16 @@ class GoodFETbtser: def write(self,msg): """Send traffic.""" - return self.sock.send(msg); - def read(self,len): + import time; + self.sock.send(msg); + #time.sleep(0.1); + return; + def read(self,length): """Read traffic.""" - return self.sock.recv(len); + data=""; + while len(data)