Skip to content
New issue

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

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

Already on GitHub? # to your account

Ugly exception in the absence of an USB gadget device #367

Closed
jan-kiszka opened this issue Nov 15, 2023 · 1 comment
Closed

Ugly exception in the absence of an USB gadget device #367

jan-kiszka opened this issue Nov 15, 2023 · 1 comment
Assignees
Milestone

Comments

@jan-kiszka
Copy link
Contributor

I think this could be reported in a nicer way:

Nov 15 15:26:30 mtda mtda-service[1572]: Traceback (most recent call last):
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3/dist-packages/zerorpc/core.py", line 153, in _async_task
Nov 15 15:26:30 mtda mtda-service[1572]:     functor.pattern.process_call(self._context, bufchan, event, functor)
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3/dist-packages/zerorpc/patterns.py", line 30, in process_call
Nov 15 15:26:30 mtda mtda-service[1572]:     result = functor(*req_event.args)
Nov 15 15:26:30 mtda mtda-service[1572]:              ^^^^^^^^^^^^^^^^^^^^^^^^
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3/dist-packages/zerorpc/decorators.py", line 44, in __call__
Nov 15 15:26:30 mtda mtda-service[1572]:     return self._functor(*args, **kargs)
Nov 15 15:26:30 mtda mtda-service[1572]:            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3.11/dist-packages/mtda/main.py", line 1060, in target_toggle
Nov 15 15:26:30 mtda mtda-service[1572]:     if self._target_on() is True:
Nov 15 15:26:30 mtda mtda-service[1572]:        ^^^^^^^^^^^^^^^^^
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3.11/dist-packages/mtda/main.py", line 927, in _target_on
Nov 15 15:26:30 mtda mtda-service[1572]:     result = self._composite_start()
Nov 15 15:26:30 mtda mtda-service[1572]:              ^^^^^^^^^^^^^^^^^^^^^^^
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3.11/dist-packages/mtda/main.py", line 153, in _composite_start
Nov 15 15:26:30 mtda mtda-service[1572]:     result = Composite.install()
Nov 15 15:26:30 mtda mtda-service[1572]:              ^^^^^^^^^^^^^^^^^^^
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3.11/dist-packages/mtda/support/usb.py", line 81, in install
Nov 15 15:26:30 mtda mtda-service[1572]:     result = Composite._install()
Nov 15 15:26:30 mtda mtda-service[1572]:              ^^^^^^^^^^^^^^^^^^^^
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3.11/dist-packages/mtda/support/usb.py", line 133, in _install
Nov 15 15:26:30 mtda mtda-service[1572]:     Composite._installed = Composite._enable()
Nov 15 15:26:30 mtda mtda-service[1572]:                            ^^^^^^^^^^^^^^^^^^^
Nov 15 15:26:30 mtda mtda-service[1572]:   File "/usr/lib/python3.11/dist-packages/mtda/support/usb.py", line 66, in _enable
Nov 15 15:26:30 mtda mtda-service[1572]:     usbdrv = os.listdir("/sys/class/udc")[0]
Nov 15 15:26:30 mtda mtda-service[1572]:              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
Nov 15 15:26:30 mtda mtda-service[1572]: IndexError: list index out of range
@chombourger
Copy link
Collaborator

agreed - this should be easy to address

@chombourger chombourger added this to the 0.31 milestone Feb 15, 2024
chombourger added a commit to chombourger/mtda that referenced this issue Feb 15, 2024
Check if the system has any udc instances to avoid a nasty
exception.

Closes: siemens#367
Signed-off-by: Cedric Hombourger <cedric.hombourger@siemens.com>
@chombourger chombourger self-assigned this Feb 15, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants