wok rev 22061

sane-backends/sane.cgi: add range values
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Oct 24 17:12:11 2019 +0200 (2019-10-24)
parents 8649e33c279c
children 7cfacc80d067
files fake-sane/stuff/fake:lexmark_nscan:libnet:SPECIFY_DEVICE.log fake-sane/stuff/sane-fake.log sane-backends/stuff/tazpanel/sane.cgi
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/fake-sane/stuff/fake:lexmark_nscan:libnet:SPECIFY_DEVICE.log	Thu Oct 24 17:12:11 2019 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +Usage: scanimage [OPTION]...
     1.5 +
     1.6 +Start image acquisition on a scanner device and write image data to
     1.7 +standard output.
     1.8 +
     1.9 +Parameters are separated by a blank from single-character options (e.g.
    1.10 +-d epson) and by a "=" from multi-character options (e.g. --device-name=epson).
    1.11 +-d, --device-name=DEVICE   use a given scanner device (e.g. hp:/dev/scanner)
    1.12 +    --format=pnm|tiff|png|jpeg  file format of output file
    1.13 +-i, --icc-profile=PROFILE  include this ICC profile into TIFF file
    1.14 +-L, --list-devices         show available scanner devices
    1.15 +-f, --formatted-device-list=FORMAT similar to -L, but the FORMAT of the output
    1.16 +                           can be specified: %d (device name), %v (vendor),
    1.17 +                           %m (model), %t (type), %i (index number), and
    1.18 +                           %n (newline)
    1.19 +-b, --batch[=FORMAT]       working in batch mode, FORMAT is `out%d.pnm' `out%d.tif'
    1.20 +                           `out%d.png' or `out%d.jpg' by default depending on --format
    1.21 +    --batch-start=#        page number to start naming files with
    1.22 +    --batch-count=#        how many pages to scan in batch mode
    1.23 +    --batch-increment=#    increase page number in filename by #
    1.24 +    --batch-double         increment page number by two, same as
    1.25 +                           --batch-increment=2
    1.26 +    --batch-print          print image filenames to stdout
    1.27 +    --batch-prompt         ask for pressing a key before scanning a page
    1.28 +    --accept-md5-only      only accept authorization requests using md5
    1.29 +-p, --progress             print progress messages
    1.30 +-n, --dont-scan            only set options, don't actually scan
    1.31 +-T, --test                 test backend thoroughly
    1.32 +-A, --all-options          list all available backend options
    1.33 +-h, --help                 display this help message and exit
    1.34 +-v, --verbose              give even more status messages
    1.35 +-B, --buffer-size=#        change input buffer size (in kB, default 32)
    1.36 +-V, --version              print version information
    1.37 +
    1.38 +Options specific to device `lexmark_nscan:libnet/SPECIFY_DEVICE':
    1.39 +  Scanner:
    1.40 +    --ip-address <string> [0.0.0.0]
    1.41 +        The IP address / hostname associated with this scan job.
    1.42 +  Profile Information:
    1.43 +    --user-name <string> [current]
    1.44 +        The user name associated with this scan job.
    1.45 +    --profile-name <string> [Scan_01]
    1.46 +        The profile name associated with this scan job.
    1.47 +  Image Settings:
    1.48 +    --content-type Text|Text/Graphics|Photo [Text/Graphics]
    1.49 +        Indicates the type of material to be scanned.
    1.50 +    --scan-resolution 75|150|200|300|400|600|1200dpi [150]
    1.51 +        The resolution of the scan job in dots per inch.
    1.52 +    --mode 1-bit Black & White|8-bit Grayscale|24-bit Color [1-bit Black & White]
    1.53 +        The color depth of the scan job.
    1.54 +    --content-source Black and White Laser|Color Laser|Inkjet Plain|Inkjet Glossy|Retail Photo|Photo|Magazine|Newspaper|Brochure|Auto/Other [Black and White Laser]
    1.55 +        Content Source.
    1.56 +    --original-size Letter|Executive|Legal|A3|A4|A5|A6|B4|B5|Tabloid|Folio|Statement|3x5 Photo|4x6 Photo|3.5x5 in|4x8 in|5x7 in|8x10 in|L|2L|Hagaki|9x13 cm|10x15 cm|10x20 cm|13x18 cm|20x25 cm|Business Card|Book Original|Auto Size|Mixed Size|Universal|Oficio (México)|Custom Scan Size 1|Custom Scan Size 2|Custom Scan Size 3|Custom Scan Size 4|Custom Scan Size 5|Custom Scan Size 6 [Letter]
    1.57 +        The size of the area to be scanned.
    1.58 +    --orientation Portrait|Landscape [Portrait]
    1.59 +        The orientation of the scan output.
    1.60 +    --scan-both-sides[=(yes|no)] [no]
    1.61 +        Scan both sides of the document.
    1.62 +    --scan-now[=(yes|no)] [no]
    1.63 +        Start scan operation immediately.
    1.64 +    --source Single Page|Multiple Pages [Single Page]
    1.65 +        Indicates the number of pages to be scanned.
    1.66 +  Advanced Settings:
    1.67 +    --brightness 1..9 (in steps of 1) [5]
    1.68 +        Adjusts the brightness setting for this scan.
    1.69 +    --contrast 0..5 (in steps of 1) [0]
    1.70 +        Adjusts the contrast setting used for this scan.
    1.71 +  Advance Imaging:
    1.72 +    --mirrorimage[=(yes|no)] [inactive]
    1.73 +        Scans the image then rotates it 180 degrees horizontally.
    1.74 +    --negativeimage[=(yes|no)] [inactive]
    1.75 +        Negative Image.
    1.76 +    --blankpageremoval[=(yes|no)] [inactive]
    1.77 +        Blank Page Removal.
    1.78 +    --colordropout None|Red|Green|Blue [None]
    1.79 +        Color Dropout.
    1.80 +    --colordropoutthreshold 0..254 (in steps of 1) [inactive]
    1.81 +        Color Dropout Threshold.
    1.82 +    --bkgremoval -4..4 (in steps of 1) [0]
    1.83 +        Background Removal.
    1.84 +    --reset [inactive]
    1.85 +        Resets advance imaging options to its default value.
    1.86 +
    1.87 +Type ``scanimage --help -d DEVICE'' to get list of all options for DEVICE.
    1.88 +
    1.89 +List of available devices:
    1.90 +    lexmark_nscan:libnet/SPECIFY_DEVICE lexmark_nscan:libnet/001122334455
     2.1 --- a/fake-sane/stuff/sane-fake.log	Thu Oct 24 16:03:15 2019 +0100
     2.2 +++ b/fake-sane/stuff/sane-fake.log	Thu Oct 24 17:12:11 2019 +0200
     2.3 @@ -1,1 +1,1 @@
     2.4 -fake-sane/fake:brother:bus1;dev2,[fake] Brother MFC-8420|fake-sane/fake:hpoj:mlc:usb:psc_1200_series,[fake] Hewlett-Packard psc 1200 series|fake-sane/fake:hpaio::usb:PSC_1600_series:serial=MY5CJF3044L0,[fake] hp PSC_1600_series|fake-sane/fake:brother:bus1;dev2.patched,[fake+patched] Brother MFC-8420|fake-sane/fake:hpoj:mlc:usb:psc_1200_series.patched,[fake+patched] Hewlett-Packard psc 1200 series|fake-sane/fake:pixma:04A91709,[fake] CANON PIXMA MP150|
     2.5 +fake-sane/fake:brother:bus1;dev2,[fake] Brother MFC-8420|fake-sane/fake:hpoj:mlc:usb:psc_1200_series,[fake] Hewlett-Packard psc 1200 series|fake-sane/fake:hpaio::usb:PSC_1600_series:serial=MY5CJF3044L0,[fake] hp PSC_1600_series|fake-sane/fake:brother:bus1;dev2.patched,[fake+patched] Brother MFC-8420|fake-sane/fake:hpoj:mlc:usb:psc_1200_series.patched,[fake+patched] Hewlett-Packard psc 1200 series|fake-sane/fake:pixma:04A91709,[fake] CANON PIXMA MP150|fake-sane/fake:lexmark_nscan:libnet:SPECIFY_DEVICE,[fake] Lexmark MB2236adw|
     3.1 --- a/sane-backends/stuff/tazpanel/sane.cgi	Thu Oct 24 16:03:15 2019 +0100
     3.2 +++ b/sane-backends/stuff/tazpanel/sane.cgi	Thu Oct 24 17:12:11 2019 +0200
     3.3 @@ -287,15 +287,23 @@
     3.4  cat "$(echo $device | sed 's/,.*//').log" 2> /dev/null ||
     3.5  scanimage --help -d "$(echo $device | sed 's/,.*//')"
     3.6  } | dos2unix | sed 's|\[=| [|;s/||/|/g' | awk '
     3.7 +function unit(s)
     3.8 +{
     3.9 +	if (match(s,/[0-9]*mm$/) || match(s,/[0-9]*mm /)) u="mm"
    3.10 +	else if (match(s,/[0-9]*%$/) || match(s,/[0-9]*% /)) u="%"
    3.11 +	else if (match(s,/[0-9]*dpi$/) || match(s,/[0-9]*dpi /)) u="dpi"
    3.12 +	else u="none"
    3.13 +}
    3.14 +
    3.15  function minmax()
    3.16  {
    3.17  	inactive=1
    3.18  	if (match($2,"[0-9]")) {
    3.19  		i=$2; sub(/\.\..*/,"",i)
    3.20  		j=$2; sub(/.*\.\./,"",j)
    3.21 -		sub(/\..*/,"",j); sub(/[dm%].*/,"",j)
    3.22 +		unit(j); sub(/\..*/,"",j); sub(/[dm%].*/,"",j)
    3.23  		k=$0; sub(/.* \[/,"",k); sub(/\].*/,"",k)
    3.24 -		printf("\n%s",$1 " " int(k) " " int(i) " " int(j))
    3.25 +		printf("\n%s",$1 " " int(k) " " int(i) " " int(j) " " u)
    3.26  		inactive=0
    3.27  	}
    3.28  }
    3.29 @@ -306,12 +314,12 @@
    3.30  	inactive=1
    3.31  	if (index(i,"|")) {
    3.32  		sub(/^ *--*[a-z-]* */,"",i)
    3.33 -		sub(/\[\(/,"",i); sub(/\)\]/,"",i)
    3.34 +		sub(/\[\(/,"",i); sub(/\)\]/,"",i); unit(i)
    3.35  		sub(/dpi .*/,"",i); gsub(/ \[.*\].*/,"",i)
    3.36  		k=$0; sub(/.* \[/,"",k); sub(/\].*/,"",k)
    3.37  		gsub(/ /,"=",k)
    3.38  		gsub(/ /,"=",i)
    3.39 -		printf("\n%s",$1 " " k " enum " i)
    3.40 +		printf("\n%s",$1 " " k " enum " i " " u)
    3.41  		inactive=0
    3.42  	}
    3.43  	else minmax()
    3.44 @@ -321,23 +329,26 @@
    3.45  	if (/scanimage --help/) end=1
    3.46  	if (end != 0) next
    3.47  	if (/:$/) parse=0
    3.48 -	if (/Scan mode/ || /Mode/ || /Advanced/ || /Geometry/) parse=1
    3.49 +	if (/[Mm]ode/ || /[Aa]dvanced/ || /[Gg]eometry/) parse=1
    3.50 +	if (/brightness/ || /contrast/ || /orientation/) parse=1
    3.51  	if (parse != 1) next
    3.52  	if (/\[inactive\]/) { inactive=1; next }
    3.53 -	if (match("-l-t-x-y", $1)) minmax()
    3.54 +	if (/[0-9]\.\.[0-9]/) minmax()
    3.55  	else if (/^    --/) enum()
    3.56  	else if (!/:$/ && inactive == 0) printf(" %s",$0)
    3.57  } END { print "" }
    3.58  ' | sed 1d)"
    3.59  fi
    3.60  output="$(n=$(echo "$params" | wc -l); echo "$params" | \
    3.61 -while read name def min max help; do
    3.62 +while read name def min max unit help; do
    3.63  	name="${name#-}"
    3.64  	name="${name#-}"
    3.65  	name="${name//-/_}"
    3.66  	help="$(echo $help | sed 's|  | |g;s|"|\&#34|g')"
    3.67  	def="${def//=/ }"
    3.68  	max="${max//=/ }"
    3.69 +	[ "$unit" = "none" ] && unit=""
    3.70 +	[ "$name" ] || continue
    3.71  	if [ "$min" == "enum" ]; then
    3.72  		res_min=1000000
    3.73  		res_max=0
    3.74 @@ -357,13 +368,16 @@
    3.75  			fi
    3.76  			shift
    3.77  		done
    3.78 -		echo "</select>"
    3.79 +		echo "</select>&nbsp;$unit"
    3.80  	else
    3.81  		[ "$(xPOST $name)" ] && def=$(xPOST $name)
    3.82  		[ $def -lt $min ] && def=$min
    3.83  		[ $def -gt $max ] && def=$max
    3.84 -		f="<fieldset><legend>$(_ "$name")</legend><input type=\"range\" min=\"$min\" max=\"$max\" name=\"$name\" value=\"$def\""
    3.85 -		u=""
    3.86 +		[ "$idrange" ] || idrange=1
    3.87 +		f="<fieldset><legend>$(_ "$name")</legend>
    3.88 +<input type=\"range\" id=\"range$idrange\" min=\"$min\" max=\"$max\" 
    3.89 +name=\"$name\" value=\"$def\" onchange=\"updaterange(this)\""
    3.90 +		u="<div id=\"range$((idrange++))val\">$def${unit+&nbsp;$unit}</div>"
    3.91  		case "$name" in
    3.92  		x|y|l|t) cat <<EOT
    3.93  :${name}_max=$max
    3.94 @@ -374,7 +388,7 @@
    3.95  				[ "$name" == "$name2" ] || continue
    3.96  				[ "$(xPOST geometry_$name)" ] &&
    3.97  				val="$(xPOST geometry_$name)"
    3.98 -				f="<fieldset><legend>$(_ "$n2")</legend><input name=\"geometry_$name\" id=\"$id\" value=\"$val\""
    3.99 +				f="<fieldset><legend>$(_ "$n2")</legend><input type=\"text\" name=\"geometry_$name\" id=\"$id\" value=\"$val\""
   3.100  				u="&nbsp;mm"
   3.101  				break
   3.102  			done <<EOT
   3.103 @@ -385,7 +399,7 @@
   3.104  EOT
   3.105  		esac
   3.106  		[ "$name" == "resolution" ] && f="$f onchange=showGeometry()"
   3.107 -		echo "<td>$f type=\"text\" title=\"$min .. $max. $help\" size=5 maxlength=5>$u"
   3.108 +		echo "<td>$f title=\"$min .. $max. $help\" size=5 maxlength=5>$u"
   3.109  		res_min=$min
   3.110  		res_max=$max
   3.111  	fi
   3.112 @@ -393,10 +407,9 @@
   3.113  	resolution) cat <<EOT
   3.114  <input type="hidden" name="res_min" value="$res_min">
   3.115  <input type="hidden" name="res_max" value="$res_max">
   3.116 -&nbsp;dpi
   3.117  EOT
   3.118  	esac
   3.119 -	echo "</filedset></td>"
   3.120 +	echo "</fieldset></td>"
   3.121  	n=$(($n - 2))
   3.122  	case "$n" in
   3.123  	1|2) echo "</tr><tr>"
   3.124 @@ -430,6 +443,11 @@
   3.125      alert((Math.round(x * y / 100000)/10) + ' Mpixels\n' + x + 'x' + y);
   3.126    }
   3.127  }
   3.128 +
   3.129 +function updaterange(r) {
   3.130 +  var e=document.getElementById(r.id+"val")
   3.131 +  if (e) e.innerHTML=e.innerHTML.replace(/[0-9]*/,r.value)
   3.132 +}
   3.133  -->
   3.134  </script>
   3.135