转载 作者: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

 

posted on 2020-08-10 14:16  许成志  阅读(424)  评论(0编辑  收藏  举报