WPD can not work on Windows XP

August 06th, 2009 - 01:40 am ET by Kimi | Report spam
I am writing the codes using WPD to detect my cell phone.
On Vista and Windows 7, it's OK.
But when I using it under Windows XP, the WPD can not find any device.
I try installing the WMP 11 Player and WMP11 Format SDK runtime, but the
problem is still there.
However, the WMP 11 Player can detect my cell phone.
I also try the Wdpapi sample in the Windows SDK. it also can not find the
cell phone.

Do anyone know what is the problem?

Thinking&Coding
email Follow the discussionReplies 2 repliesReplies Make a reply

Replies

#1 pcbbc
February 15th, 2011 - 05:47 am ET | Report spam
Kimi wrote on 08/06/2009 01:40 ET :
I am writing the codes using WPD to detect my cell phone.
On Vista and Windows 7, it's OK.
But when I using it under Windows XP, the WPD can not find any device.
I try installing the WMP 11 Player and WMP11 Format SDK runtime, but the
problem is still there.
However, the WMP 11 Player can detect my cell phone.
I also try the Wdpapi sample in the Windows SDK. it also can not find the
cell phone.

Do anyone know what is the problem?

Thinking&Coding


Microsoft claim that WPD and MTP are supported on XP with WMP11 installed, and indeed this is the case!

However by default on XP a camera device will most likely load the PTP driver stack instead. You can check this by looking at the Driver Details page from Device Manager, Properties, Driver tab, where you should see:

* C:\Windows\System32\ptpusb.dll
* C:\Windows\System32\ptpusd.dll

That is, unless your camera vendor has thoughtfully supplied a custom WPD compatible INF file for your device on XP. Most haven't, probably due to the reliance on WMP10/11.

However it is relatively easy to create your own custom INF to enable MTP, and details for this are given in the Microsoft Media Transfer Protocol Porting Kit in the mtpdev.chm help file under section "Providing a Custom INF File for an MTP Device".

However the detail there seem somewhat incomplete, and there is further information to be had about the sections required in the comments of C:\Windows\Inf\WpdMtp.inf installed with Windows Media Player 11:

;;******************************************************************************
;; The following are to be used in vendor specific "Includes" and "Needs" sections.
;; Specifically, the INF should contain:
;;
;; [DDInstall]
;; Include = wpdmtp.inf
;; Needs = WPD.MTP
;;
;; [DDInstall.hw]
;; Include = wpdmtp.inf
;; Needs = WPD.MTP.Registration <- includes all default legacy API and autoplay registration for the device
;; - OR -
;; Needs = WPD.MTP.RegistrationBasic <- only do minimum registration, no legacy API or autoplay
;;
;; [DDInstall.Services]
;; Include = wpdmtp.inf
;; Needs = WPD.MTP.Services
;;
;; [DDInstall.CoInstallers]
;; Include = wpdmtp.inf
;; Needs = WPD.MTP.CoInstallers
;;
;; [DDInstall.Wdf]
;; Include = wpdmtp.inf
;; Needs = WPD.MTP.Wdf
;; UmdfServiceOrder=WpdMtpDriver
;;
;;******************************************************************************

For example, for a Nikon D90, the following INF file can be created:

[Version]
Signature="$WINDOWS NT$"
Class=WPD
ClassGUID={EEC5AD98-8080-425f-922A-DABF3DE3F69A}
Provider=%Provider%
DriverVer=02/22/2006,5.2.5326.4762

[Manufacturer]
%MfgName%=Nikon

[Nikon]
%Nikon.DeviceDesc%=Nikon_MTP, USB\VID_04B0&PID_0421

[Nikon_MTP]
Include = wpdmtp.inf
Needs = WPD.MTP

[Nikon_MTP.hw]
Include = wpdmtp.inf
Needs = WPD.MTP.RegistrationBasic

[Nikon_MTP.Services]
Include = wpdmtp.inf
Needs = WPD.MTP.Services

[Nikon_MTP.CoInstallers]
Include = wpdmtp.inf
Needs = WPD.MTP.CoInstallers

[Nikon_MTP.Wdf]
Include = wpdmtp.inf
Needs = WPD.MTP.Wdf
UmdfServiceOrder=WpdMtpDriver

[Strings]
Nikon.DeviceDesc = "Nikon D90 MTP Device"
MfgName = "Nikon"
Provider = "Nikon"

To support different devices change, or add additional items, under the [Nikon] section with the correct PID and VID for your device. You can find these in Device Manager on the Details tab by selecting "Hadrware Ids" from the drop down. You'll probably also want to change all the references to "Nikon" if your camera is from a different manufacturer.

Once you have created your INF file in notepad, save under an appropriate name, for example NikonD90.INF. Then:

* In Windows Device Manager right click the camera device and "Update Driver".
* Select "No, not this time" when Windows asks to search Windows Update.
* Select "Install from a list or specific location (Advanced)".
* Select "Don't search, I will choose the drive to install".
* Click "Have Disk".
* Click "Browser" and navigate to the folder where you saved the INF file created above.
* Select the INF file and it should install the MTP drivers.

Now in Device manager you should see that the camera device has moved from "Imaging Devices" and is now displayed under "Portable Devices" instead. Also on the driver details you should see the following files indicating that the generic WPD MTP class drivers are being used (instead of PTP previously):

* C:\Windows\System32\wpdusb.dll
* C:\Windows\System32\wudfrd.dll

You should now be able to successfully enumerate your MTP device using IPortableDeviceManager.GetDevices and use all of the other API functions to send custom MTP commands. See the MSDN posts by dimeby8 for details.

The above solution allows you to build applications with a common API that work on Windows XP through Windows 7 in either 32 or 64 bit with no code changes.

Similar topics