Skip to content

Commit

Permalink
Fix debug_dump when no devices are connected
Browse files Browse the repository at this point in the history
  • Loading branch information
dhinakg committed May 3, 2021
1 parent 4f2ba23 commit 95c7fbc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion base.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from Scripts import shared, utils

CURRENT_VERSION = "0.0.4"
CURRENT_VERSION = "0.0.5"


class Colors(Enum):
Expand Down
14 changes: 8 additions & 6 deletions debug_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@ def build_dict(instance):
for e in c.Win32_USBController():
controller = build_dict(e.PNPDeviceID)
all_devices[e.PNPDeviceID] = dict(controller)
controller["root_hub"] = build_dict(controller[PnpDeviceProperties.BUS_RELATIONS.value][0])
all_devices[controller[PnpDeviceProperties.BUS_RELATIONS.value][0]] = dict(controller["root_hub"])
controller["root_hub"]["devices"] = {}

for f in controller["root_hub"].get(PnpDeviceProperties.BUS_RELATIONS.value, []):
controller["root_hub"]["devices"][f] = build_dict(f)
all_devices[f] = dict(controller["root_hub"]["devices"][f])
if controller.get(PnpDeviceProperties.BUS_RELATIONS.value, None):
controller["root_hub"] = build_dict(controller[PnpDeviceProperties.BUS_RELATIONS.value][0])
all_devices[controller[PnpDeviceProperties.BUS_RELATIONS.value][0]] = dict(controller["root_hub"])
controller["root_hub"]["devices"] = {}

for f in controller["root_hub"].get(PnpDeviceProperties.BUS_RELATIONS.value, []):
controller["root_hub"]["devices"][f] = build_dict(f)
all_devices[f] = dict(controller["root_hub"]["devices"][f])

controllers.append(controller)
end = time.time()
Expand Down

0 comments on commit 95c7fbc

Please sign in to comment.