/dev/usb/lp* einem Drucker zuordnen
Hallo,
ich, Debian/Stable, lese einmal am Tag die Füllstände der Druckerpatronen
aus und schreibe sie in eine Datenbank:
Dazu greife ich auf /dev/usb/lp1 zu.
Mein Drucker ist üblicherweise /dev/usb/lp1, weil /dev/usb/lp0 dauerhaft von
einem Parallel-USB-Adapter belegt ist.
Aber mir wäre es lieber, ich könnte das irgendwie abfragen. Aber wie?
Woher weiß ich, auf welchen Drucker /dev/usb/lp1 verweist?
Danke für alle Hinweise und Tips.
Ciao
Peter Schütt
P.S. Wen es interessiert, hier ist das Skript, dass per Cron-Job einmal am
Tag aufgerufen wird.
#!/bin/sh
LP=/dev/usb/lp1
if [ ! -e $LP ]; then
exit
fi
TYPE=`escputil -q -d -r $LP`
echo "Found type: "$TYPE
if [ "$TYPE" != "EPSON WF-3010 Series" ]; then
exit
fi
for I in 1 2
do
OUTPUT=`escputil -i -r $LP | grep -A 4 Schwarz`
# Sometimes ttink produces rubbish on the printer.
# OUTPUT=`ttink -s -d $LP | grep -A 4 Schwarz`
if [ "$OUTPUT" != "" ]; then
break
fi
done
echo $LP : $TYPE : $OUTPUT
if [ "$OUTPUT" = "" ]; then
exit ;
fi
# ttink: Schwarz : 51 % Cyan : 44 % Magenta : 44 % Gelb : 40 %
# escputils: Foto-Schwarz 18 Magenta 59 Gelb 100 Cyan 93
# blackName=`echo $OUTPUT | cut -d ' ' -f 1`
blackName=Schwarz
black=`echo $OUTPUT | cut -d ' ' -f 2`
cyanName=cyan
cyan=`echo $OUTPUT | cut -d ' ' -f 4`
magentaName=magenta
magenta=`echo $OUTPUT | cut -d ' ' -f 6`
yellowName=gelb
yellow=`echo $OUTPUT | cut -d ' ' -f 8`
PARAMS="epsonwf3010 $blackName:Integer=$black $cyanName:Integer=$cyan
$magentaName:Integer=$magenta $yellowName:Integer=$yellow"
echo $PARAMS
# calls a simple java program which writes the params
# into a postgresql table
/opt/dbcollector/calldbcollect.sh $PARAMS
Reply to: