changes to communication and sweep methods
[goodfet] / client / goodfet.maxusbhost
1 #!/usr/bin/env python
2
3 #GoodFET MAXIM MAX3421 Host
4 #by Travis Goodspeed
5
6 import sys;
7 import binascii;
8 import array;
9 import time;
10
11 from GoodFETMAXUSB import GoodFETMAXUSBHost;
12
13 if(len(sys.argv)==1):
14     print "Usage: %s verb [objects]\n" % sys.argv[0];
15     print "%s info" % sys.argv[0];
16     print "%s allstrings" % sys.argv[0];
17     sys.exit();
18
19
20 #Initialize FET and set baud rate
21 client=GoodFETMAXUSBHost();
22 client.serInit()
23
24
25 client.MAXUSBsetup();
26
27 client.hostinit();
28
29 if(sys.argv[1]=="info"):
30     client.hostrun();
31
32 if(sys.argv[1]=="allstrings"):
33     print "This will try to print all strings from the target device.";
34     client.detect_device();
35     time.sleep(0.2);
36     client.enumerate_device();
37     for foo in range(1,255):
38         print "Grabbing string at index=%i" % foo;
39         string=client.getDescriptorString(foo);
40         if string!=None:
41             print "Strings[%i]=%s" % (foo,string);
42         sys.stdout.flush();