Crate winmtp

source ·
Expand description

Safe Rust abstraction over Windows MTP API

Microsoft provides a COM API for WPD (Windows Portable Devices).
It also provides raw bindings over these COM APIs.

This create provides a safe Rust abstraction over this API.

§What is MTP

MTP stands for “Media Transfer Protocol”. This is how many devices expose themselves when plugged by USB.
Most (every?) Android device supports it.

§Important note

The WPD API is fairly large. This crate only provides a small fraction of what is possible.
Basically, only device enumeration, simple content enumeration, and content transfer from and to devices that expose disk-like contents are implemented.

Much of this crate implements features from code samples at https://github.com/microsoft/Windows-classic-samples/blob/HEAD/Samples/PortableDeviceCOM/.
Much can be added in the future. Contributions are welcome!

§Usage

The entry point of this library is to create a Provider, e.g. by Provider::new. Other structs can be created from its various methods.

Modules§

  • Re-exported from the windows-rs crate, because it is used in our public API.
    Required features: "Win32_Devices_PortableDevices"
  • Adapters so that COM streams implement std::io::Read and std::io::Write
  • MTP object (can be a folder, a file, etc.)

Macros§

Structs§

  • Re-exported from the windows-rs crate, because it is used in our public API.
  • Re-exported from the windows-rs crate, because it is used in our public API.
    An error object consists of both an error code as well as detailed error information for debugging.

Type Aliases§

  • Re-exported from the windows-rs crate, because it is used in our public API.
    A specialized Result type that provides Windows error information.