Skip to content

Commit

Permalink
fix usbfilter.py linux usb-device-search
Browse files Browse the repository at this point in the history
  • Loading branch information
daringer committed Jun 18, 2024
1 parent 4dada22 commit f54e7bd
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pynitrokey/trussed/bootloader/lpc55_upload/utils/usbfilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,11 @@ class intention is to be just a simple container. But to help the class
linux_path_parts = linux_path.split(":")

if len(linux_path_parts) > 1:
linux_path = str.format(
"{}#{}", int(linux_path_parts[0], 16), int(linux_path_parts[1], 16)
)
bus_num, port_chain = linux_path.split('-')
fs_path = linux_path.split(":")[0]
path = f"/sys/bus/usb/devices/{fs_path}/devnum"
devid = open(path).read()
linux_path = f"{bus_num}#{devid}"

return linux_path

Expand Down

0 comments on commit f54e7bd

Please sign in to comment.