Commit 9c335a5d authored by Henning Geinitz's avatar Henning Geinitz

2000-11-16 Henning Meier-Geinitz <hmg@gmx.de>

	* TODO: Entries about SANE_DEFAULT_DEVICE and DBG output.

	* src/xscanimage.c: Added suport for DBG messages. Added only a
	  few messages including a more verbose output when xscanimage
	  can't find any devices. Added support for SANE_DEFAULT_DEVICE.

	* doc/xscanimage.man: Documented support for SANE_DEFAULT_DEVICE and
	  SANE_DEBUG_XSCANIMAGE.
parent 0f4ed817
TODO (2000-11-14)
TODO (2000-11-16)
******** todo ********
......@@ -52,6 +52,10 @@ TODO (2000-11-14)
is wrong, as we have to specify one value for each channel (i.e for a
24bit RGB pic we must specify 8,8,8, see TIFF6.0 spec, [...]
* Add support for SANE_DEFAULT_DEVICE to xcam (see (x)scanimage).
* Add/improve debug output for xscanimage and xcam.
******** done ********
* xcam: if the user quits xcam by the window manager, the process isn't
......
.TH xscanimage 1 "11 Aug 2000"
.TH xscanimage 1 "16 Nov 2000"
.IX xscanimage
.SH NAME
xscanimage - scan an image
......@@ -29,10 +29,11 @@ Now Easy) interface. The list of available devices depends on
installed hardware and configuration. When invoked without an
explicit devicename argument,
.B xscanimage
presents a dialog listing all known and available devices. To access
an available device that is not known to the system, the devicename
must be specified explicitly. The format of devicename is
backendname:devicefile (eg umax:/dev/sga).
presents a dialog listing of all known and available devices. To access an
available device that is not known to the system, the devicename must be
specified explicitly. Another way to select a device is to set the
environment variable SANE_DEFAULT_DEVICE to devicename. The format of
devicename is backendname:devicefile (eg umax:/dev/sga).
.SH RUNNING UNDER THE GIMP
To run
.B xscanimage
......@@ -97,6 +98,24 @@ The
.B --sync
flag requests a synchronous connection with the X11 server. This is for
debugging purposes only.
.SH ENVIRONMENT
.TP
.B SANE_DEFAULT_DEVICE
The default device-name. Example: SANE_DEFAULT_DEVICE="hp:/dev/scanner"
.TP
.B SANE_DEBUG_XSCANIMAGE
This environment variable controls the debug level xscanimage. Higher
debug levels increase the verbosity of the output.
Value Descsription
0 print fatal errors
1 print errors
2 print warnings
3 print information messages
4 print everything
Example:
SANE_DEBUG_XSCANIMAGE=3
.SH FILES
.TP
.I $HOME/.sane/xscanimage/xscanimage.rc
......
......@@ -45,6 +45,9 @@
#include <sane/saneopts.h>
#include "../include/sane/sanei.h"
#define BACKEND_NAME xscanimage
#include "../include/sane/sanei_debug.h"
#include <progress.h>
#include <preferences.h>
#include <preview.h>
......@@ -64,6 +67,12 @@
#define GIMP_ENABLE_COMPAT_CRUFT
#include <libgimp/gimp.h>
#define DBG_fatal 0
#define DBG_error 1
#define DBG_warning 2
#define DBG_info 3
#define DBG_debug 4
static void query (void);
static void run (char *name, int nparams, GParam * param,
int *nreturn_vals, GParam ** return_vals);
......@@ -468,6 +477,7 @@ quit_xscan (void)
if (scan_win.mode == SANE_GIMP_EXTENSION)
gimp_quit ();
#endif
DBG(DBG_debug, "xscanimage exiting.\n");
exit (0);
}
......@@ -1600,6 +1610,7 @@ init (int argc, char **argv)
{
char filename[PATH_MAX];
struct stat st;
const char *defdevname;
gtk_init (&argc, &argv);
#ifdef HAVE_LIBGIMP_GIMP_H
......@@ -1659,6 +1670,21 @@ init (int argc, char **argv)
seldev = 0;
}
}
else if ((defdevname = getenv("SANE_DEFAULT_DEVICE")) != NULL)
{
static SANE_Device dev;
static const SANE_Device *device_list[] = { &dev, 0 };
memset (&dev, 0, sizeof (dev));
dev.name = defdevname;
dev.vendor = "Unknown";
dev.type = "unknown";
dev.model = "unknown";
devlist = device_list;
seldev = 0;
DBG (DBG_info, "default device is `%s'\n", defdevname);
}
if (seldev < 0)
sane_get_devices (&devlist, SANE_FALSE);
......@@ -1701,7 +1727,11 @@ interface (int argc, char **argv)
}
else
{
fprintf (stderr, "%s: no devices available.\n", prog_name);
DBG (DBG_fatal, "No scanners were identified. If you were expecting something\n"
" different, check that the scanner is plugged in, turned on and\n"
" detected by the find-scanner tool (if appropriate). Please read\n"
" the documentation which came with this software (README, FAQ,\n"
" manpages).\n");
quit_xscan ();
}
}
......@@ -1713,6 +1743,9 @@ interface (int argc, char **argv)
int
main (int argc, char **argv)
{
DBG_INIT();
DBG(DBG_error, "xscanimage (version: %s, package: %s) starting\n", VERSION,
PACKAGE);
scan_win.mode = STANDALONE;
gtk_quit_flag = 0;
prog_name = strrchr (argv[0], '/');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment