USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
Loading...
Searching...
No Matches

USB MTP (Media Transfer Protocol) v1.1 device class. More...

#include "usb_class.h"

Data Structures

struct  mtp_opts
 MTP configuration: device identity + one or more storage backends. More...
 

Macros

#define MTP_MAX_STORAGES
 Maximum number of storages a device may expose.
 

Typedefs

typedef struct mtp_func mtp_func
 One MTP function: a single instance of the class on a device.
 
typedef void(* mtp_emit) (void *ctx, const char *name)
 Callback used by mtp_opts::listdir to report one directory entry.
 

Functions

mtp_funcmtp_add (usbip_device *dev, const mtp_opts *opts)
 Add an MTP interface to a device.
 

Variables

const usbip_device_class usbip_device_mtp
 The MTP class, for usbip_device_add_class()
 

Detailed Description

USB MTP (Media Transfer Protocol) v1.1 device class.

Exports one or more host directory trees as MTP storages: Windows Explorer, libmtp (mtp-detect/mtp-files) and gphoto2 can browse them, download files and - unless read-only - upload, delete, rename, move/copy and edit. MTP rides the Still Image interface (class 0x06/0x01/0x01) and a bulk container protocol (command -> optional data -> response) with an interrupt IN endpoint for events.

This class implements the MTP protocol and object model (device-global handles, the per-storage tree, properties, the Android partial/edit extensions) but does no filesystem access - all storage I/O is delegated to the backend callbacks below, one per storage context (see examples/device/mtp_device.c). Pairs with usbip_function_enable_msos(func, "MTP", NULL) (done when opts.winusb is set) so Windows binds its MTP/WPD driver with no INF. Mirrors python classes/device/mtp.py.