Thursday, 24 December 2009

Script to mount up or dismount a Creative Xen XiFi

UPDATE: Get udev permissions right and then can use Gnomad2 or other GUI without root/sudo without mounting scripts.

As in this post but files edited location different for ubuntu jaunty (in /lib/udev instead of /etc/udev):

Add the entries (with group audio) in /???/udev/rules.d/45-{mtp8|njb5}.rules files. For me, ubuntu jaunty, there were no  /etc/udev/rules.d/45-whatever files. Adding them in /lib/udev instead of /etc/udev works. Properly done probably files in /etc only should be edited, after an update the edits in /lib might be lost ... so backup.

Group audio audio instead of plugdev for the entries  as normal users are in group audio for me. (possibly something I added so general audio stuff operated better)

$ grep -A1 X-fi /lib/udev/rules.d/45-lib*
/lib/udev/rules.d/45-libmtp8.rules:# Creative Zen X-fi
/lib/udev/rules.d/45-libmtp8.rules-ATTR{idVendor}=="041e", ATTR{idProduct}=="4162", SYMLINK+="libmtp-%k", MODE="770", GROUP="audio"
/lib/udev/rules.d/45-libnjb5.rules:# Creative Zen X-fi
/lib/udev/rules.d/45-libnjb5.rules-SYSFS{idVendor}=="041e", SYSFS{idProduct}=="4162", GROUP="plugdev", MODE="0770"

$ sudo /etc/init.d/udev restart

user@machine:~$ groupsuser adm dialout fax cdrom floppy tape audio dip video plugdev scanner fuse
The device numbers match what is in that post and what I see in lsusb or mtp-detect for the Creative Zen XiFi.

$ lsusb
Bus 001 Device 003: ID 041e:4162 Creative Technology, Ltd

$ sudo mtp-detect
libmtp version: 0.3.0
Device 0 (VID=041e and PID=4162) is UNKNOWN.
   Found 1 device(s):
   041e:4162 @ bus 0, dev 3
*** and loads more stuff ***


script in /usr/local/bin/zen

Santa Claus is creating this script.


if [[ "$1" == "stop" ]] ; then
 # to unmount:
 fusermount -u /mnt/Zen-Xfi
 mtpfs /mnt/Zen-Xfi -o allow_other
 nautilus /mnt/Zen-Xfi/ &

# $ sudo mtp-detect >> notes-creative-zen

# I have not quite  yet figured out mounting without root
# setup one-time only:
#sudo mkdir /mnt/Zen-Xfi
#sudo chmod 777 /mnt/Zen-Xfi
#sudo vi /etc/fuse.conf
#   and comment-in user_allow_other  (and restart fuse presumably or linux easier for me to say in blog mode)

No comments: