ChangeSet 1.893.2.3, 2002/12/19 14:47:00-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/scanner.c b/drivers/usb/scanner.c --- a/drivers/usb/scanner.c Mon Jan 6 11:32:37 2003 +++ b/drivers/usb/scanner.c Mon Jan 6 11:32:37 2003 @@ -322,6 +322,8 @@ * and everyone else who sent ids. * - Some Benq, Genius and Plustek ids are identified now. * - Don't clutter syslog with "Unable to access minor data" messages. + * - Accept scanners with only one bulk (in) endpoint (thanks to Sergey + * Vlasov ). * * TODO * - Remove the 2/3 endpoint limitation @@ -508,6 +510,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 @@ endpoint = interface[ifnum].endpoint; /* - * 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->bNumEndpoints); - if ((interface->bNumEndpoints != 2) && (interface->bNumEndpoints != 3)) { - info("probe_scanner: Only two or three endpoints supported."); + if ((interface->bNumEndpoints < 1) || (interface->bNumEndpoints > 3)) { + info("probe_scanner: Only 1, 2, or 3 endpoints supported."); return NULL; } @@ -954,6 +962,12 @@ */ switch(interface->bNumEndpoints) { + case 1: + if (!have_bulk_in) { + info("probe_scanner: One bulk-in endpoint required."); + return NULL; + } + break; case 2: if (!have_bulk_in || !have_bulk_out) { info("probe_scanner: Two bulk endpoints required.");