i hate those camera gui's for getting pictures downloaded. this is
what i use for my camera (a sony cybershot u) to have it automagically
download all the pictures off my camera. it's a script that lives in
/etc/hotplug/usb/usb-storage . it does the following:
it mounts the camera
makes sure it's my camera
copies the files (and gives them proper extensions, jpeg and mpeg)
to ~/camera/
unmounts the camera
tells hotplug to rmmod the usb-storage modules when the camera
disconnects
echos three beeps to the console
not sure if people will find it handy, but i do. all i do to grab all
the pix is plug the camera in and plug it out after i hear three beeps.
kevin
#!/bin/sh
logger -t usb-storage "Starting"
case x"$ACTION" in
xadd)
# from usb/usbcam
# new code, using GNU style parameters
if [ -f /var/run/console.lock ]; then
CONSOLEOWNER=`cat /var/run/console.lock`
elif [ -f /var/lock/console.lock ]; then
CONSOLEOWNER=`cat /var/lock/console.lock`
else
logger -t usb-storage No console owner found
exit
fi
if [ -d /home/$CONSOLEOWNER/camera ]; then
logger -t usb-storage "Mounting camera"
su $CONSOLEOWNER -c "mount /mnt/camera" || exit
if [ ! -f /mnt/camera/memstick.ind ]; then
logger -t usb-storage Not a memory stick
umount /mnt/camera
exit
fi
logger -t usb-storage "Camera mounted, copying files"
su $CONSOLEOWNER \
-c "find /mnt/camera/dcim -type f -print0 |
xargs -0i mv '{}' /home/$CONSOLEOWNER/camera"
su $CONSOLEOWNER \
-c "rename .jpg .jpeg /home/$CONSOLEOWNER/camera/*.jpg;
rename .mpg .mpeg /home/$CONSOLEOWNER/camera/*.mpg;
chmod 644 /home/$CONSOLEOWNER/camera/*.?peg"
umount /mnt/camera
echo -e '\007' > /dev/console; sleep 1
echo -e '\007' > /dev/console; sleep 1
echo -e '\007' > /dev/console
else
logger -t usb-storage "Console owner doesn't have a ~/camera dir"
fi
test -d /var/run/usb || mkdir /var/run/usb
( echo '#!/bin/sh' ; echo rmmod usb-storage ) > $REMOVER
chmod 755 $REMOVER
;;
esac
logger -t usb-storage "Finishing"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.linux.ie/pipermail/ilug/attachments/20040531/82abbf3d/attachment.pgp
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!