0
Follow
0
View

Windows obtains the WPD device path

zhh1127 注册会员
2023-02-27 16:10

In a Windows environment, you can use the Windows API function SetupDiGetClassDevs to get the device instance path of the MTP mode device. This function enumerates devices according to the specified GUID and returns the device instance path.

DIANMANYU 注册会员
2023-02-27 16:10

    RegisterDeviceNotification < li > using the Windows API function to register the equipment drawing events, so that the device inserted pull when notified.
  1. uses the Windows API function SetupDiGetClassDevs to enumerate the MTP devices in order to get the details of the devices.
  2. < li > using the Windows API function SetupDiEnumDeviceInterfaces enumerated by MTP device interface, in order to get the detailed information of the interface. < li > using the Windows API function SetupDiGetDeviceInterfaceDetail MTP device to obtain the path, in order to open the device.
  3. uses the Windows API function CreateFile to open the MTP device for data transfer.
  4. uses the Windows API function DeviceIoControl to send MTP instructions in order to implement hot swapping of MTP devices.
  5. uses the Windows API function CloseHandle to close the MTP device in order to free resources.