From 2f6dc7ff6da98e249560706dd14a8cda9ad23e51 Mon Sep 17 00:00:00 2001 From: travisutk Date: Mon, 2 Apr 2012 00:09:19 +0000 Subject: [PATCH] More string functions for USB enumeration as a Host. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1129 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFETMAXUSB.py | 7 +++++-- client/goodfet.maxusbhost | 5 +++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/client/GoodFETMAXUSB.py b/client/GoodFETMAXUSB.py index 2559eb9..8f05d43 100644 --- a/client/GoodFETMAXUSB.py +++ b/client/GoodFETMAXUSB.py @@ -529,9 +529,12 @@ class GoodFETMAXUSBHost(GoodFETMAXUSB): if index==0: return "MISSING STRING"; - self.ctl_read(Get_Descriptor_String); + status=self.ctl_read(Get_Descriptor_String); + if status: return None; + + #Since we've got a string toret=""; - for c in self.xfrdata: + for c in self.xfrdata[2:len(self.xfrdata)]: if c>0: toret=toret+chr(c); return toret; diff --git a/client/goodfet.maxusbhost b/client/goodfet.maxusbhost index 4cfaece..074d931 100755 --- a/client/goodfet.maxusbhost +++ b/client/goodfet.maxusbhost @@ -34,8 +34,9 @@ if(sys.argv[1]=="allstrings"): client.detect_device(); time.sleep(0.2); client.enumerate_device(); - for foo in range(1,40): + for foo in range(1,255): print "Grabbing string at index=%i" % foo; string=client.getDescriptorString(foo); - print "Strings[%i]=%s" % (foo,string); + if string!=None: + print "Strings[%i]=%s" % (foo,string); sys.stdout.flush(); -- 2.20.1