kopia lustrzana https://gitlab.com/sane-project/website
106 wiersze
4.0 KiB
HTML
106 wiersze
4.0 KiB
HTML
<!-- received="Fri May 21 20:21:16 1999 PDT" -->
|
||
<!-- sent="Sat, 22 May 1999 04:28:21 +0100 (GMT)" -->
|
||
<!-- name="Nick Lamb" -->
|
||
<!-- email="njl98r@ecs.soton.ac.uk" -->
|
||
<!-- subject="find-scanner & SCSI generic test [patch]" -->
|
||
<!-- id="" -->
|
||
<!-- inreplyto="" -->
|
||
<title>sane-devel: find-scanner & SCSI generic test [patch]</title>
|
||
<h1>find-scanner & SCSI generic test [patch]</h1>
|
||
<b>Nick Lamb</b> (<a href="mailto:njl98r@ecs.soton.ac.uk"><i>njl98r@ecs.soton.ac.uk</i></a>)<br>
|
||
<i>Sat, 22 May 1999 04:28:21 +0100 (GMT)</i>
|
||
<p>
|
||
<ul>
|
||
<li> <b>Messages sorted by:</b> <a href="date.html#239">[ date ]</a><a href="index.html#239">[ thread ]</a><a href="subject.html#239">[ subject ]</a><a href="author.html#239">[ author ]</a>
|
||
<!-- next="start" -->
|
||
<li> <b>Next message:</b> <a href="0240.html">Oliver Rauch: "New UMAX-backend available"</a>
|
||
<li> <b>Previous message:</b> <a href="0238.html">David Fox: "Re: First sucess with Coolscan LS-30"</a>
|
||
<!-- nextthread="start" -->
|
||
<!-- reply="end" -->
|
||
</ul>
|
||
<!-- body="start" -->
|
||
After I sent my original patch to the list a week or so ago, I was asked<br>
|
||
to alter it so that future kernel changes were less likely to disrupt<br>
|
||
operation on any Linux or Linux-like system. Here's the new version of<br>
|
||
the patch (you'll have to back the old one out if you've applied it)<br>
|
||
<p>
|
||
For those who missed this the first time -<br>
|
||
Not all SANE first-timers realise that they need SCSI drivers, and in<br>
|
||
particular SCSI generic drivers, before SANE can talk to their scanner.<br>
|
||
This patch checks (on Linux only so far) for SCSI Generic support in<br>
|
||
the OS kernel. If NOT present it tells the user they may need SG drivers<br>
|
||
<p>
|
||
Nick.<br>
|
||
<p>
|
||
--- find-scanner.c.old Tue May 11 15:30:07 1999<br>
|
||
+++ find-scanner.c Sat May 22 04:14:46 1999<br>
|
||
@@ -74,6 +74,38 @@<br>
|
||
fprintf (stderr, "\t%s\n", msg);<br>
|
||
}<br>
|
||
<br>
|
||
+/* if SCSI generic is optional on your OS, and there is a software test<br>
|
||
+ which will determine if it is included, add it here. If you are sure<br>
|
||
+ that SCSI generic was found, return 1. If SCSI generic is always<br>
|
||
+ available in your OS, return 1 */<br>
|
||
+<br>
|
||
+int<br>
|
||
+check_sg (void)<br>
|
||
+{<br>
|
||
+#if defined(__linux__)<br>
|
||
+ /* Assumption: /proc/devices lines are shorter than 256 characters */<br>
|
||
+ char line[256], driver[256]= "";<br>
|
||
+ FILE *stream;<br>
|
||
+<br>
|
||
+ stream= fopen("/proc/devices", "r");<br>
|
||
+ /* Likely reason for failure, no /proc => probably no SG either */<br>
|
||
+ if (stream == NULL) return 0;<br>
|
||
+ <br>
|
||
+ while (fgets(line, 255, stream)) {<br>
|
||
+ if (sscanf(line, " %*d %s\n", driver) > 0 && !strcmp(driver, "sg"))<br>
|
||
+ break;<br>
|
||
+ }<br>
|
||
+ fclose(stream);<br>
|
||
+<br>
|
||
+ if (strcmp(driver, "sg")) {<br>
|
||
+ return 0;<br>
|
||
+ } else {<br>
|
||
+ return 1;<br>
|
||
+ }<br>
|
||
+#endif<br>
|
||
+ return 1; /* Give up, and assume yes to avoid false negatives */<br>
|
||
+}<br>
|
||
+<br>
|
||
void <br>
|
||
scanner_do_inquiry (unsigned char *buffer, int sfd)<br>
|
||
{<br>
|
||
@@ -408,6 +440,13 @@<br>
|
||
sanei_scsi_close (sfd);<br>
|
||
}<br>
|
||
}<br>
|
||
+ if (!check_sg()) {<br>
|
||
+ printf (<br>
|
||
+ "# If your scanner uses SCSI, you must have a driver for your SCSI\n"<br>
|
||
+ "# adaptor and support for SCSI Generic (sg) in your Operating System\n"<br>
|
||
+ "# in order for the scanner to be used with SANE. If your scanner is\n"<br>
|
||
+ "# NOT listed above, check that you have installed the drivers.\n\n");<br>
|
||
+ }<br>
|
||
if (verbose)<br>
|
||
printf ("%s: done\n", prog_name);<br>
|
||
return 0;<br>
|
||
<p>
|
||
<p>
|
||
<pre>
|
||
--
|
||
Source code, list archive, and docs: <a href="http://www.mostang.com/sane/">http://www.mostang.com/sane/</a>
|
||
To unsubscribe: echo unsubscribe sane-devel | mail <a href="mailto:majordomo@mostang.com">majordomo@mostang.com</a>
|
||
</pre>
|
||
<!-- body="end" -->
|
||
<p>
|
||
<ul>
|
||
<!-- next="start" -->
|
||
<li> <b>Next message:</b> <a href="0240.html">Oliver Rauch: "New UMAX-backend available"</a>
|
||
<li> <b>Previous message:</b> <a href="0238.html">David Fox: "Re: First sucess with Coolscan LS-30"</a>
|
||
<!-- nextthread="start" -->
|
||
<!-- reply="end" -->
|
||
</ul>
|