diff --git a/yubiswitch.py b/yubiswitch.py index 4ba720a..897f91f 100755 --- a/yubiswitch.py +++ b/yubiswitch.py @@ -27,8 +27,15 @@ def activate(self): ''' if self.is_active(): return False - with open('/sys/bus/usb/drivers/usbhid/bind', 'w') as fd: - fd.write(self.dev_id) + try: + with open('/sys/bus/usb/drivers/usbhid/bind', 'w') as fd: + fd.write(self.dev_id) + except IOError as e: + if e.errno == 19: + # this is fine... one of the subdevices isn't activatable + return False + else: + raise return True def deactivate(self):