ChangeSet 1.865.28.17, 2002/12/21 23:07:29-08:00, henning@meier-geinitz.de [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. diff -Nru a/drivers/usb/image/scanner.c b/drivers/usb/image/scanner.c --- a/drivers/usb/image/scanner.c Sun Dec 22 00:38:08 2002 +++ b/drivers/usb/image/scanner.c Sun Dec 22 00:38:08 2002 @@ -323,6 +323,8 @@ * Ed Hamrick , Oliver Schwartz * and everyone else who sent ids. * - Some Benq, Genius and Plustek ids are identified now. + * - Accept scanners with only one bulk (in) endpoint (thanks to Sergey + * Vlasov ). * * TODO * - Remove the 2/3 endpoint limitation @@ -513,6 +515,12 @@ 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; obuf = scn->obuf; @@ -907,15 +915,15 @@ 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 * setup the handler. FIXME: This is a future enhancement... */ dbg("probe_scanner: Number of Endpoints:%d", (int) interface->desc.bNumEndpoints); - if ((interface->desc.bNumEndpoints != 2) && (interface->desc.bNumEndpoints != 3)) { - info("probe_scanner: Only two or three endpoints supported."); + if ((interface->desc.bNumEndpoints < 1) || (interface->desc.bNumEndpoints > 3)) { + info("probe_scanner: Only 1, 2, or 3 endpoints supported."); return -ENODEV; } @@ -955,6 +963,12 @@ */ switch(interface->desc.bNumEndpoints) { + case 1: + if (!have_bulk_in) { + info("probe_scanner: One bulk-in endpoint required."); + return -EIO; + } + break; case 2: if (!have_bulk_in || !have_bulk_out) { info("probe_scanner: Two bulk endpoints required.");