Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Alexander_Naumov:SLE12
sane-backends
create_hpaio.desc_from_models.dat
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File create_hpaio.desc_from_models.dat of Package sane-backends
#! /bin/bash # # Johannes Meixner <jsmeix@suse.de>, 2008 #set -x export PATH="/sbin:/usr/sbin:/usr/bin:/bin" export LC_ALL="POSIX" export LANG="POSIX" umask 022 MY_NAME=${0##*/} # Input: # Create a temporary file: TMP_DATA=$(mktemp -u /tmp/$MY_NAME.XXXXXX) || { echo "Error: Failed to make a temporary file /tmp/$MY_NAME.XXXXXX" 1>&2 ; exit 1 ; } # Get the raw data: egrep '^\[|^model[1-9]*|^scan-type|^usb-pid' | sed -e 's/^\[\(.*\)\]$/class=\1/' -e 's/ /_/g' -e 's/=/ /' >$TMP_DATA # Output: # Output header: echo ':backend "hpaio"' echo ':version "3.9.8"' echo ':url "http://hplipopensource.com"' echo ':comment "This backend is not included in SANE because it is included in the HPLIP software."' echo ':devicetype :scanner' echo ':mfg "Hewlett-Packard"' echo ':url "http://www.hp.com/united-states/consumer/gateway/printing_multifunction.html"' echo # Add a generic entry (the "Any" with capital 'A' lets it appear at the top of YaST's sorted list): # This USB ID ("0x03f0" "0x0000") is used as fallback by the YaST scanner autodetection # via /usr/lib/YaST2/bin/autodetect_scanners which calls "hp-probe -busb -escan" # because hp-probe does not show the USB ID. With this USB ID the generic entry matches # to any autodetected HPLIP USB all-in-one device (the "-escan" excludes plain printers) # so that the usually right driver (hpaio) can be preselected by YaST. # Nevertheless, to be on the safe side, the support status is set to "untested". echo ':model "Any all-in-one device"' echo ':usbid "0x03f0" "0x0000"' echo ':status :untested' echo ':comment "fallback entry for HP all-in-one devices"' echo # Function to unify a model name: Unify() { MODEL=$( echo $MODEL | sed -e 's/hp_//i' -e 's/Aii-in-One/all-in-one/i' ) for w in LaserJet Mopier DeskJet Business Inkjet Officejet Photosmart PSC Printer Scanner Copier DJ CP CM MFP Apollo series Color all-in-one do MODEL=$( echo $MODEL | sed -e "s/$w/$w/i" ) done } # Function to output one model entry: Output() { if [ -n "$CLASS" -a ! "0" = "$TYPE" ] then UNIFIEDMODELS="" for MODEL in $( echo $MODELS ) do Unify UNIFIEDMODELS=$( echo $UNIFIEDMODELS $MODEL ) done UNIFIEDMODELS=$( echo $UNIFIEDMODELS | tr ' ' '\n' | sort -u | tr '\n' ' ' ) for MODEL in $( echo $UNIFIEDMODELS ) do MODEL=$( echo $MODEL | sed -e "s/_/ /g" ) echo ":model \"$MODEL\"" if echo "$ID" | grep -q '[1-9a-f]' then if echo "$ID" | grep -q '^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]$' then echo ":usbid \"0x03f0\" \"0x$ID\"" else if echo "$ID" | grep -q '^[0-9a-f][0-9a-f][0-9a-f]$' then echo ":usbid \"0x03f0\" \"0x0$ID\"" else if echo "$ID" | grep -q '^[0-9a-f][0-9a-f]$' then echo ":usbid \"0x03f0\" \"0x00$ID\"" else if echo "$ID" | grep -q '^[1-9a-f]$' then echo ":usbid \"0x03f0\" \"0x000$ID\"" fi fi fi fi fi echo ':status :good' echo done fi } # Output model entries: CLASS="" exec <$TMP_DATA while read KEY VALUE do case "$KEY" in class) Output ID="" TYPE="0" CLASS="$VALUE" MODELS="$CLASS" ;; model*) MODELS=$( echo $MODELS $VALUE ) ;; scan-type) TYPE="$VALUE" ;; usb-pid) ID=$( echo "$VALUE" | tr '[:upper:]' '[:lower:]' ) ;; *) echo "Ignoring key $KEY" 1>&2 ;; esac done # Remove the temporary file rm $TMP_DATA exit 0
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor