D'oh! Reverting a commit that would crash Xorg with goodfet.maxusbhid.
[goodfet] / client / GoodFETMAXUSB.py
index 6085e70..65844d7 100644 (file)
@@ -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);