Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught exception on connection issues #207

Closed
szszszsz opened this issue Mar 8, 2022 · 0 comments · Fixed by #209
Closed

Uncaught exception on connection issues #207

szszszsz opened this issue Mar 8, 2022 · 0 comments · Fixed by #209
Labels
bug Something isn't working device/Nitrokey 3 UI update Related to firmware update process

Comments

@szszszsz
Copy link
Member

szszszsz commented Mar 8, 2022

Uncaught exception on connection trouble clutters the screen, confusing user. To catch it, and leave human-readable message instead.

Details:

Output

Please press the touch button to reboot the device into bootloader mode ...
[Press]

Critical error:
Failed to connect to Nitrokey 3 bootloader
Are the Nitrokey udev rules installed and active?
    Exception encountered: McuBootConnectionError()
Traceback (most recent call last):
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/cli/__init__.py", line 105, in main
    nitropy()
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/cli/nk3/__init__.py", line 377, in update
    raise CliException(*msgs, exc)
pynitrokey.cli.exceptions.CliException: Failed to connect to Nitrokey 3 bootloader
Are the Nitrokey udev rules installed and active?
MBoot: Connection issue -> Unable to open device 'b'/dev/hidraw5'' VID=8352 PID=17117 SN=''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/daniel/.local/lib/python3.8/site-packages/spsdk/mboot/interfaces/usb.py", line 153, in open
    self.device.Open(self.path)
  File "/home/daniel/.local/lib/python3.8/site-packages/libusbsio/libusbsio.py", line 1322, in Open
    self.logger.info("HID device %d is now open" % self._h)
TypeError: %d format: a number is required, not NoneType

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/daniel/.local/bin/nitropy", line 8, in <module>
    sys.exit(main())
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/cli/__init__.py", line 107, in main
    e.show()
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/cli/exceptions.py", line 25, in show
    local_critical(
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/helpers.py", line 202, in local_critical
    nitropy.commands["list"].callback()
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/cli/__init__.py", line 90, in list
    _list()
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/cli/__init__.py", line 84, in _list
    nk3.commands["list"].callback()
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/cli/nk3/__init__.py", line 110, in list
    with device as device:
  File "/home/daniel/.local/lib/python3.8/site-packages/pynitrokey/nk3/bootloader.py", line 47, in __enter__
    self.device.open()
  File "/home/daniel/.local/lib/python3.8/site-packages/spsdk/mboot/mcuboot.py", line 258, in open
    self._device.open()
  File "/home/daniel/.local/lib/python3.8/site-packages/spsdk/mboot/interfaces/usb.py", line 156, in open
    raise McuBootConnectionError(
spsdk.mboot.exceptions.McuBootConnectionError: MBoot: Connection issue -> Unable to open device 'b'/dev/hidraw5'' VID=8352 PID=17117 SN=''

@szszszsz szszszsz added bug Something isn't working UI update Related to firmware update process device/Nitrokey 3 labels Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working device/Nitrokey 3 UI update Related to firmware update process
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant