With reference to the question about usb scanners and permissions (credit
to http://gentoo-wiki.com/HOWTO_Installing_USB_Scanner)

Gentoo does not have an automatic way of setting up scanner permissions -
maybe this should be moved to the official docs??:


# /etc/init.d/usbscanner
#!/sbin/runscript

depend() {
       need modules
       after coldplug
}

scan_proc() {
#       vendor=04b8
       vendor=0x04a9
       product=0x2208
       group=scanner
       line=`sane-find-scanner -q | grep -i ${vendor} | grep -i ${product}`
       line=`echo ${line} | sed -r 's/:/\n/'| sed -r 's/:/\n/'| sed 1d `
       bus=`echo ${line} | sed 's/\ /\n/' | sed 2d `
       device=`echo ${line} | sed 's/\ /\n/' | sed 1d `
       cd /proc/bus/usb/$bus
}

start() {
       scan_proc
       if [ ! "${bus}" = "" ]; then
         ebegin "Setting User-Rights for USB-Scanner at bus ${bus}, device
${device}"
         chown root:${group} ${device}
         chmod g+w ${device}
       else
         ebegin "USB-Scanner not connected"
       fi
       eend $?
}

stop() {
       scan_proc
       if [ ! "${bus}" = "" ]; then
         ebegin "Setting USB-Scanner Rights back to default"
         chown root:root ${device}
         chmod g-w  ${device}
       else
         ebegin "USB-Scanner is not connected - stopping service"
       fi
       eend $?
}

restart() {
        svc_stop
        svc_start
}

--
gentoo-user@gentoo.org mailing list

Reply via email to