I sent this a couple of weeks ago and got no response... So I try
again. I would really like to see this in the scanner driver, it would
make the lifes of all Sane backend programmers a lot easier. What do
you think?
Karl Heinz
----- Forwarded message from Karl Heinz Kremer <[EMAIL PROTECTED]> -----
Date: Thu, 24 May 2001 22:01:28 -0400
From: Karl Heinz Kremer <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [Patch] New Feature For USB Scanner Driver: IOCTL to query vendor and product
ID
Mail-Followup-To: [EMAIL PROTECTED]
Some time ago there was a discussion on this list about right and wrong ways
of accessing USB scanners under Linux. Besides the SCSI->USB conversion one
other proposed solution was to add functionality to query the vendor and
product ID from the driver so that an automatic scanner detection is possible.
I implemented two ioctls to do this. in addion to this I also implemented the
necessary calls in the SANE EPSON backend to make use of these ioctls.
The patche for SANE is available at
http://www.freecolormanagement.com/sane/download.html,
the USB scanner patch is attached to this mail. I already sent the patch to
David Nelson, but he has not yet responded.
Who is responsible for assigning ioctl numbers for the USB sub-system? According to the
IOCTL list that is part of the kernel documentation the USB driver(s) use the id "U",
I checked the drivers, but none is actually using this id.
Karl Heinz
diff -r -u linux.old/driver/usb/scanner.c linux/driver/usb/scanner.c
--- linux.old/driver/usb/scanner.c Sat May 19 18:28:36 2001
+++ linux/driver/usb/scanner.c Sat May 19 18:28:36 2001
@@ -858,6 +858,10 @@
switch (cmd)
{
+ case IOCTL_SCANNER_VENDOR :
+ return (put_user(dev->descriptor.idVendor, (unsigned int *) arg));
+ case IOCTL_SCANNER_PRODUCT :
+ return (put_user(dev->descriptor.idProduct, (unsigned int *) arg));
case PV8630_IOCTL_INREQUEST :
{
struct {
diff -r -u linux.old/driver/usb/scanner.h linux/driver/usb/scanner.h
--- linux.old/driver/usb/scanner.h Sat May 19 18:28:36 2001
+++ linux/driver/usb/scanner.h Sat May 19 18:28:36 2001
@@ -53,7 +53,7 @@
/* Enable to activate the ioctl interface. This is mainly meant for */
/* development purposes until an ioctl number is officially registered */
-// #define SCN_IOCTL
+#define SCN_IOCTL
/* WARNING: These DATA_DUMP's can produce a lot of data. Caveat Emptor. */
// #define RD_DATA_DUMP /* Enable to dump data - limited to 24 bytes */
@@ -122,6 +122,7 @@
{ USB_DEVICE(0x04b8, 0x0107) }, /* Expression 1600 */
{ USB_DEVICE(0x04b8, 0x010b) }, /* Perfection 1240U */
{ USB_DEVICE(0x04b8, 0x010a) }, /* Perfection 1640SU and 1640SU Photo */
+ { USB_DEVICE(0x04b8, 0x010e) }, /* Perfection 1680 */
/* Umax */
{ USB_DEVICE(0x1606, 0x0010) }, /* Astra 1220U */
{ USB_DEVICE(0x1606, 0x0030) }, /* Astra 2000U */
@@ -162,6 +163,10 @@
/* FIXME: These are NOT registered ioctls()'s */
#define PV8630_IOCTL_INREQUEST 69
#define PV8630_IOCTL_OUTREQUEST 70
+
+/* read vendor and product IDs */
+#define IOCTL_SCANNER_VENDOR _IOR('U', 0xa0, int)
+#define IOCTL_SCANNER_PRODUCT _IOR('U', 0xa1, int)
#define SCN_MAX_MNR 16 /* We're allocated 16 minors */
#define SCN_BASE_MNR 48 /* USB Scanners start at minor 48 */
----- End forwarded message -----
--
Karl Heinz Kremer [EMAIL PROTECTED]
PGP Key at http://www.freecolormanagement.com/download/khk.asc
EPSON Sane Backend: http://www.freecolormanagement.com
PGP signature