| Home | Forums | Register | FAQ | Search | Today's Posts | Mark Forums Read |
|
Welcome to the misticriver forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: amarok, clix, gnomad2, libmtp, linux, mtp |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Using the irivier Clix on Linux (56k warning)
Background
The iriver Clix is a rather interesting media player. Unlike its predecesor, the U10, the Clix can't switch its way of communicating with the host comoputer. The U10, though being an MTP device pretty much everywhere but Asia, can be "transformed" into what is called an MSC (Mass Storage Class) USB device (also known as UMS, USB Mass Storage device). This means that the USB MassStorage device driver (on any compliant Operating System) is used to "mount" the device (or asign a volume letter in Windows). The Clix, on the other hand, uses a different USB protocol, the MTP (Media Transport Protocol). This protocol was developed by Microsoft corporation to be used in media devices, such personal media players or personal digital media players. Amongst the advantages of this protocol is the support for "metadata", which sort of simplifies the process of managing a media libray. However this protocol was for quite some time, local to Microsoft Windows. It was first released with version 10 of Windows Media Player as a user mode device driver. The MTP protocol is actually a revision of another protocol: PTP (Picture Transfer Protocol), which is widely used in digital cameras and used in early (non-Apple) mp3 players. In Linux this protocol was the backbone for applications such as gphoto which allowed for synchronization of digital cameras (though some can also connect to the PC as MSC devices). For this to happen, libptp was devoped, and now the same thing has happened with the increased numbers of media devices, and now there's a way to communicate with these new devices in Linux (and other *nixes) too: libmtp. libmtp provides both a protocol and command line tools to control and access MTP devices. As it is a library it can be utilized by other programs to sync with these devices, and actually there are two (mantained) applications which do just that: The amazing Amarok media player and gnomad2. As its name implies, gnomad2 was first deviced as a means to synchronize with portable media players from Creative (and Dell), the Nomad series, which used a proprietary protocol over the USB bus to sync with the computer. For use with these devices, it was first developed with the libnjb library and API (an implementation of the PDE, Portable Digital Entertainment, protocol), but grew to accomodate the newer MTP devices, through the use of libmtp. Gnomad2 was first developed by Linus Walleij, who also happens to be a developer and release manager for libmtp. As of Gnomad2-2.8.11 and Amarok-1.4.5, both programs now support libmtp-0.1.3 (the latest release) which means less need for the command-line interface (though this interface also lets you control a lot of aspects of your player). Using libmtp If you happen to be the happy owner of a Clix 2Gb with firmware 1.11, chances are you will be able to do sync your Clix to an extent using Amarok. The 1.11 firmware fully works with libmtp alpha releases (0.0.x), or should I say, libmtp alpha worked well with the 1.x firmware on the Clix. When the Clix got its 2.x firmware update, the alpha versions of libmtp stopped working with it, which is to say bad, as most Linux distributions pack one or another alpha version of libmtp either in the installation media or is readily available from the vast numbers of Internet repositories for the various Linux distributions. As per the second week of february 2007 an updated versio of libmtp, Amarok and Gnomad2 exists that should be available for all major distributions on their update repositories. These versions should be compatible and should allow you to sync your Clix with firmware 2.01. Synchronizing with Amarok The following instructions are valid for Amarok 1.4.x (including latest 1.4.5) Syncing with Amarok is by far the easiest way to get your Clix working on Linux. To do so, you will have to manually configure your clix in Amarok (the following screenshots are taken in a Spanish localized Gnome desktop, appropriate translations and descriptions are provided bellow each pic): ![]() Open the main Amarok configuration window from the menu Preferences -> Configure Amarok. In the window that opens, choose Media Devices: ![]() On the right panel you should see something like: ![]() In this screenshot I have already configured the Clix, the name field should be empty. Click the add new device button, and you should see a window like this: ![]() Fill in the name field for the device, and leave the mount point field empty, as MTP devices don't mount as such. Now select MTP device from the drop down menu: ![]() At this point you can press OK on both windows and try to connect to your Clix, to do so, first select the media devices tab on the left-hand navigation panel in Amarok: ![]() This will display the media devices panel, which is empty as the device is not connected, yet: ![]() Now simply hit connect and you should see the contents of your Clix: ![]() Now, you can start transfering files... Well, sort of (see ahead). To do that, simply browse your library, select a track (or tracks) and right-click on it/them and select transfer to media device (or drag and drop): ![]() This will cause the songs to be placed in a transfer queue in the media devices tab: ![]() You can simply right click on the track/tracks to be synced or click the transfer button at the top panel to start the transference. However, at this point, you'll most likely be greted with several error messages.The files cannot be transfered into your Clix (at least not yet). And you'll have to use the command line to do that. However, the necessary entries on the Clix' database for your tracks will be created. Even the directories, the only thing missing is the actual files. The way Amarok creates the entries is under the Music directory, but instead of creating the usual artist/album pair, it directly creates the album directories, and resorts to metadata for the artist information (though that info is correctly placed in the db). As per Amarok 1.4.5 with libmtp-0.1.3 support, this is no longer true, and you should be able to sync your files just fine. However there is a "slight" problem with character encoding. Amarok uses by default ID3Tags version 2.4, this means that it uses LibTag as the backend for handling the Tags, but this also poses a problem for "older" ID3Tags v1 and 2.3, making the tags incompatibles with v1 and v2 (up to 2.3) compatible players (XMMS, Audacious, etc). The problem has got to do with character encoding. UNICODE character encoding in 2.3 tags (EasyTag uses 2.3) uses UTF-16, where as 2.4 uses UTF-8, even though Amarok is capable of understanding correctly these tags, the problems arise when you try to sync your files, as the tags will be missread, and some files will fial to sync (especially those files with non-standard characters, like accentuated characters, Asian language encoding, etc), so you will have to either update your tags or change them. Being a Spanish speaker, I stumbled onto this problem rather quickly. I don't know if by forcing the characters to be in ISO format has any better results than UNICODE. Synchronizing with Gnomad2 Gnomad2 does not synchronize as such, but rather transfers files back and forth MTP/"NJB" devices and your computer. Its main interface is a two pane window with one side representing your computer (left side) and the other your device (right side): ![]() Upon starting, the program will scan your computer for comaptible devices attached to it and then will retrive the information on it, this takes just a little while, then you can transfer files back and forth. Gnomad2 is optimized for mp3 and wma files, so it works very well with these types of files, however it lacks support for reading metadata on ogg files, even though you can transfer these just fine, and add them to playlists. Gnomad2 is pretty straight forward to use and it also allows you to manage your device once you have transfered all your files, so you can create playlists on the unit once you have uploaded your files with a simple right click on the playlists tab: ![]() Not only can you create, but you can merge (mix, mezclar), playback, edit, export and delete them. Pretty much all (except maybe playback, I have not tested this) is avialable for the Clix. There's also a tab for data, so you can transfer back and forth other files. It would be much more appreciated to have a shell extension like a GNOME-VFS2 plugin for MTP devices, but in the mean time such a plugin is implemented, Gnomad2 offers a way to transfer regular files to your DAP. A rather neat feature of Gnomad2 is the ability to add files to a given playlist when you transfer the files. You can add the files to a single playlist of multiple playlists: ![]() Gnomad2 is not perfect, though. It allows you a lot of things with your Clix, but it can crash at times. I had a strange crash upon transfering files from the Clix to my computer after it writing a file on my computer (the transfer finished) it crashed without any apparent reason. I belive it did so, because I was trying to transfer an Ogg file off the DAP (and since it can't read metadata off Oggs, it may have crashed due to that). Should you encounter any problems with Gnomad2 on your system, make sure to report a bug report , if you can provide a backtrace of the problem (try to reproduce it, launching the program from a command line interface, and see what is printed on the console, provide that so the developers can know what's going on, and hopefully correct it). As I previously daid, Gnomad2 does not support Ogg files all that well, as it is unable to read off their metadata, but if you happen to have some files already in your DAP transfered in Windows or with Amarok, you'll notice that those files' metatada is perfectly readable, and editable. Hopefully as more DAPs support OGG and FLAC, they'll add support for these as well. Transfering files from the command line These instructions are for v0.1.3, libmtp-0.1.3 on some distros like Fedora, in the libmpt-examples packages still has the standalone commands for compatibility reasons. So to transfer the files all that's left to do is to open a command line emulator, gnome-terminal, Konsole, xterm or whatever you choose, and enter the necessary commands. Warning you may require to install a separate package depending on your distribution. For instance, in Fedora Core, the package libmpt-<version> only includes the library and not the commands, which are bundled in the libmpt-examples package. Consult your distribution's packages for the correct package. The first step is to determine the directory to which you'll be transfering the files. To do that (in libmtp-0.0.2x and 0.1.x) use the mtp-folders command, before you actually issue such command, close any application/connection to the device, as it may be blocked, unplug it and replug it and then: Code:
$ mtp-folders Autodetected device "iRiver Clix" (VID=4102,PID=112a) is known. PTP: Opening session Connected to MTP device. ptp2/ptp_usb_getdata: read 1 bytes too much, expect problems! ... 65536 Video 131072 Text 196608 Flash Games 262144 Pictures 327680 Recordings 589824 Saved Recordings 655360 FM Radio 393216 Service 720896 AUDIBLE 458752 Music 786432 Susana Harp 1638400 Ahora 851968 Metallica 1703936 And Justice for All 1769472 Load 1835008 Master of Puppets 1900544 Metallica 1966080 Reload 2031616 Ride the Lightning 2097152 S & M 917504 Bach 2162688 Barroque Masterpieces 983040 Garbage 2228224 Beautiful Garbage 2293760 Version 2.0 1048576 Cranberries 2359296 Bury the Hatchet 2424832 Everybody Else 2490368 No Need To Argue 1114112 Soda Stereo 2555904 Comfort 2621440 El Ultimo Concierto 1179648 Laura Pausini 2686976 E ritorno da te 1245184 Guns 'n Roses 2752512 Guns 'n Roses 1310720 Apocalyptica 2818048 Inquisition Symphony 2883584 Plays Metallica by Four Cellos 1376256 Enya 2949120 Only Time Disc 4 3014656 Only Time The Collection 1441792 Stone Temple Pilots 3080192 Thank you 1507328 The Cranberries 3145728 To the Faithful Departed 3211264 Wake Up And Smell The Coffee 1572864 Johann Sebastian Bach 3276800 The World's Greatest Masterpieces Johann Sebastian Bach 524288 Albums PTP: Closing session OK. Notice that to the left of each directory, there's a numeric value. That's is very important, as it is going to be the argument for the transfer command to send the files to. You'll see a lot of "ptp2/ptp_usb_getdata: read 1 bytes too much, expect problems!" messages, don't worry. It is possilbe that in the next few steps the communication with the Clix may jam, and an error stating that you should reset your device may be printed on the screen. Do not panic!, just unplug and replug and it should work again. Ok, so now that you know the code for the directory you want to transfer a file to, let us send the file... Let's say we ant to send the file Metallica - Enter Sandman.ogg, to the Metallica/Metallica folder, which number code is 1900544: Code:
$ mtp-sendfile -t b902 "/path/to/Metallica - Enter Sandman.ogg" -f 1900544 Autodetected device "iRiver Clix" (VID=4102,PID=112a) is known. PTP: Opening session Connected to MTP device. ptp2/ptp_usb_getdata: read 1 bytes too much, expect problems! ... Send file /media/music/Metallica/Metallica/Metallica - Enter Sandman.ogg Sending /media/music/Metallica/Metallica/Metallica - Enter Sandman.ogg to 1900544 type:ogg,3 Sending file... Progress: 4750763 of 4750763 (100%) PTP: Closing session There is one major caveat, though. It is not possible to send several files at once using wildcards. For this reason, it is necessary to either issue each time the command for each of the files you want to get into your Clix (a pain in the butt) or (another pain in the rear) code a small shell script to automate the process... You can write a one liner shell script like the following to get all the files in the example above to the Clix: Code:
$ for i in "/media/music/Metallica/Metallica/*ogg"; do mtp-sendfile -t b902 $i -f 1900544; done Viewing the files on the Clix You can see all the files present on the Clix. The easiest way is to do that with any of the applications which support querying MTP devices such as gnomad2 or Amarok, but if you want to do it the "geek" way, you can use the mtp-files command. This command will output all the files present on the Clix, which depending on your configuration, may overflow the terminal's buffer rendering you unable to see all the files (you may redirect the output to either a file or to the "less" command, but showing how to do that is beyond the scope of this "tutorial"). Just as it happens with the directories, each and every file has a unique ID on the Clix' filesystem, for instance: Code:
File ID: 459103 Filename: Metallica - Enter Sandman.ogg File size 4750739 (0x00487D93) bytes Parent ID: 458752 Filetype: Ogg container format To delete any one file from the command line, it is important to know the file ID, even though it is apparently possible to remove files using their name rather than their ID. In any case, by now you may have guessed it, to remove the files you require the command mtp-delete, well not quite, the command is called mtp-delfile, which does exactly that: Code:
Autodetected device "iRiver Clix" (VID=4102,PID=112a) is known. PTP: Opening session Connected to MTP device. ptp2/ptp_usb_getdata: read 1 bytes too much, expect problems! ... Delete 459103 Deleting 459103 which has item_id:459103 PTP: Closing session You can create new directories on your Clix from the command line, by using the command mtp-newfolder. The way this command works is very similar to the way the command mtp-sendfile works. Basically the summary of the command is as follows: Code:
$ mtp-newfolder Usage: newfolder name id Code:
$ mtp-newfolder "My Folder" 458752 Autodetected device "iRiver Clix" (VID=4102,PID=112a) is known. PTP: Opening session Connected to MTP device. ptp2/ptp_usb_getdata: read 1 bytes too much, expect problems! ... New folder created with ID: 3342336 PTP: Closing session OK. Code:
$ mtp-folders Autodetected device "iRiver Clix" (VID=4102,PID=112a) is known. PTP: Opening session Connected to MTP device. ptp2/ptp_usb_getdata: read 1 bytes too much, expect problems! ... 65536 Video 131072 Text 196608 Flash Games 262144 Pictures 327680 Recordings 589824 Saved Recordings 655360 FM Radio 393216 Service 720896 AUDIBLE 458752 Music 786432 Susana Harp 1638400 Ahora 851968 Metallica 1703936 And Justice for All 1769472 Load 1835008 Master of Puppets 1900544 Metallica 1966080 Reload 2031616 Ride the Lightning 2097152 S & M 917504 Bach 2162688 Barroque Masterpieces 983040 Garbage 2228224 Beautiful Garbage 2293760 Version 2.0 1048576 Cranberries 2359296 Bury the Hatchet 2424832 Everybody Else 2490368 No Need To Argue 1114112 Soda Stereo 2555904 Comfort 2621440 El Ultimo Concierto 1179648 Laura Pausini 2686976 E ritorno da te 1245184 Guns 'n Roses 2752512 Guns 'n Roses 1310720 Apocalyptica 2818048 Inquisition Symphony 2883584 Plays Metallica by Four Cellos 1376256 Enya 2949120 Only Time Disc 4 3014656 Only Time The Collection 1441792 Stone Temple Pilots 3080192 Thank you 1507328 The Cranberries 3145728 To the Faithful Departed 3211264 Wake Up And Smell The Coffee 1572864 Johann Sebastian Bach 3276800 The World's Greatest Masterpieces Johann Sebastian Bach 3342336 My Folder 524288 Albums PTP: Closing session OK. libmtp-0.0.2x and libmtp-0.1.x The main difference (at user level) between the two versions is that instead of having a bunch of commands to perform a series of operations (sendfile, delete, newfolder, sendtrack, getfile) they all are part of a single command which depending on the options passed to it and the arguments will perform these operations, and most importantly, the support for sending files onto 2.0x firmware Clixes. Now that applications have started supporting libmtp, and as the protocol, the library and applications get better, there will be no reason to not be able to use any MTP device on Linux, Mac or any other POSIX platform, hopefully on any hardware platform. It would be wishful thinking when libmtp will be an integral part of *nix based systems (MacOS/Linux/BSDs) as to even have virtual filesystems modules for it (for instance a Gnome virtual filesystem module for VFS2 to browse MTP devices with mtp:// in Nautilus or Konqueror or even Finder). I still hunger for such a feature... I hope the contents of this post/thread are useful to some users here on MisticRiver and other places, and I'm confident that support for the protocol will only get better and better as the USB-IF reviews and formulates a standard for the protocol just like they did for the MSC devices, so that all the required documentation is made available for implementation on as many platforms as MSC is currently supported. Warning! There is currently a bug in libmtp v0.1.3 which prevents you to operate the Clix once it reaches a certain amount of files on the device. You may unlock it by means of creating a recording (effectively surpassing this "limit") and then operate your Clix again. There is already a bug report about this at the libmtp tracker here. Remember that you can contribute to make libmtp better by reporting to the developers any other irregularities you note with it in the tracker. Last edited by _gmureddu_ : February 15th, 2007 at 04:26 PM. |
|
|||
|
thanks for this lengthy description.
AFAIK libmtp provides a basic subset only, while WMP provide a wider range of options. What does this mean in reality? What can't be done via libmtp which can be done via WMP11? None of both would provide something which I expected as a basic functionality of the player itself: building its playlist internally when files are deleted offline. |
|
|||
|
Quote:
Being the informatic industry driven by lower common denominators, what will happen is that the standardized portion will be implemented by many manufacturers/OSes that the Extended portion will be not used by the bulk (maybe only MS's own Zune will implement it), being key here, the lowest common denominator. Of course that is until the USB-IF finalizes the standard of MTP and implementations start to appear in systems like MacOS (hence announcing products competing against the iPod on its ground) |
|
|||
|
This is fantastic.
Of course its a tad too complex for regular users, but Linux people aren't really "regular" users. This should be FAQd if it hasn't already. Lets hope we don't get any license issues with DRM content. |
|
|||
|
DRM content will be one of the things libmtp can't do. There is no real need to worry about license issues. (Last I knew it didn't set refrences either, but they may have implemented that in the latest version.)
PS: Just for completeness, the number that you refrence everything by is referred to as the Object ID. (Not to be confused with the PUID, or Persistant Unique ID.)
__________________
---------------------------------------------- Having connection problems? Click here. Don't like WMP? WinAmp MMJB Yahoo! Real Napster J. River MediaMonkey all work with MTP devices. Think apple's iPoo doesn't stink? Check their forums. |
|
|||
|
Quote:
And yes, however, the PUID is only visible if you use the command mtp-detect, which displays this in hex format, so the rest of the commands/programs do not display this and hence there is little room for confusion. However I DID get confused when trying to figure out how to do all this stuff |
|
|||
|
Is it possible to use gnomad2 to do any of this?
I can't get amarok to run without installing all of kde - and specifically without arts, which i am keen to keep out of my system. failing that is it possible to make the db entries in any other way? ooooh, for something like ifish... for my clix. |
|
|||
|
Indeed, you can use gnomad2, actually the latest version should be kept in sync with libmtp-0.1.3, if you have those available on your distro, use them. By the way, libmtp, gnomad and the latest Amarok should be up in Fedora 5 and 6 any time soon now (as the difficulties there were with Amarok not being able to build with the latest libmtp have been solved). I'll have to test this (currently I'm not at home) tomorrow and see whether it is now possible to fully sync with either application.
__________________
Want to use your Clix on Linux? Check this |
|
|||
|
Important update
I can confirm that with gnomad2-2.8.11 and libmtp-0.1.3 it is possible to transfer files, add them to playlists, and delete them from the Clix, pretty much in the same way that the application works with the Nomad players from Creative. I can now kiss Windows good bye from my hard disk.... Well, not quite, I still have to see if Amarok will do the same. In the mean time, here's the list of applications you can use in *nix to sync your Clix:
Happy Clix'ing! PS: later today I'll edit the original post to reflect this change, with both Amarok and Gnomad2.
__________________
Want to use your Clix on Linux? Check this |
|
|||
|
Great! Thanks Gnomad2 works a treat.
Except (there's always an except isn't there...) my cd collection is in ogg format, and it seems that the clix won't read the metadata. There's something that looks like a fix based on WMP on these pages, but is there something for linux. One of the problems is that the Gnomad listings also don't read the metadata (even on the extended search), so even organising things on there are very tricky... Are there any solutions and/or workarounds? |
|
|||
|
I stumbled againts the same brick wall as you, while I was doing all the testing to update the original "HowTo" message. The problem is that "there is no problem"... Well, sort of, to say it simply: Gnomad2 does not support ogg metadata, plain and simple. I've already submitted a feature request (as per Linus's own suggestion [Linus Walleij, not Torvalds, of course!]), maybe you could submit or add to that too, so it will get implemented faster? Have a look here
__________________
Want to use your Clix on Linux? Check this |
|
|||
|
thanks! i have added my comment after your feature request. <crosses fingers>
in the meantime, i have concluded i needed to sacrifice one of my distros to kde to enable amarok...except that i don't seem to get the mtp options that are indicated in the example (but creative and ifp devices are options...)...do you have any suggestions? I am running debian testing, and used apt-get. libmtp was compiled from source (compiling amarok from source gets me evil kde can't find qt messages - although heaven knows why - before bailing. apparently a 'known issue', but not one that i seem to be able to fix) but before we go here: perhaps i should just check - will amarok support my ogg metadata? thanks for your help! |
|
|||
|
Amarok has got to support anything, provided it is built with the correct flags. I'm not familiar with the way Debian packages Amarok, though. Maybe here you'll find a version with all you need enabled? I hope that works. Maybe the version on the repos is not the same as the latest?
By the way, make sure to use Amarok 1.4.5 as the previous, is compatible only with libmtp-0.0.2x (libmtp.so.4 instead of libmtp.so.5)
__________________
Want to use your Clix on Linux? Check this |
|
|||
|
PTP Error
I'm having problems with Gnomad connecting to my Clix. The first time connecting my Clix after installing Gnomad and Libmtp everything worked smoothly, but that was the only time. After that connecting my Clix crashed Gnomad. The terminal output is below. I keep getting a 0x02ff return code, or PTP_ERROR_IO. Any suggestions on what to do next?.
Autodetected device "iRiver Clix" (VID=4102,PID=112a) is known. PTP: Opening session Connected to MTP device. flush_handles(): LIBMTP panic: Could not get object handles... Return code: 0x02ff (look this up in ptp.h for an explanation). LIBMTP_Get_Storage() : Could not get storage info LIBMTP_Get_First_Dev ice(): Get Storage information failedQueried iriver clix Segmentation fault (core dumped) |