Skip to content

Commit

Permalink
pyusb backend: assert seleted iface bInterfaceClass == 7 (a 'printer')
Browse files Browse the repository at this point in the history
  • Loading branch information
pklaus committed Aug 14, 2018
1 parent 78b5667 commit d209040
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion brother_ql/backends/pyusb.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def __init__(self, device_specifier):
self.dev.set_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_out = lambda e: usb.util.endpoint_direction(e.bEndpointAddress) == usb.util.ENDPOINT_OUT
Expand Down

0 comments on commit d209040

Please sign in to comment.