[sane-devel] 'scanimage -L' fails first time with modular SCSI drivers
Henning Meier-Geinitz
henning at meier-geinitz.de
Sun Feb 24 13:38:25 GMT 2002
Hi,
On Fri, Feb 22, 2002 at 02:02:14PM +0000, Tim Waugh wrote:
> Could we add some hook to try to get the modules loaded if
> /proc/scsi/scsi doesn't exist? Just opening a generic SCSI device is
> enough to load them.
Is anybody against the following patch?
Bye,
Henning
Index: sanei/sanei_scsi.c
===================================================================
RCS file: /cvsroot/external/sane/sane-backends/sanei/sanei_scsi.c,v
retrieving revision 1.31
diff -u -u -r1.31 sanei_scsi.c
--- sanei_scsi.c 2002/02/09 16:37:21 1.31
+++ sanei_scsi.c 2002/02/24 13:35:40
@@ -2440,11 +2440,13 @@
#define FOUND_LUN 128
#define FOUND_ALL 255
+ #define FIND_DEVICES_TOUCH_FILE "/dev/sg0"
+
size_t findvendor_len = 0, findmodel_len = 0, findtype_len = 0;
char vendor[32], model[32], type[32], revision[32];
int bus, channel, id, lun;
- int number, i, j, definedd;
+ int number, i, j, definedd, fd;
char line[256], dev_name[128], *c1, *c2, ctmp;
const char *string;
FILE *proc_fp;
@@ -2484,6 +2486,12 @@
param[7].u.i = &lun;
DBG_INIT ();
+
+ /* Make sure that the kernel SCSI drivers are loaded before reading
+ PROCFILE */
+ fd = open (FIND_DEVICES_TOUCH_FILE, O_RDONLY);
+ if (fd >= 0)
+ close (fd);
proc_fp = fopen (PROCFILE, "r");
if (!proc_fp)
More information about the sane-devel
mailing list