An mtp responder written in python.
Uses configfs and functionfs.
Should now be fully functional.
Note
-
Create a regular Raspbian Lite SD card.
-
Touch
/boot/ssh
to enable ssh. -
Edit
config.txt
and add this line to enable USB device mode:dtoverlay=dwc2
-
Edit
/etc/modules
and add this line to enable USB composite driver:libcomposite
-
Load the module manually one time (it will load automatically after a reboot):
sudo modprobe libcomposite
-
Plug the Raspberry Pi into your PC.
-
Kernel must have libcomposite and dummy_hcd.
dummy_hcd is not available in Ubuntu. You can build it yourself using DKMS by following these steps:
https://serianox.github.io/gadgetfs-ubuntu.html
On Ubuntu 16.04 you need linux 4.4.0-100 or later to fix a bug when removing the gadget. Without the patch the kernel will crash.
After you built and installed dummy_hcd, add to
/etc/modules
:dummy_hcd libcomposite
-
Load the modules manually one time (they will load automatically after a reboot):
sudo modprobe dummy_hcd sudo modprobe libcomposite
pip3 install .
sudo ./pymtpd --udc <UDC>
UDC should be dummy_udc.0
if you are running on a PC, or
20980000.usb
if running on a Raspberry Pi Zero.
It shares the contents of /tmp/mtp (which will be created on start up.)
Open up a file manager and you should see an MTP (media player) device.