stall when a descriptor is requested for which we have no data
authorpete-cs <pete-cs@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Wed, 19 Jun 2013 17:41:05 +0000 (17:41 +0000)
committerpete-cs <pete-cs@12e2690d-a6be-4b82-a7b7-67c4a43b65c8>
Wed, 19 Jun 2013 17:41:05 +0000 (17:41 +0000)
git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1606 12e2690d-a6be-4b82-a7b7-67c4a43b65c8

client/USBDevice.py

index 49ba0a4..4a2ba13 100644 (file)
@@ -223,8 +223,7 @@ class USBDevice:
                     + "language 0x%04x, length %d") \
                     % (dtype, dindex, lang, n))
 
                     + "language 0x%04x, length %d") \
                     % (dtype, dindex, lang, n))
 
-        # TODO: handle KeyError
-        response = self.descriptors[dtype]
+        response = self.descriptors.get(dtype, None)
         if callable(response):
             response = response(dindex)
 
         if callable(response):
             response = response(dindex)
 
@@ -236,6 +235,8 @@ class USBDevice:
 
             if self.verbose > 5:
                 print(self.name, "sent", n, "bytes in response")
 
             if self.verbose > 5:
                 print(self.name, "sent", n, "bytes in response")
+        else:
+            self.maxusb_app.stall_ep0()
 
     def handle_get_configuration_descriptor_request(self, num):
         return self.configurations[num].get_descriptor()
 
     def handle_get_configuration_descriptor_request(self, num):
         return self.configurations[num].get_descriptor()