Compartilhar via


The MTP Device Simulator

The Media Transfer Protocol Device Simulator (MTP Simulator) is a fully-featured, self-contained device simulator that emulates an MTP device. Its primary purpose is to enable developers to exercise expected behavior based on the MTP specification by returning appropriate MTP response packets and generating MTP events. The tool’s graphical user interface (GUI) enables easy configuration of MTP parameters and presents MTP traffic and data in a friendly, human-readable format.

The MTP Simulator implements all MTP device capabilities, object properties, and operations that are based on the MTP Specification along with the major features in Windows 7. Additionally, the MTP Simulator also supports Device Stage and loading customizable device profiles.

For transport support, the MTP Simulator runs on multiple transport options such as USB, Software-Simulated USB (SoftSim), Bluetooth, and IP. Last, but not the least, the MTP Simulator runs on both Windows Vista and Windows 7.

Where to get the MTP Simulator

The MTP Simulator is publicly available as part of the Windows 7 Portable Device Enabling Kit for MTP (DEK). The kit also includes support documentation for the MTP Simulator and the MTP Specification Version 1.0 and MTP Device Services for Windows. Included in the DEK is the MTP Device Simulator User Guide which provides a detailed description of the MTP Simulator.

Installing the MTP Simulator

The MTP Device Simulator is installed as part of the Windows 7 Portable Device Enabling Kit for MTP (DEK). Before running the simulator for the first time, you may need to install the Device Simulation Framework (DSF).

To install DSF:

  1. Browse to the folder where the DEK is installed (usually C:\Windows7DEK)
  2. Navigate to the Tools\MTP Device Simulator\Dsf subfolder
  3. Open an elevated command window (i.e. "Run as Administrator”) and launch install.cmd to start the DSF MSI package install.

Once DSF is installed, you can launch the MTP Simulator from C:\WindowsDEK\Tools\MTP Device Simulator\MTPSimUI.exe. Select your desired transport, and click “Connect” to launch an instance of the MTP Simulator. The next section gives an overview of the User Interface.

User Interface

The following screenshot shows the MTP Simulator UI with navigation buttons and configuration options.

MTPSim

MTP Simulator Configuration Location Purpose

Connection

Left control tabs and menu options.

Connect, disconnect, or restart MTP Simulator by using the currently selected configuration. You can change the transport type on the Transport tab and change the test mode on the Device Mode tab.

Transport

Left control tabs and menu options.

Select the transport to be used. To simulate a software-only USB device, select the “SoftUSB” transport.

Device mode

Left control tabs and menu options.

Normal Mode should be used. Test Mode is reserved for internal Microsoft testing.

Output windows

Lower-right output window.

This window displays redirected output from stdout. Any output from a printf statement, such as trace—from either MTP Simulator or a plug-in—appears in this window. The output is also saved as mtpsimui.log automatically under the MTP Simulator root directory.

Table 1. MTP Simulator User Controls

Command-Line Options

In addition to the GUI, you can control MTP Simulator at startup by using command-line parameters. This can be useful when you need to perform automated testing. For details, see Appendix C from the MTP Device Simulator User Guide.

Customizing the MTP Simulator

You can control the capabilities that the MTP Simulator reports to Windows by using an XML file (see Appendix F in the MTP Device Simulator User Guide for details). Device capabilities are controlled by DeviceSummary.xml, and service capabilities are controlled by Services.xml.

The DeviceSummary.xml file enables you to customize the contents of the DeviceInfo, StorageInfo, DevicePropDesc, and ObjectPropDesc datasets.

The Services.xml file enables you to specify configurations that are related to device services, including service-supported formats, methods, and events.

Device Profiles

The MTP Simulator also supports loading different device profiles. A device profile contains a set of customized configuration files (i.e. DeviceSummary.xml and Services.xml) describing a sample device. The DEK comes bundled with sample profiles representing each device class (Camera, Cellular Phone, Media Player, etc). Details of how to load the device profiles are outlined in the MTP Device Simulator User Guide.

 

Device Profile Description

Fabrikam_Camera

Simulates a sample camera.

Fabrikam_Phone

Simulates a cellular phone.

Fabrikam_PMP

Simulates a portable media player.

MtpSim-FullEnumSync

Simulates a device that supports the Full Enumeration synchronization model, for example for contacts, calendar, tasks, and notes synchronization.

MtpSim-FullEnumSyncSimpleParticipant

Simulates a device that supports the Full Enumeration synchronization model (like MtpSim-FullEnumSync), with additional support for the simple participant feature.

Table 2: Sample MTP Simulator Device Profiles

Each of these profiles has a corresponding Device Stage package. Each of these packages supports the same set of standard Device Stage tasks, with the exception of the Ringtone task which is not supported by the Fabrikam_Camera and Fabrikam_PMP profiles. For more information on authoring Device Stage metadata, refer to the Windows 7 Device Stage Development Guide in the Microsoft Device Experience Development Kit.

Testing Device Stage Packages

The MTP Simulator can also be used to test custom Device Stage packages. The MTP Device Inspector tool can be used to generate a device profile which can be loaded into the Simulator (see the MTP Device Simulator User Guide for details ) . Once a custom Device Stage metadata package has been authored, the package contains all the files necessary to display a Device Stage experience in Windows 7. The package may be tested by copying it to the PC’s device metadata store and connecting the test device, in this case rapid development can be done using the MTP Simulator. In order to load (unsigned) custom Device Stage metadata the system will need to be boot into test mode. For more details, refer to page 40 of the Windows 7 Device Stage Development Guide document that is included in the Microsoft Device Experience Development Kit for details on testing Device Stage metadata packages.

Want to Learn More?

The MTP Device Simulator User Guide in the Documentation for the Device Enabling Kit contains more information on the features described above.

If you have general questions about the MTP Simulator contact AskMTP at Microsoft dot com.

 

This posting is provided "AS IS" with no warranties and confers no rights.

Comments

  • Anonymous
    March 10, 2013
    Hi, I found MTP sim can't work with Win7 64bit OS, it always shows failed to load the driver... does anyone encounter this problem and how did you fix this problem? thanks

  • Anonymous
    April 11, 2013
    hjjkksfdmsfiodsfmdsfflidsjfilds,fmds,mfdskjfds9ifds,fndkjf9eigfdmgdnfjkdnfmdnfmdnfkjdsfmndkjsnnfnsfnsjkfnsdfnsdmfmsnfudshfmdsnrfdsfrdsnfdjshuiferjgfndufhduihgdsfnnffgudshfdsn f fdsdfmsml,fdsoifds,mf,dfdsnf,mdsnfmnfjnsfidskfnkfdiosjf

  • Anonymous
    August 22, 2013
    Its a good informative article. <a href=www.itdevicesonline.com/16008030.php>Fuji lto5 tapes</a>

  • Anonymous
    April 03, 2014
    Thank you for this extremely brilliant blog! Everything is very open and represents very clear explanation of issues. <a href="www.optospan.com/mtp-multicore-fiber-optic-cables.php">Thanks again for sharing</a>

  • Anonymous
    October 06, 2014
    How do I uninstall the MTP Device Simulator? It doesn't seem to have an entry in Programs and Features.

  • Anonymous
    May 31, 2015
    Will it be possible to override values of the responses?