android
Go Back   abi>>forums > Software & Media > Software > MTP on Linux

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11-02-2009, 11:36 AM
meetooman's Avatar
meetooman meetooman is offline
Member
 
Join Date: Oct 2009
Posts: 488
Default How to set the Linux Kernel to use a MTP/MSC device as MTP only

Many portable players, from Sony for example, work in a dual MTP/MSC mode. This behavior makes them recognized by default as MTP devices on Windows PCs, but as MSC device on other OSes.
On Linux when the device is plugged the kernel usb-storage module takes control of it and then often prevents successful MTP operations. Even if the module is unloaded afterward, the device may not be in a correct USB state anymore and will not respond correctly to MTP queries.
A first way to solve the issue is to ban the module by adding it to the blacklist file. But then you will not be able to use any MSC device on the system.

Since the Linux 2.6.29 kernel released on 23 March, 2009 there is a better solution. The usb-storage module has a new "quirks" parameter we can use to tell the module not to bind to a specific device.

This is how to do it:

Create a file named for example usb-storage-devices-blacklist in the /etc/modprobe.d/ directory. You can then type our usb-storage options text line. For each device you want to free from the usb-storage module add a three fields entry. A quirks entry syntax is Vendor_ID:Product_ID:i. The "i" is the flag to say "IGNORE_DEVICE (don't bind to this device)".
Code:
options usb-storage quirks=Vendor_ID:Product_ID:i
The following line sets your kernel usb-storage module to ignore a Sony NWZ-A82x player.
Code:
options usb-storage quirks=054c:035b:i
More devices can be described, entries are separated by a comma. Here is the line for both a Sony MWZ-A82x and a Meizu M6 MiniPlayer (in MTP mode).
Code:
options usb-storage quirks=054c:035b:i,04e8:5a0f:i
Type rmmod usb-storage && modprobe usb-storage as root or reboot the PC to set the new configuration.

You will find the complete instructions and discover several other flags in the Documentation/kernel-parameters.txt file of your recent kernel source tree.

[Update]
It is now recommended to name your files in /etc/modprobe.d/ using a ".conf" extension. In openSUSE 11.2, there is also now a priority number prefix and a you will find a 99-local.conf file to give your personal parameters to modules.

Last edited by meetooman; 11-14-2009 at 06:27 AM. Reason: Update informations
Reply With Quote

Advertisement [Remove Advertisement]

  #2  
Old 01-17-2010, 08:42 PM
p0ke37's Avatar
p0ke37 p0ke37 is offline
Member
 
Join Date: Jan 2010
Posts: 224
Default

good post, I wish I could've used this on one of my old PMP's. Now I have a zune, so I have to boot windows

oh well
__________________
</p0ke37>
Befriend Wh1t3B0yz005 on the Zune social!
Reply With Quote

  #3  
Old 04-21-2010, 05:54 PM
Prazsky Prazsky is offline
Junior Member
 
Join Date: Apr 2010
Posts: 1
Default Not working quite right yet

Hi, thanks for the tutorial. I'm running Linux Mint and I've bought a Sony S639F mp3 player. I followed your instructions, but now the device doesn't auto mount when I plug it in (it before I made the changes and could access it as USB device).

Banshee also doesn't recognise it, however when I run mtp-detect I get loads of information about the device which I didn't get before I made the changes you suggested. So something has happened but I'm not sure what.

Any ideas?

Thanks
Reply With Quote

  #4  
Old 04-21-2010, 09:02 PM
meetooman's Avatar
meetooman meetooman is offline
Member
 
Join Date: Oct 2009
Posts: 488
Default

Quote:
Originally Posted by Prazsky View Post
Hi, thanks for the tutorial. I'm running Linux Mint and I've bought a Sony S639F mp3 player. I followed your instructions, but now the device doesn't auto mount when I plug it in (it before I made the changes and could access it as USB device).
First: I hope you know how to get back to your previous configuration.
Second: congratulation for your great choice for the player.
Third: The automount behavior depends on your Linux distribution.

If your player was automounted as an USB-Disk (USB-key), it's normal you can't see it anymore as this new configuration makes it disappear as an usb-storage device. That's the purpose of this tweak: make it work undisturbed as MTP device!

On Ubuntu 9.10, I saw my MTP player automounted as a gphoto-usb peripherical on the Gnome desktop. Maybe Mint can be told to do the same.

Quote:
Originally Posted by Prazsky View Post
Banshee also doesn't recognise it, however when I run mtp-detect I get loads of information about the device which I didn't get before I made the changes you suggested.
Have you checked if Banshee's MTP Media Player Support extension is enabled?

Quote:
Originally Posted by Prazsky View Post
So something has happened but I'm not sure what.
If mtp-detect now recognize your Sony, it seems that the result is exactly what is supposed to happen.

Feel free to tell us how you end up using your device. It's always interesting to know.

Last edited by meetooman; 04-21-2010 at 10:23 PM.
Reply With Quote

  #5  
Old 05-16-2010, 01:58 PM
meetooman's Avatar
meetooman meetooman is offline
Member
 
Join Date: Oct 2009
Posts: 488
Default

An update about Ubuntu 10.04.
I have plugged my Sony Walkman to a PC running this new Ubuntu version. The player is recognized as MSC by default and automounted as a disk visible on the Gnome desktop. In Ubuntu 9.10 it was handled by a GPhoto virtual mount.
So the kernel module tweak is necessary with Ubuntu Lucid Lynx in order to use such a device in MTP mode.
Reply With Quote

  #6  
Old 05-16-2010, 02:11 PM
marc2003's Avatar
marc2003 marc2003 is offline
Member
 
Join Date: Jul 2008
Location: England
Posts: 297
Default

i'm really confused as to why you would even want to use MTP when MSC is available?
__________________
Sansa Clip+ 8GB :: Sandisk 16GB Micro SDHC :: Rockbox :: FiiO E6 :: Sennheiser PX100 II
Reply With Quote

  #7  
Old 05-16-2010, 02:31 PM
Marvin the Martian's Avatar
Marvin the Martian Marvin the Martian is offline
Ultra Senior Member
 
Join Date: Oct 2008
Location: east central NY state
Posts: 10,567
Default

Quote:
Originally Posted by marc2003 View Post
i'm really confused as to why you would even want to use MTP when MSC is available?
I have to confess, I wonder the same thing.

I have 2 players that mount automatically in Windows as MTP, and that's fine.....they work fine that way for what I use them for. But if they automatically go into MSC with linux or a Mac, why would you want to change that? What is there about MTP that you would want in this situation?
__________________
Clip Zip 4GB, iPod Nano 2G 4GB, iPod 5.5G 80GB<-All RB'd Clip Sport 8GB, Cowon D2+20GB
iPod Touch 5G 32GB, Touch 4G 32GB,Touch 2G 8GB,2012 Nexus 7 32GB(4.4.2),Asus MeMoPad 8 16+64GB(4.2.2)
Reply With Quote

Reply

Tags
linux, msc, mtp, quirks, usb-storage

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:48 PM.