From owner-freebsd-usb@FreeBSD.ORG Wed Jan 10 00:50:24 2007 Return-Path: X-Original-To: freebsd-usb@hub.freebsd.org Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E4D3116A40F for ; Wed, 10 Jan 2007 00:50:24 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 9586113C442 for ; Wed, 10 Jan 2007 00:50:24 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l0A0oObL002617 for ; Wed, 10 Jan 2007 00:50:24 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l0A0oOTY002615; Wed, 10 Jan 2007 00:50:24 GMT (envelope-from gnats) Date: Wed, 10 Jan 2007 00:50:24 GMT Message-Id: <200701100050.l0A0oOTY002615@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org From: Steinar Hamre Cc: Subject: Re: kern/107665: [usb] [patch] uscanner support for epson stylus DX5050 MFP X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Steinar Hamre List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jan 2007 00:50:25 -0000 The following reply was made to PR kern/107665; it has been noted by GNATS. From: Steinar Hamre To: bug-followup@FreeBSD.org Cc: Subject: Re: kern/107665: [usb] [patch] uscanner support for epson stylus DX5050 MFP Date: Wed, 10 Jan 2007 01:20:28 +0100 --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi. I have reworked the uscanner module so that it can use the device simultaniously with the ulpt and umass modules. The revised patch is attached. Steinar --HlL+5n6rz5pIUxbD Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="epson_dx5000.patch" --- usbdevs.orig Mon Jan 8 00:00:26 2007 +++ usbdevs Mon Jan 8 00:02:25 2007 @@ -907,6 +907,7 @@ product EPSON 3500 0x080e CX-3500/3600/3650 MFP product EPSON RX425 0x080f Stylus Photo RX425 scanner product EPSON 4200 0x0820 CX4200 MP scanner +product EPSON 5000 0x082b DX-50x0 MFP /* e-TEK Labs products */ product ETEK 1COM 0x8007 Serial --- uscanner.c.orig Mon Jan 8 00:00:42 2007 +++ uscanner.c Wed Jan 10 01:07:55 2007 @@ -217,6 +217,7 @@ {{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_3590 }, 0 }, {{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_4200 }, 0 }, {{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_4990 }, 0 }, + {{ USB_VENDOR_EPSON, USB_PRODUCT_EPSON_5000 }, 0 }, /* UMAX */ {{ USB_VENDOR_UMAX, USB_PRODUCT_UMAX_ASTRA1220U }, 0 }, @@ -309,13 +310,28 @@ USB_MATCH(uscanner) { + usb_interface_descriptor_t *id; USB_MATCH_START(uscanner, uaa); - if (uaa->iface != NULL) - return UMATCH_NONE; + if (uaa->iface == NULL) + return (UMATCH_NONE); + + if(uscanner_lookup(uaa->vendor, uaa->product) == NULL) + return (UMATCH_NONE); + + id = usbd_get_interface_descriptor(uaa->iface); + if (id == NULL) + return (UMATCH_NONE); + + /* Current ATTACH use the first interface, + * so claim only this. Must be changed to support + * multi function devices where the scanner is not + * the first interface. */ + + if (id->bInterfaceNumber == 0) + return (UMATCH_VENDOR_PRODUCT); - return (uscanner_lookup(uaa->vendor, uaa->product) != NULL ? - UMATCH_VENDOR_PRODUCT : UMATCH_NONE); + return (UMATCH_NONE); } USB_ATTACH(uscanner) @@ -330,16 +346,22 @@ usbd_devinfo(uaa->device, 0, devinfo); USB_ATTACH_SETUP; + sc->dev = NULL; sc->sc_dev_flags = uscanner_lookup(uaa->vendor, uaa->product)->flags; sc->sc_udev = uaa->device; +#if 0 + /* This shouldn't really be necessary and breaks all multi + * function devices. If any scanner needs this, use a quirk + * for only that scanner? */ err = usbd_set_config_no(uaa->device, 1, 1); /* XXX */ if (err) { printf("%s: setting config no failed\n", USBDEVNAME(sc->sc_dev)); USB_ATTACH_ERROR_RETURN; } +#endif /* XXX We only check the first interface */ err = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface); @@ -664,7 +686,7 @@ s = splusb(); if (--sc->sc_refcnt >= 0) { /* Wait for processes to go away. */ - usb_detach_wait(USBDEV(sc->sc_dev)); + if (sc->dev) usb_detach_wait(USBDEV(sc->sc_dev)); } splx(s); @@ -679,7 +701,7 @@ vdevgone(maj, mn, mn + USB_MAX_ENDPOINTS - 1, VCHR); #elif defined(__FreeBSD__) /* destroy the device for the control endpoint */ - destroy_dev(sc->dev); + if (sc->dev) destroy_dev(sc->dev); #endif usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, --HlL+5n6rz5pIUxbD--