Commit 6f815233 authored by Henning Meier-Geinitz's avatar Henning Meier-Geinitz Committed by Greg Kroah-Hartman

[PATCH] scanner.c: Support for devices with only one bulk-in endpoint

This patch (originally from Sergey Vlasov) adds support for scanners
with only one bulk-in endpoint. It's needed by all the GT-6801 based
scanners like the Artec Ultima 2000 or some of the Mustek BearPaws.
parent 00945e82
...@@ -323,6 +323,8 @@ ...@@ -323,6 +323,8 @@
* Ed Hamrick <EdHamrick@aol.com>, Oliver Schwartz * Ed Hamrick <EdHamrick@aol.com>, Oliver Schwartz
* <Oliver.Schwartz@gmx.de> and everyone else who sent ids. * <Oliver.Schwartz@gmx.de> and everyone else who sent ids.
* - Some Benq, Genius and Plustek ids are identified now. * - Some Benq, Genius and Plustek ids are identified now.
* - Accept scanners with only one bulk (in) endpoint (thanks to Sergey
* Vlasov <vsu@mivlgu.murom.ru>).
* *
* TODO * TODO
* - Remove the 2/3 endpoint limitation * - Remove the 2/3 endpoint limitation
...@@ -513,6 +515,12 @@ write_scanner(struct file * file, const char * buffer, ...@@ -513,6 +515,12 @@ write_scanner(struct file * file, const char * buffer,
down(&(scn->sem)); down(&(scn->sem));
if (!scn->bulk_out_ep) {
/* This scanner does not have a bulk-out endpoint */
up(&(scn->sem));
return -EINVAL;
}
scn_minor = scn->scn_minor; scn_minor = scn->scn_minor;
obuf = scn->obuf; obuf = scn->obuf;
...@@ -907,15 +915,15 @@ probe_scanner(struct usb_interface *intf, ...@@ -907,15 +915,15 @@ probe_scanner(struct usb_interface *intf,
interface = intf->altsetting; interface = intf->altsetting;
/* /*
* Start checking for two bulk endpoints OR two bulk endpoints *and* one * Start checking for one or two bulk endpoints and an optional
* interrupt endpoint. If we have an interrupt endpoint go ahead and * interrupt endpoint. If we have an interrupt endpoint go ahead and
* setup the handler. FIXME: This is a future enhancement... * setup the handler. FIXME: This is a future enhancement...
*/ */
dbg("probe_scanner: Number of Endpoints:%d", (int) interface->desc.bNumEndpoints); dbg("probe_scanner: Number of Endpoints:%d", (int) interface->desc.bNumEndpoints);
if ((interface->desc.bNumEndpoints != 2) && (interface->desc.bNumEndpoints != 3)) { if ((interface->desc.bNumEndpoints < 1) || (interface->desc.bNumEndpoints > 3)) {
info("probe_scanner: Only two or three endpoints supported."); info("probe_scanner: Only 1, 2, or 3 endpoints supported.");
return -ENODEV; return -ENODEV;
} }
...@@ -955,6 +963,12 @@ probe_scanner(struct usb_interface *intf, ...@@ -955,6 +963,12 @@ probe_scanner(struct usb_interface *intf,
*/ */
switch(interface->desc.bNumEndpoints) { switch(interface->desc.bNumEndpoints) {
case 1:
if (!have_bulk_in) {
info("probe_scanner: One bulk-in endpoint required.");
return -EIO;
}
break;
case 2: case 2:
if (!have_bulk_in || !have_bulk_out) { if (!have_bulk_in || !have_bulk_out) {
info("probe_scanner: Two bulk endpoints required."); info("probe_scanner: Two bulk endpoints required.");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment