#Very innefficient, move this to C if performance is needed.
for j in range(0,pktsize):
self.xfrdata=self.xfrdata+[self.rreg(rRCVFIFO)];
+ xfrsize=self.xfrdata[0];
self.wreg(rHIRQ,bmRCVDAVIRQ); #Clear IRQ
xfrlen=xfrlen+pktsize; #Add byte count to total transfer length.
+ print "%i / %i" % (xfrlen,xfrsize)
#Packet is complete if:
# 1. The device sent a short packet, <maxPacketSize
ashex="";
for foo in self.xfrdata:
ashex=ashex+(" %02x"%foo);
- print "INPACKET EP%i==%s" % (endpoint,ashex);
+ print "INPACKET EP%i==%s (0x%02x bytes remain)" % (endpoint,ashex,xfrsize);
return resultcode;
RETRY_LIMIT=3;
time.sleep(0.2);
self.vbus_on();
- self.hostrun();
+ #self.hostrun();
def hostrun(self):
"""Run as a minimal host and dump the config tables."""
while 1:
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;