Welcome to MSDN Blogs Sign in | Join | Help

October 2006 - Posts

Custom MTP formats in WPD

The list of supported WPD formats is available in MSDN here . But what if your MTP device supports a brand new format that isn't in the supported list? WPD does allow a way to reference custom/vendor extended formats. If you take a closer look at the
Posted by dimeby8 | 2 Comments

MTP array properties (AINT*/AUINT*) in WPD

MTP allows for a wide range of array-based data types ranging from an array of bytes (AINT8/AUINT8) to an array of GUIDs (AINT128/AUINT128). Check out section 3.2.1 and 3.2.2 in the MTP specification for a complete list and definition. Unfortunately the
Posted by dimeby8 | 1 Comments
Filed under: ,

Accessing MTP vendor extended properties through WPD

Apart from the standard device and object properties defined in the MTP specification, device vendors are free to add their own properties. The codes for these properties must lie in the vendor-extension range as defined by the MTP spec in section 3.3.1.
Posted by dimeby8 | 0 Comments
Filed under: ,

Setting WPD properties

The IPortableDeviceProperties::SetValues API can be used to set WPD object properties. The documentation covers the API parameters as well, so we'll skip to the meatier sample. The SetValues API can be used to set multiple properties at the same time.
Posted by dimeby8 | 1 Comments
Filed under:

How to check if a WPD property can be modified

We'll create a little helper function that we can use to figure out if a WPD object property can be modified. All WPD object properties have attributes on them. The MSDN documentation provides a complete list of attributes here . We'll take a look at
Posted by dimeby8 | 0 Comments
Filed under:

Sending MTP commands through WPD (Part 3 - data from device)

Let's use the GetDevicePropValue command (MTP spec - section D.2.21) to illustrate this. GetDevicePropValue takes one parameter - the device property code that we want to retrieve the current value for. We'll retrieve the BatteryLevel device property
Posted by dimeby8 | 1 Comments
Filed under: ,

Sending MTP commands through WPD (Part 2 - data to the device)

We'll pick the SetDevicePropValue MTP command (MTP spec - section D.2.22) to illustrate this example. This command requires the device property code as a parameter. We'll try setting the DateTime property (MTP spec - section C.2.18). The DateTime property
Posted by dimeby8 | 0 Comments
Filed under: ,

Save Often!

One of the problems of living on the cutting edge is that it tends to make you bleed. I have a post-RC1 Vista build on my main desktop. And I was impressed by the fact that I hadn't required a single reboot in over three weeks. I worked yesterday on putting
Posted by dimeby8 | 1 Comments
Filed under:

Creating an MTP string

In some of our later examples, we'll have to send MTP strings to the device. MTP strings are defined in the MTP spec in section 3.2.3. Briefly, the first byte is the number of Unicode characters to follow (including the NULL terminator), the remaining
Posted by dimeby8 | 1 Comments
Filed under:

Listening to MTP events

MTP devices can fire events as well. These events are used to educate the PC (or the initiator) about any change in device status. Think of a scenario where you connect a camera extension to an MTP cellphone. The configuration of the cellphone has now
Posted by dimeby8 | 1 Comments
Filed under: ,

Listening to WPD Events

The WPD API allows applications to listen for events from the driver or the device. These events are primarily used to indicate changes in device state such as a new object being added, an object being deleted, etc. A list of possible WPD events is available
Posted by dimeby8 | 1 Comments
Filed under:

Sending MTP commands through WPD (Part 1 - without a data phase)

Most WPD API are wrappers around the SendCommand API. The documentation for the SendCommand API provides a pretty good example on how to send commands to a driver. So rather than reinvent the wheel, we'll take a look at how we can use the SendCommand
Posted by dimeby8 | 2 Comments
Filed under: ,

Sample code to walk the WPD object hierarchy

Here's a quick example of a console app that can enumerate the contents of a WPD device. You'll need to link against portabledeviceguids.lib as well. // Disclaimer: The code presented is not endorsed in anyway by Microsoft. Use at your own risk. #include
Posted by dimeby8 | 0 Comments
Filed under:

Understanding WPD object hierarchy

Almost all WPD devices allow content to be stored on them and this suggests that a way of organizing the content would exist. In this post we'll try understanding a typical WPD hierarchy. When a device does allow content to be stored on it, it is through
Posted by dimeby8 | 1 Comments
Filed under:
 
Page view tracker