Re: [Hp5400backend-devel] Trouble with driver: Segmentation fault
Status: Alpha
Brought to you by:
soumarmt
From: Thomas S. <tho...@co...> - 2003-06-02 15:08:24
|
Hi,=20 you may try adding the following line at the begiinning of the=20 hp5400_internal.c file : #define NO_STRING_VERSION_MATCH A cleaner thing would be to have the -DNO_STRING_VERSION_MATCH added to the= =20 compilation line, but I don't know how to do it with the SANE configure=20 program. Explanation : In the C compiler command (something like "cc OPTION= S=20 file.c"), the -DNO_STRING_VERSION_MATCH would define NO_STRING_VERSION_MATC= H=20 in the compilng process and then avoid compiling the version string match=20 process. The segmentation fault could be caused by following actions : * scanner is recognized by its USB identification * scanner is disconnected because it has not a known version string * scanner is accessed after disconnection =3D> seg fault It is just a guess. Tell us if it works after that modification. Thank you for your report, Thomas. Le Lundi 2 Juin 2003 14:30, Lilith a =E9crit : > Hi, > > Thank you for for putting the work in on this driver. I've tried to list > everything I think you'll need to help resolve this: > > I've complied sane-backends-1.0.12 on RH8, but my hp5400 scanner is not > being recognised by scanimage or xsane: > > scanimage -L > No scanners were identified. If you were expecting something different, > check that the scanner is plugged in, turned on and detected by the > sane-find-scanner tool (if appropriate). Please read the documentation > which came with this software (README, FAQ, manpages). > > sane-find-scanner -q > found USB scanner (vendor=3D0x03f0, product=3D0x1005) at /dev/usb/scanner0 > found USB scanner (vendor=3D0x03f0 [Hewlett-Packard], product=3D0x1005 [HP > Scanjet 5400C Series]) at libusb:002:002 > > dll.conf contains hp5400 > > hp5400.conf > # HP 5400C > usb 0x03F0 0x1005 > # > # Device filename to use for scanner access > /dev/usb/scanner0 > (I have tried commenting out 'usb 0x03F0 0x1005' and changing it to 'usb > 0x3F0 0x1005) > > dmesg stuff > hub.c: new USB device 00:1f.4-1, assigned address 2 > usb.c: USB device 2 (vend/prod 0x3f0/0x1005) is not claimed by any > active driver. > Adding Swap: 3068404k swap-space (priority -1) > usb.c: registered new driver usbscanner > scanner.c: USB scanner device (0x03f0/0x1005) now attached to scanner0 > scanner.c: 0.4.12:USB Scanner Driver > scanner.c: probe_scanner: User specified USB scanner -- Vendor:Product - > 3f0:1005 > > SANE_DEBUG_HP5400=3D255 scanimage -d hp5400 > [sanei_debug] Setting debug level of hp5400 to 255. > [hp5400] sane_init: SANE hp5400 backend version 1.0-2 (from > sane-backends 1.0.12) > [hp5400] Reading config file > [hp5400] Trying to attach /dev/usb/scanner0 > [hp5400] vendor/product 0x03F0-0x1005 opened > [hp5400] Read: reqtype =3D 0xC0, req =3D 0x04, value =3D 1200 > [hp5400] Read: reqtype =3D 0xC0, req =3D 0x04, value =3D C500 > [hp5400] Command 12 verified > [hp5400] Sorry, unknown scanner version. Attempted match on > 'SilitekIBlizd C3 ScannerV0.84' and 'SilitekIBlizd C3 ScannerV0.86' > [hp5400] Vesion is '' > [hp5400] attach_one_device: couldn't attach /dev/usb/scanner0 > [hp5400] Discarding line 15 > [hp5400] sane_open: > Segmentation fault > > modules.conf > #added for HP5400 scanner > alias /dev/usb/scanner0 scanner > options scanner vendor=3D0x03f0 product=3D0x1005 > (I've also tried vendor as 0x3f0) > > > I can see that Thomas Soumarmon's solution here > (https://sourceforge.net/mailarchive/message.php?msg_id=3D4094726) fits my > > problem: > > You have to modify the C code in hp5400.c to be able to run the > > backend. The scanner is queried about a version string which is > > typically : 'SilitekIBlizd C3 ScannerV0.84' or 'SilitekIBlizd C3 > > ScannerV0.86' > > on the > > > scanner we tested. > > You may disable this test, changing > > > > if( memcmp( szVersion+1, MatchVersion, sizeof(MatchVersion)-1 ) ) > > { > > if( memcmp( szVersion+1, MatchVersion2, sizeof(MatchVersion2)-1 )= ) > > { > > DBG(DBG_MSG, "Sorry, unknown scanner version. Attempted match > > on '%s' > > > and '%s'\n", MatchVersion, MatchVersion2 ); > > DBG(DBG_MSG, "Vesion is '%s'", szVersion ); > > ret =3D -1; > > goto hp5400_close_exit; > > } > > } > > But I couldn't find the above in hp5400.c. I found it in > hp5400_internal.c in this form: > > #ifndef NO_STRING_VERSION_MATCH > if (memcmp (szVersion + 1, MatchVersion, sizeof (MatchVersion) - 1)) > { > if (memcmp (szVersion + 1, MatchVersion2, sizeof (MatchVersion2) - > 1)) { > DBG (DBG_MSG, > "Sorry, unknown scanner version. Attempted match on '%s' and > '%s'\n", > MatchVersion, MatchVersion2); > DBG (DBG_MSG, "Vesion is '%s'\n", szVersion); > ret =3D -1; > goto hp5400_close_exit; > } > } > #else > DBG (DBG_MSG, "Warning, Version match is disabled. Version is '%s'\n", > szVersion); > #endif /* NO_STRING_VERSION_MATCH */ > > Is that correct? Do I still need to do this: > > into : > > > > #ifdef 0 > > if( memcmp( szVersion+1, MatchVersion, sizeof(MatchVersion)-1 ) ) > > { > > if( memcmp( szVersion+1, MatchVersion2, sizeof(MatchVersion2)-1 )= ) > > { > > DBG(DBG_MSG, "Sorry, unknown scanner version. Attempted match > > on '%s' > > > and '%s'\n", MatchVersion, MatchVersion2 ); > > DBG(DBG_MSG, "Vesion is '%s'", szVersion ); > > ret =3D -1; > > goto hp5400_close_exit; > > } > > } > > #endif > > Also, do I need to alter this as well: > > #ifndef NO_STRING_VERSION_MATCH > /* Match on everything except the version number */ > if (memcmp (szVersion + 1, MatchVersion, sizeof (MatchVersion) - 4)) > { > if (memcmp (szVersion + 1, MatchVersion2, sizeof (MatchVersion2) - > 4)) { > DBG (DBG_MSG, > "Sorry, unknown scanner version. Attempted match on '%s' and > '%s'\n", > MatchVersion, MatchVersion2); > DBG (DBG_MSG, "Vesion is '%s'\n", szVersion); > goto hp5400_close_exit; > } > } > #else > DBG (DBG_MSG, "Warning, Version match is disabled. Version is '%s'\n", > szVersion); > #endif /* NO_STRING_VERSION_MATCH */ > > > Any ideas? Is there any other info you need from me? > > Thanks for your time. > > > > ------------------------------------------------------- > This SF.net email is sponsored by: eBay > Get office equipment for less on eBay! > http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5 > _______________________________________________ > Hp5400backend-devel mailing list > Hp5...@li... > https://lists.sourceforge.net/lists/listinfo/hp5400backend-devel |