Tuesday, January 4, 2011

Kidizoom and Ubuntu Maverick

For Christmas, we gave a camera Vtech Kidizoom Pro to each of our two little girls (yes, I am a grandfather). Unfortunately, when i connect the USB cable... nothing happens! How? A camera which is not recognized by Linux? Strange!  'lsusb' shows me that the KP is seen by the system but does not mount automatically. A bit of Google surf tells me that damned bug no longer allow our beloved OS to mount automatically fat16 partitions... 

After some research about the udev rules, here is a solution that will avoid to mount the KP manually.
The connection is usb1, this is why the loading rate is very slow. And here nothing to do, our OS is innocent.

First, create and edit an udev rules file:
$ sudo touch /etc/udev/rules.d/90-kidizoom.rules
$ sudo gedit /etc/udev/rules.d/90-kidizoom.rules

Then put a line to mounting...
KERNEL=="sd?1", SUBSYSTEMS=="scsi", ACTION=="add", ATTRS{vendor}=="VTech   ", ATTRS{model}=="Kidizoom        ", SYMLINK+="kidizoom", RUN+="/path/to/mount-script %k"

...and this one to unmounting.
KERNEL=="sd?1", SUBSYSTEMS=="scsi", ACTION=="remove", ENV{ID_VENDOR}=="VTech*",  RUN+="/path/to/umount-script %k"

The file can be downloaded here, Be careful to not forget to change the path of RUN and reload udev with:
$ sudo service udev restart

Installe "pmount":
$ sudo apt-get install pmount

Here is the mount script:
mk() {                                       
pumount /dev/$1                      
sleep 1                              
pmount -t vfat /dev/kidizoom KIDIZOOM
xhost local:$2                       
nautilus /media/KIDIZOOM      
user=`who | grep :0\) | cut -f 1 -d ' '`     
export DISPLAY=:0.0                          
export -f mk                                 
su $user -c "mk $1 $user"                    

And here, the unmount script:
umk() {                                            
pumount /dev/$1                            
sleep 1                                    
xhost local:$2                             
zenity  --info --text "Kidizoom is unmount"
user=`who | grep :0\) | cut -f 1 -d ' '`           
export -f umk                                      
export DISPLAY=:0.0                                
su $user -c "umk $1 $user"                         

To download this files it is here and there.

Don't forget to set the execute permission (thanx to Marten@UBL):
$ chmod +x /path/to/mount-script; chmod +x /path/to/umount-script

Thank you to sevkeifert for his help
Et voilà ...

English translation of my Blog

More and more visitors visit rcspamsblog through google translation.
That's why I have decided to translate some of my posts in English here.
I am not an expert in english, so I will do my best.
See you soon...