jtagarm: a few cleanup things...
[goodfet] / client / goodfet.maxusbftdi
index 8a7d1d4..67b7673 100755 (executable)
@@ -10,7 +10,7 @@ import time;
 
 from GoodFETMAXUSB import *;
 
-class GoodFETMAXUSBFTDI(GoodFETMAXUSB):
+class GoodFETMAXUSBFTDI(GoodFETMAXUSBDevice):
     """This emulates the FTDI USB to Serial chips."""
     def hidinit(self):
         """Initialize a USB FTDI device."""
@@ -100,14 +100,13 @@ class GoodFETMAXUSBFTDI(GoodFETMAXUSB):
             print "Bullshitting a value for the latency timer."
             #Send some sort of reply.
             self.wreg(rEP0FIFO,0x01);
-            self.wreg(rEP0FIFO,0x00);
-            self.wregAS(rEP0BC,2);
+            #self.wreg(rEP0FIFO,0x00);
+            self.wregAS(rEP0BC,1);
             #Don't send reply twice.
             return;
             
         
-        print "Blindly accepting vendor request";
-        #self.wreg(rEP0FIFO,0);
+        print "Blindly accepting unhandled vendor request %02x" % request;
         self.wregAS(rEP0BC,0);
     def std_request(self,SUD):
         """Handles a standard setup request."""
@@ -192,57 +191,8 @@ class GoodFETMAXUSBFTDI(GoodFETMAXUSB):
 # STRING descriptor 3 - Serial Number ID
 "\x14\x03S\x00/\x00N\x00 \x003\x004\x002\x000\x00E\x00"
 ];
-    RepD=[
-        0x05,0x01,             # Usage Page (generic desktop)
-       0x09,0x06,              # Usage (keyboard)
-       0xA1,0x01,              # Collection
-       0x05,0x07,              #   Usage Page 7 (keyboard/keypad)
-       0x19,0xE0,              #   Usage Minimum = 224
-       0x29,0xE7,              #   Usage Maximum = 231
-       0x15,0x00,              #   Logical Minimum = 0
-       0x25,0x01,              #   Logical Maximum = 1
-       0x75,0x01,              #   Report Size = 1
-       0x95,0x08,              #   Report Count = 8
-       0x81,0x02,              #  Input(Data,Variable,Absolute)
-       0x95,0x01,              #   Report Count = 1
-       0x75,0x08,              #   Report Size = 8
-       0x81,0x01,              #  Input(Constant)
-       0x19,0x00,              #   Usage Minimum = 0
-       0x29,0x65,              #   Usage Maximum = 101
-       0x15,0x00,              #   Logical Minimum = 0,
-       0x25,0x65,              #   Logical Maximum = 101
-       0x75,0x08,              #   Report Size = 8
-       0x95,0x01,              #   Report Count = 1
-       0x81,0x00,              #  Input(Data,Variable,Array)
-       0xC0]
-    def send_descriptor(self,SUD):
-        """Send the USB descriptors based upon the setup data."""
-        desclen=0;
-        reqlen=ord(SUD[wLengthL])+256*ord(SUD[wLengthH]); #16-bit length
-        desctype=ord(SUD[wValueH]);
-        
-        if desctype==GD_DEVICE:
-            desclen=self.DD[0];
-            ddata=self.DD;
-        elif desctype==GD_CONFIGURATION:
-            desclen=self.CD[2];
-            ddata=self.CD;
-        elif desctype==GD_STRING:
-            desclen=self.strDesc[ord(SUD[wValueL])][0];
-            ddata=self.strDesc[ord(SUD[wValueL])];
-        #elif desctype==GD_REPORT:
-        #    desclen=self.CD[25];
-        #    ddata=self.RepD;
-        
-        #TODO Configuration, String, Hid, and Report
-        
-        if desclen>0:
-            sendlen=min(reqlen,desclen);
-            self.writebytes(rEP0FIFO,ddata);
-            self.wregAS(rEP0BC,sendlen);
-        else:
-            print "Stalling in send_descriptor() for lack of handler for %02x." % desctype;
-            self.STALL_EP0(SUD);
+
+
     def set_configuration(self,SUD):
         """Set the configuration."""
         bmSUSPIE=0x10;
@@ -293,7 +243,7 @@ class GoodFETMAXUSBFTDI(GoodFETMAXUSB):
         #else:
         #    self.do_IN3();
     
-    typestring="GoodFET emulates FTDI properly, if you can read this!";
+    typestring="GoodFET emulates FTDI properly, if you can read this!\n";
     typepos=0;
     
     def type_IN3(self):