- if req.get_type() == USB.request_type_standard:
- handler = recipient.request_handlers[req.request]
- handler(req)
- elif req.get_type() == USB.request_type_class:
- # HACK: evidently, FreeBSD doesn't pay attention to the device
- # until it sends a GET_STATUS(class) message
- self.ready = True
+ req_type = req.get_type()
+ handler_entity = None
+ if req_type == USB.request_type_standard:
+ handler_entity = recipient
+ elif req_type == USB.request_type_class:
+ handler_entity = recipient.device_class
+ elif req_type == USB.request_type_vendor:
+ handler_entity = recipient.get_device_vendor()
+
+ if not handler_entity:
+ print(self.name, "invalid handler entity, stalling")