Re: sane/hp backend

Peter Kirchgessner (pkirchgessner@t-online.de)
Sat, 02 Jan 1999 21:00:37 +0100

Radka Turcajova wrote:
>
> Hi,
> I was anxious to try out the new version (0.72 as of Dec 25) of the
> hp backend with my Photosmart R032. I downloaded the sources,
> untar'ed them into the source tree (sane 1.0.0 as found at
> http://www.mostang.com/sane). Everyhting seems to have compiled
> OK as far as I can tell (Linux, Red Hat 5.0). scaimage -L gives
> a list of devices and finds the scanner. But, for example,
> scanimage --help -d hp:/dev/scanner gives a segmentation fault
> as does any attempt to scan.
> Usage: scanimage [OPTION]...
>
> Start image acquisition on a scanner device and write PNM image data to
> standard output.
>
> -d, --device-name=DEVICE use a given scanner device
> -h, --help display this help message and exit
> -L, --list-devices show available scanner devices
> -v, --verbose give even more status messages
> -V, --version print version information
> Segmentation fault
>
> Any ideas what is going wrong. I realize this is very little info
> to possibly track it down, but maybe you have encountered this.
> Thanks a lot,
> Radek Tezaur

Hi Radek,

I found the problem. It occurs when starting (x)scanimage with a device
name
like hp:/dev/scanner and/or the device is not defined in hp.conf.
Please apply the following patch to hp.c:

--- hp.c.orig Fri Dec 25 19:46:57 1998
+++ hp.c Sat Jan 2 20:27:46 1999
@@ -268,12 +268,16 @@
sanei_hp_device_info_get (const char *devname)

{
- HpDeviceInfoList *infolist = &(global.infolist);
+ HpDeviceInfoList *infolist;
HpDeviceInfoList infolistelement;
HpDeviceInfo *info;
+ int retries = 1;

if (!global.is_up) return 0;

+ do
+ {
+ infolist = &(global.infolist);
while (*infolist)
{
infolistelement = *infolist;
@@ -284,6 +288,15 @@
}
infolist = &(infolistelement->next);
}
+
+ /* No configuration found. Assume default */
+ DBG(1, "hp_device_info_get: device %s not configured. Using
default\n",
+ devname);
+ if (hp_device_config_add (devname) != SANE_STATUS_GOOD)
+ return 0;
+ }
+ while (retries-- > 0);
+
return 0;
}

@@ -627,12 +640,13 @@
HpDevice dev = 0;
HpHandle h;

+ RETURN_IF_FAIL( hp_read_config() );
+
if (devicename[0])
RETURN_IF_FAIL( hp_get_dev(devicename, &dev) );
else
{
/* empty devicname -> use first device */
- RETURN_IF_FAIL( hp_read_config() );
if (global.device_list)
dev = global.device_list->dev;
}

-- 
Peter Kirchgessner
WWW:    http://www.kirchgessner.net
e-mail: peter@kirchgessner.net

--
Source code, list archive, and docs: http://www.mostang.com/sane/
To unsubscribe: echo unsubscribe sane-devel | mail majordomo@mostang.com