Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Factory:Rebuild
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 normalize model names: Normalize() { MODELS=$( echo $MODELS | sed -e 's/hp_//ig' -e 's/Aii-in-One/all-in-one/ig' ) 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 MODELS=$( echo $MODELS | sed -e "s/$w/$w/ig" ) done } # Function to output one model entry: Output() { if [ "$TYPE" -gt "0" ] then Normalize UNIFIEDMODELS=$( echo $MODELS | tr ' ' '\n' | sort -u | tr '\n' ' ' ) ID=$(( "0x$ID" )) for MODEL in $( echo $UNIFIEDMODELS ) do MODEL=$( echo $MODEL | sed -e "s/_/ /g" ) echo ":model \"$MODEL\"" if [ "$ID" -gt "0" ] ; then printf ":usbid \"0x03f0\" \"0x%.4x\"\n" $ID ; fi echo ':status :good' echo done fi } # Output model entries: TYPE="0" exec <$TMP_DATA while read KEY VALUE do case "$KEY" in class) Output ID="0" TYPE="0" MODELS="$VALUE" ;; model*) MODELS=$( echo $MODELS $VALUE ) ;; scan-type) TYPE="$VALUE" ;; usb-pid) ID="$VALUE" ;; *) 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