I need to get connected USB device list from windows by using python or cmd.
for python i'm trying this.
import win32com.client
def get_usb_device():
try:
usb_list = []
wmi = win32com.client.GetObject("winmgmts:")
for usb in wmi.InstancesOf("Win32_USBHub"):
print(usb.DeviceID)
print(usb.description)
usb_list.append(usb.description)
print(usb_list)
return usb_list
except Exception as error:
print('error', error)
get_usb_device()
as a result i get this:
['USB Root Hub (USB 3.0)', 'USB Composite Device', 'USB Composite Device']
but i don't get a meaning full name.
and for cmd i'm trying this also:
wmic path CIM_LogicalDevice where "Description like 'USB%'" get /value
and again i don't get any meaning full name for connected usb devices.
when I'm connect a mouse, keyboard, pen drive or printer through the usb i want this kind of name. like 'a4tech mouse' or even if i get 'mouse' only that's also be fine. This type of name appears in the device section of the settings of windows 10. but i get 'USB Root Hub (USB 3.0)', 'USB Composite Device', which means nothing actually. Is it possible with python?
If any one know this answer please help. Its very important for me.