the solution :
You can put a usermap in /etc/hotplug/usb/ which causes
particular devices (distinguished by its manufacturer & device ids) to run a custom
script when they get plugged in.
/etc/hotplug/usb/usbcam.usermap for my CANON Digital IXUS 400 camera:
# Canon digital IXUS 400
usbcam 0x0003 0x04a9 0x3075 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00 0x00 0x00000000
The first field refers to a script, /etc/hotplug/usb/usbcam that gets executed on hotplug events.
#!/bin/sh
/usr/bin/logger -p kern.info "e-circ: usb-camera event, device=${DEVICE}, action=${ACTION}"
case "${ACTION}" in
"add")
/bin/chmod a+w ${DEVICE}
;;
*)
;;
esac
It appears that only the add event is passed to this scipt.
The documentation refers to this method as
#
# used to run config scripts for user mode drivers (jPhoto, gPhoto2,
# rio500 tools, etc) ... instead of naming kernel modules, it names
# config scripts. those could change $DEVICE permissions, etc.
#
# for purely user mode drivers, scripts $HOTPLUG_DIR/usb/NAME should be
# installed with usermap files in $HOTPLUG_DIR/usb/NAME.usermap instead
# of continuing to use/modify $MAP_USERMAP
#