aboutsummaryrefslogtreecommitdiff
path: root/lib/libcam/camlib.c
diff options
context:
space:
mode:
authorKenneth D. Merry <ken@FreeBSD.org>1998-10-12 21:54:13 +0000
committerKenneth D. Merry <ken@FreeBSD.org>1998-10-12 21:54:13 +0000
commit621a60d46b7d15397933403c138912c7989cb47b (patch)
tree0e4ba8313b1fc4cb6dc231246fa929c9173f1fa6 /lib/libcam/camlib.c
parent4d8eda22525b4ea9e33976a0213653fa9d3304c5 (diff)
downloadsrc-621a60d46b7d15397933403c138912c7989cb47b.tar.gz
src-621a60d46b7d15397933403c138912c7989cb47b.zip
Add a "dummy light" (actually two dummy lights) to catch people who don't
have the passthrough device configured in their kernel. This will hopefully reduce the number of people complaining that they can't get {camcontrol, xmcd, tosha, cdrecord, etc.} to work. Reviewed by: gibbs
Notes
Notes: svn path=/head/; revision=40271
Diffstat (limited to 'lib/libcam/camlib.c')
-rw-r--r--lib/libcam/camlib.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/lib/libcam/camlib.c b/lib/libcam/camlib.c
index af622667bf7e..d4ba57e3c6a6 100644
--- a/lib/libcam/camlib.c
+++ b/lib/libcam/camlib.c
@@ -22,7 +22,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id$
+ * $Id: camlib.c,v 1.1 1998/09/15 06:16:46 gibbs Exp $
*/
#include <sys/types.h>
@@ -491,11 +491,29 @@ cam_lookup_pass(const char *dev_name, int unit, int flags,
/*
* Attempt to get the passthrough device. This ioctl will fail if
- * the device name is null, or if the device doesn't exist.
+ * the device name is null, if the device doesn't exist, or if the
+ * passthrough driver isn't in the kernel.
*/
if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
- sprintf(cam_errbuf, "%s: CAMGETPASSTHRU ioctl failed\n"
- "%s: %s", func_name, func_name, strerror(errno));
+ char tmpstr[256];
+
+ /*
+ * If we get ENOENT from the transport layer version of
+ * the CAMGETPASSTHRU ioctl, it means one of two things:
+ * either the device name/unit number passed in doesn't
+ * exist, or the passthrough driver isn't in the kernel.
+ */
+ if (errno == ENOENT) {
+ snprintf(tmpstr, sizeof(tmpstr),
+ "\n%s: either the pass driver isn't in "
+ "your kernel\n%s: or %s%d doesn't exist",
+ func_name, func_name, dev_name, unit);
+ }
+ snprintf(cam_errbuf, sizeof(cam_errbuf),
+ "%s: CAMGETPASSTHRU ioctl failed\n"
+ "%s: %s%s", func_name, func_name, strerror(errno),
+ (errno == ENOENT) ? tmpstr : "");
+
return(NULL);
}
@@ -589,6 +607,11 @@ cam_real_open_device(const char *path, int flags, struct cam_device *device,
* parameter: the passthrough driver unit number.
*/
if (ioctl(fd, CAMGETPASSTHRU, &ccb) == -1) {
+ /*
+ * At this point we know the passthrough device must exist
+ * because we just opened it above. The only way this
+ * ioctl can fail is if the ccb size is wrong.
+ */
sprintf(cam_errbuf, "%s: CAMGETPASSTHRU ioctl failed\n"
"%s: %s", func_name, func_name, strerror(errno));
goto crod_bailout;