[sane-devel] Proposals for scanimage and sane-find-scanner

abel deuring a.deuring@satzbau-gmbh.de
Thu, 10 Jan 2002 20:22:34 +0100


Klaas Freitag wrote:
> 
> hello,
> 
> I like to propose two small patches to the sane utilities scanimage and
> sane-find-scanner, which do some minor changes to the output of both tools.
> Please add it to cvs if you like.
> 

Klaas,

I like the idea. But perhaps we could add only one option (let's call it
"-f"), which would need a format parameter, like so:

for the same output as from scanimage -L:

   scanimage -f="device '%d' is a %v %m %t"

to get the same output as with your proposal for scanimage -s:

   scanimage -f='"%d" "%v" "%m" "%t"'

to get the same output as with your variant "scanimage -S":

   scanimage -f='DEVICE_FILE[%i]='%s'; DEVICE_VENDOR[%i]="%v";
DEVICE_MODEL[%i]="%m"; DEVICE_TYPE[%i]="%t"'

This would allow not only eval usage with bash, but might make scripting
with other languages easier too.

Abel

> The change to scanimage does nothing else but changes the output format
> of the results of scanimage -L. While scanimage -L would for example
> print
> device `umax:/dev/sg0' is a UMAX     Astra 2200       flatbed scanner
> 
> scanimage -s prints
> "umax:/dev/sg0" "UMAX    " "Astra 2200      " "flatbed scanner"
> 
> and scanimage -S prints
> DEVICE_FILE[0]="umax:/dev/sg0"; DEVICE_VENDOR[0]="UMAX    "; \
> DEVICE_MODEL[0]="Astra 2200      "; DEVICE_TYPE[0]="flatbed scanner"
> 
> both are easily to parse in shell scripts, scanimage -S produces bash
> syntax directly.
> 
> A quite similar change I would propose for sane-find-scanner:
> A switch -s switches sane-find-scanner to silent mode, which produces
> a more compressed output:
> 
> /space/temp/sane:$ sane-find-scanner -s
> /dev/sg0 SCSI "scanner" "UMAX" "Astra 2200"
> 
> Both changes were done to make development of graphical installation
> tools for sane easier, because scanimage can be used to detect scanners
> already configured with sane, while sane-find-scanner is able to print
> out scan devices not yet configured for sane.
> 
> Regards,
> 
> Klaas
> 
> -- 
>  ----------------------------------------------------------------------
>  Ja mach nur einen Plan und sei ein grosses Licht         Klaas Freitag
>  dann mach noch einen zweiten Plan    *            mail freitag@suse.de
>  gehn tun sie beide nicht. - B. Brecht             SuSE Labs, Nuernberg
>  ----------------------------------------------------------------------
> 
>   ------------------------------------------------------------------------
>                               Name: sane-backends-1.0.6.dif
>    sane-backends-1.0.6.dif    Type: Plain Text (TEXT/PLAIN)
>                           Encoding: BASE64