-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
31 lines (27 loc) · 1.12 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
from infi.devicemanager import DeviceManager
import time
def scanUSB ():
start_time = time.time()
dm = DeviceManager()
dm.root.rescan()
all_devices = dm.all_devices
usb_devices = [device for device in all_devices if "USB" in device.description
and "концентратор" not in device.description.lower()
and "host controller" not in device.description.lower()]
for usb_device in usb_devices:
print(f"Device: {usb_device}")
print(f"Instance ID: {usb_device.instance_id}")
print(f"Description: {usb_device.description}")
print(f"Class GUID: {usb_device.class_guid}")
print(f"Hardware IDs: {usb_device.hardware_ids}")
try:
location_info = usb_device.location
print(f"Location: {location_info}")
except KeyError:
print("Location information not available")
print("---")
end_time = time.time()
execution_time = end_time - start_time
print(f"Время выполнения функции scanUSB() : {execution_time} секунд")
if __name__ == "__main__":
scanUSB()