October, 2006

  • dimeby8

    Custom MTP formats in WPD

    • 2 Comments
    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...
  • dimeby8

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

    • 1 Comments
    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...
  • dimeby8

    Accessing MTP vendor extended properties through WPD

    • 0 Comments
    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...
  • dimeby8

    Setting WPD properties

    • 1 Comments
    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...
  • dimeby8

    How to check if a WPD property can be modified

    • 0 Comments
    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...
  • dimeby8

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

    • 1 Comments
    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...
  • dimeby8

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

    • 1 Comments
    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...
  • dimeby8

    Save Often!

    • 1 Comments
    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...
  • dimeby8

    Creating an MTP string

    • 1 Comments
    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...
  • dimeby8

    Listening to MTP events

    • 1 Comments
    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...
  • dimeby8

    Listening to WPD Events

    • 1 Comments
    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...
  • dimeby8

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

    • 3 Comments
    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...
  • dimeby8

    Sample code to walk the WPD object hierarchy

    • 1 Comments
    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...
  • dimeby8

    Understanding WPD object hierarchy

    • 1 Comments
    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...
Page 1 of 1 (14 items)