Skip to content
Advertisement

What happened to USB MTP gadget driver in mainline Linux kernel?

I’m trying to make a embedded device work as a MTP device, using USB gadget driver.

I know have Android switched from mass storage gadget to MTP gadget for quite a while, and found the source code for MTP gadget driver in a few Android repositories.

However in the mainline kernel code I didn’t find that particular file, nor equivalents.

But I did find patches for MTP gadget driver submitted for RFC in 2010.

Question:

Why mainline kernel does not accept this patch, and doesn’t provide any other implementation of MTP gadget, either, but Android kernel provides it?

Is this because of technical difficulty or other reasons, like there is a better way to do it?

If I want to enable USB MTP gadget on my devices(one with TI OMAP3730 SoC running 2.6.37 kernel and another with NXP/Freescale IMX6 SoC, running 3.14 kernel), which version of the MTP gadget shall I use for backport?

Advertisement

Answer

Why mainline kernel does not accept this patch, and doesn’t provide any other implementation of MTP gadget, either, but Android kernel provides it?

It was mentioned in this thread that MTP responder should be implemented as a user-space daemon, not as kernel USB gadget. And some implementations were mentioned.

On PC the MTP initiator works via user-space implementation already. As for today I have kernel 4.3 on my Debian and it still lacks of MTP gadget. But I managed to run MTP between my PC and my phone anyway, using some user-space tools (based on libmtp probably, but it’s not the point).

Android kernel is known to have some disputable technical decisions (from point of view of mainline kernel developers), as Android was a fast grown project and things ought to be implemented fast. Of course, there were attempts to upstream as much stuff as they can. But MTP gadget seems to be one of those things that couldn’t even make it to drivers/staging. Probably everyone agrees that MTP must be implemented in user-space.

If I want to enable USB MTP gadget on my devices(one with TI OMAP3730 SoC running 2.6.37 kernel and another with NXP/Freescale IMX6 SoC, running 3.14 kernel), which version of the MTP gadget shall I use for backport?

If you really need this in kernel (probably only needed for Android), you should look for Android kernel versions as close as you can find to yours. It doesn’t matter which SoC you are using, MTP implementation is common for all platforms, so just look for kernel version.

For example, take a look at these repos:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement