Code: Select all
#!/bin/sh
COMMOUT="`cat /etc/sane.d/dll.conf | grep '^#[a-zA-Z0-9]' | tr '#' ' ' | tr '\n' ' '`"
xmessage -bg "orange" -center -title "Frontend for Xsane" -buttons "USB:10,Parallel:11,SCSI:12,NETWORK:13,QUIT:20" "NOTE:
The list of supported drivers is in text file /etc/sane.d/dll.conf
When Xsane starts, your scanner (if it is connected and turned on)
should be autodetected. However, some entries in 'dll.conf' are
commented-out. Here is the list of SANE drivers that are commented
-out in file 'dll.conf':
$COMMOUT
If your scanner is one of these, then Xsane will not auto-detect it.
-- in that case, click 'QUIT' button and open 'dll.conf' in a text
editor and uncomment the appropriate entry.
Xsane may be a bit 'insane' when detecting a SCSI scanner. There are
various things that you may have to do:
1. Run 'sane-find-scanner' in a terminal window.
2. Make sure 'sg' module is loaded.
3. Specify the device on the commandline, ex: # xsane microtek2:/dev/sg3
4. or maybe a symbolic link, ex: # ln -s /dev/sg3 /dev/scanner
To continue and run Xsane, answer this question:
Do you have a parallel-port, USB, Network, or SCSI scanner?"
RETVAL=$?
case $RETVAL in
10)
#modprobe scanner
#2.6 kernel does not have module 'scanner'. instead relies on libusb.
echo
;;
11)
modprobe parport_pc
;;
12)
modprobe sg
;;
13)
mkdir -p ~/.config/xsaneshell/
lpstat -t | grep 'device for ' | grep ' socket://' | sed 's/device\ for\ //' | cut -f 1 -d ':' > ~/.config/xsaneshell/device
lpstat -t | grep 'device for ' | grep ' socket://' | sed 's/device\ for\ //' | cut -f 3 -d ':' | cut -f 3 -d '/' > ~/.config/xsaneshell/ip
exec xsane :/net/`cat ~/.config/xsaneshell/device`?ip=`cat ~/.config/xsaneshell/ip` &
exit
;;
*)
exit
;;
esac
sleep 1
exec xsane