From a2f6b68ebded8f6213a19adf22306e892aa9fff6 Mon Sep 17 00:00:00 2001 From: pete-cs Date: Wed, 19 Jun 2013 17:41:05 +0000 Subject: [PATCH] stall when a descriptor is requested for which we have no data git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@1606 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/USBDevice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/client/USBDevice.py b/client/USBDevice.py index 49ba0a4..4a2ba13 100644 --- a/client/USBDevice.py +++ b/client/USBDevice.py @@ -223,8 +223,7 @@ class USBDevice: + "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) @@ -236,6 +235,8 @@ class USBDevice: 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() -- 2.20.1