windows 获取USB,发现安卓设备,自www.jb51.net/article/164456.htm

转载 作者:jgw2008  

 

import win32com.client

def CheckDev():
  wmi = win32com.client.GetObject ("winmgmts:")
  for usb in wmi.InstancesOf ("win32_usbcontrollerdevice"):
    if "&MS_COMP_MTP" in usb.Dependent:
      print(usb.Dependent)  
      print("安卓设备已连接")
      return True


if __name__ == '__main__':

  while True:
    if CheckDev():
    break

 

你可能感兴趣的:(windows 获取USB,发现安卓设备,自www.jb51.net/article/164456.htm)