|
From: <la...@no...> - 2010-12-08 02:42:20
|
Hi, Thanks for your info, I did not check out the latest libmtp source code from sourceforge.net yet. I just try following command, but got the error 'connection timed out'. cvs -d:pserver:ano...@li...:/cvsroot/libmtp login am I using the right place to download source code? if yes, I wonder could you forward me the latest source code of libmtp that include your patch for my test. Thanks. Regards, Lan Liu -----Original Message----- From: ext Linus Walleij [mailto:lin...@gm...] Sent: Wednesday, December 08, 2010 4:18 AM To: lib...@li... Cc: Li Feng.5 (Nokia-MS/Beijing); Tarvainen Miska (Nokia-MS/Beijing); Quadros Roger (Nokia-MS/Helsinki); Wang Hongyu (Nokia-MS/Beijing) Subject: Re: [Libmtp-discuss] udev and libmtp: detect a new mtp device based on its USB interface descriptor 2010/12/7 <la...@no...>: > # Autoprobe PTP devices > ENV{ID_MTP_DEVICE}!="1", ATTR{bDeviceClass}=="06", > PROGRAM="/lib/udev/mtp-probe /sys$env{DEVPATH} $attr{busnum} > $attr{devnum}", RESULT=="1", SYMLINK+="libmtp-%k", MODE="666", > ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1" > > # Autoprobe vendor-specific devices > ENV{ID_MTP_DEVICE}!="1", ATTR{bDeviceClass}=="ff", > PROGRAM="/lib/udev/mtp-probe /sys$env{DEVPATH} $attr{busnum} > $attr{devnum}", RESULT=="1", SYMLINK+="libmtp-%k", MODE="666", > ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1" > > 1. So for devices that already in device database, it will matched by other > rules .It seems to me that the env variable 'ID_MTP_DEVICE' is a new one, > So maybe this variable is NOT set to value "1" when a known device match a > rule, am I right? If yes, then I am afraid above rule will be executed for > every device, even this device has already in the database. If you look at the libmtp.rules that is generated when you compile libmtp you will see that it now adds ENV{ID_MTP_DEVICE}="1" to all known devices by default. ENV{ID_MTP_DEVICE}!="1" means "execute the rest of the line if this variable is *not* set to "1". And if one of the other rules match, it will be set to "1" and this will not be executed. I have tested this, so it should work. > 2. could you please add another rule for the case that > ATTR{bDeviceClass}=="00"? > Our implementation will set 'bDeviceClass' as 0x00, which means, according > to the spec, each interface specifies its own class code. Aha yeah that makes sense. I actually merged all three cases into one: # Autoprobe vendor-specific and PTP devices ENV{ID_MTP_DEVICE}!="1", ATTR{bDeviceClass}=="00|06|ff", PROGRAM="/lib/udev/mtp-probe /sys$env{DEVPATH} $attr{busnum} $attr{devnum}", RESULT=="1", SYMLINK+="libmtp-%k", MODE="666", ENV{ID_MTP_DEVICE}="1", ENV{ID_MEDIA_PLAYER}="1" > 3. what does "RESULT=="1"" means, the exit code of program mtp_probe? No it is a string emitted by the program. printf("1"); If it is not an MTP device it emits "0" with printf("0"); > I have written a c > program, which will use info under sysfs, to check the string descriptor of > a device , to see if it is a mtp device. If yes, when this program exit with > code 1, the above rule does not take effect. If I miss something, please > tell me. I don't know if you can use the exit code at all. I think you have to emit a string. The other udev programs I have seen only use strings to pass to udev rules. > Attached is the c program, we talked a earlier, to re-write the bash script > as a c program, for your kindly review. I have added following rule to test > it, and it works on my Ubuntu. Any concern, please contact me. But I have already written a C program, it's in the libmtp CVS... It uses libusb to examine the device. Very simple, check it out! (And it works fine for me, can you test it? You need to install it into /lib/udev/mtp-probe of course). Yours, Linus Walleij ------------------------------------------------------------------------------ What happens now with your Lotus Notes apps - do you make another costly upgrade, or settle for being marooned without product support? Time to move off Lotus Notes and onto the cloud with Force.com, apps are easier to build, use, and manage than apps on traditional platforms. Sign up for the Lotus Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d _______________________________________________ Libmtp-discuss mailing list Lib...@li... https://lists.sourceforge.net/lists/listinfo/libmtp-discuss |