pyusb backend: assert seleted iface bInterfaceClass == 7 (a 'printer')

This commit is contained in:
Philipp Klaus committed 2018-08-14 23:04:23 +02:00
1 parent 78b5667ca4
commit d209040b92
1 file changed
+2 -1
+2 -1
View File
@@ -98,7 +98,8 @@ class BrotherQLBackendPyUSB(BrotherQLBackendGeneric):
self.dev.set_configuration() self.dev.set_configuration()
cfg = self.dev.get_active_configuration() cfg = self.dev.get_active_configuration()
intf = cfg[(0,0)] intf = cfg[(0,0)] # (bInterfaceNumber, bAlternateSetting)
assert intf.bInterfaceClass == 7 # 'Printer' not 'Vendor Specific' or the likes...
ep_match_in = lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN ep_match_in = lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_IN
ep_match_out = lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT ep_match_out = lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT