summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/man4/uscanner.411
-rw-r--r--sys/dev/usb/usbdevs3
-rw-r--r--sys/dev/usb/uscanner.c37
3 files changed, 36 insertions, 15 deletions
diff --git a/share/man/man4/uscanner.4 b/share/man/man4/uscanner.4
index 04a07cbdf48..9e3156b6c08 100644
--- a/share/man/man4/uscanner.4
+++ b/share/man/man4/uscanner.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: uscanner.4,v 1.7 2007/05/31 19:19:53 jmc Exp $
+.\" $OpenBSD: uscanner.4,v 1.8 2007/11/06 17:25:15 ajacoutot Exp $
.\" $NetBSD: uscanner.4,v 1.4 2000/10/13 21:05:18 augustss Exp $
.\"
.\" Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd $Mdocdate: May 31 2007 $
+.Dd $Mdocdate: November 6 2007 $
.Dt USCANNER 4
.Os
.Sh NAME
@@ -51,6 +51,13 @@ The driver recognizes a number of USB scanners, but to
actually scan anything there needs to be software that knows
about the particular scanner.
The SANE package provides support for some scanners.
+.Pp
+For multifunction USB devices (e.g. scanner/printer/card reader), this
+driver only attaches to the USB interface that controls the scanner; for
+the other USB interface separate drivers are needed, for example
+.Xr ulpt 4 ,
+.Xr umass 4 ,
+and so on.
.Sh HARDWARE
The
.Nm
diff --git a/sys/dev/usb/usbdevs b/sys/dev/usb/usbdevs
index 23cb550ca05..45be230a2af 100644
--- a/sys/dev/usb/usbdevs
+++ b/sys/dev/usb/usbdevs
@@ -1,4 +1,4 @@
-$OpenBSD: usbdevs,v 1.307 2007/11/01 00:51:36 deraadt Exp $
+$OpenBSD: usbdevs,v 1.308 2007/11/06 17:25:15 ajacoutot Exp $
/* $NetBSD: usbdevs,v 1.322 2003/05/10 17:47:14 hamajima Exp $ */
/*
@@ -1118,6 +1118,7 @@ product EPSON 1260 0x011d Perfection 1260
product EPSON 1660 0x011e Perfection 1660
product EPSON 1670 0x011f Perfection 1670
product EPSON CX3650 0x080e Stylus CX3650
+product EPSON DX3850 0x082f Stylus DX3850 / DX4050
/* e-TEK Labs products */
product ETEK 1COM 0x8007 Serial
diff --git a/sys/dev/usb/uscanner.c b/sys/dev/usb/uscanner.c
index 2894342717d..f34f26bb48b 100644
--- a/sys/dev/usb/uscanner.c
+++ b/sys/dev/usb/uscanner.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uscanner.c,v 1.36 2007/10/11 18:33:15 deraadt Exp $ */
+/* $OpenBSD: uscanner.c,v 1.37 2007/11/06 17:25:15 ajacoutot Exp $ */
/* $NetBSD: uscanner.c,v 1.40 2003/01/27 00:32:44 wiz Exp $ */
/*
@@ -176,6 +176,7 @@ static const struct uscan_info uscanner_devs[] = {
{{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_640U }, 0 },
{{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_1650 }, 0 },
{{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_2400 }, 0 },
+ {{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_DX3850 }, 0 },
{{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_GT9700F }, USC_KEEP_OPEN },
/* UMAX */
@@ -259,12 +260,28 @@ int
uscanner_match(struct device *parent, void *match, void *aux)
{
struct usb_attach_arg *uaa = aux;
+ usb_interface_descriptor_t *id;
- if (uaa->iface != NULL)
+ if (uaa->iface == NULL)
+ return UMATCH_NONE; /* do not grab the entire device */
+
+ if (uscanner_lookup(uaa->vendor, uaa->product) == NULL)
+ return UMATCH_NONE; /* not in the list of known devices */
+ id = usbd_get_interface_descriptor(uaa->iface);
+ if (id == NULL)
+ return UMATCH_NONE;
+
+ /*
+ * There isn't a specific UICLASS for scanners, many vendors use
+ * UICLASS_VENDOR, so detecting the right interface is not so easy.
+ * But certainly we can exclude PRINTER and MASS - which some
+ * multifunction devices implement.
+ */
+ if (id->bInterfaceClass == UICLASS_PRINTER ||
+ id->bInterfaceClass == UICLASS_MASS)
return UMATCH_NONE;
- return (uscanner_lookup(uaa->vendor, uaa->product) != NULL ?
- UMATCH_VENDOR_PRODUCT : UMATCH_NONE);
+ return UMATCH_VENDOR_PRODUCT;
}
void
@@ -276,20 +293,16 @@ uscanner_attach(struct device *parent, struct device *self, void *aux)
usb_endpoint_descriptor_t *ed, *ed_bulkin = NULL, *ed_bulkout = NULL;
int i;
usbd_status err;
+ int ifnum;
sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags;
sc->sc_udev = uaa->device;
- err = usbd_set_config_no(uaa->device, 1, 1); /* XXX */
- if (err) {
- printf("%s: setting config no failed\n",
- sc->sc_dev.dv_xname);
- return;
- }
+ id = usbd_get_interface_descriptor(uaa->iface);
+ ifnum = id->bInterfaceNumber;
- /* XXX We only check the first interface */
- err = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface);
+ err = usbd_device2interface_handle(sc->sc_udev, ifnum, &sc->sc_iface);
if (!err && sc->sc_iface)
id = usbd_get_interface_descriptor(sc->sc_iface);
if (err || id == 0) {