X-Git-Url: http://git.rot13.org/?p=goodfet;a=blobdiff_plain;f=client%2FGoodFETMAXUSB.py;h=65844d79da9b3def59753657aed77123827e9c72;hp=6085e709cf45aae05f60141dc2669422085434dc;hb=3ce193dd33e5e9e4c16989d85b8fb15715b139de;hpb=f68574d90bd2edf5147e8b0fb2fe1d1c1591115a diff --git a/client/GoodFETMAXUSB.py b/client/GoodFETMAXUSB.py index 6085e70..65844d7 100644 --- a/client/GoodFETMAXUSB.py +++ b/client/GoodFETMAXUSB.py @@ -260,6 +260,16 @@ class GoodFETMAXUSB(GoodFET): ashex=ashex+(" %02x"%ord(foo)); print "GET %02x==%s" % (reg,ashex); return toret; + def readbytesAS(self,reg,length): + """Peek some bytes from a register, acking prior transfer.""" + data=[(reg<<3)|1]+range(0,length); + self.writecmd(self.MAXUSBAPP,0x00,len(data),data); + toret=self.data[1:len(self.data)]; + ashex=""; + for foo in toret: + ashex=ashex+(" %02x"%ord(foo)); + print "GET %02x==%s" % (reg,ashex); + return toret; def ctl_write_nd(self,request): """Control Write with no data stage. Assumes PERADDR is set and the SUDFIFO contains the 8 setup bytes. Returns with @@ -374,13 +384,14 @@ class GoodFETMAXUSB(GoodFET): """Poke some bytes into a register.""" data=""; if type(tosend)==str: - data=chr((reg<<3)|2)+tosend; + data=chr((reg<<3)|3)+tosend; + print "PUT %02x:=%s (0x%02x bytes)" % (reg,tosend,len(data)) else: - data=[(reg<<3)|2]+tosend; + data=[(reg<<3)|3]+tosend; ashex=""; for foo in tosend: ashex=ashex+(" %02x"%foo); - print "PUT %02x:=%s" % (reg,ashex) + print "PUT %02x:=%s (0x%02x bytes)" % (reg,ashex,len(data)) self.writecmd(self.MAXUSBAPP,0x00,len(data),data); def usb_connect(self): """Connect the USB port.""" @@ -601,7 +612,7 @@ class GoodFETMAXUSBHID(GoodFETMAXUSB): """Handles a standard setup request.""" setuptype=ord(SUD[bRequest]); if setuptype==SR_GET_DESCRIPTOR: self.send_descriptor(SUD); - elif setuptype==SR_SET_FEATURE: self.feature(1); + #elif setuptype==SR_SET_FEATURE: self.feature(1); elif setuptype==SR_SET_CONFIGURATION: self.set_configuration(SUD); elif setuptype==SR_GET_STATUS: self.get_status(SUD); elif setuptype==SR_SET_ADDRESS: self.rregAS(rFNADDR);