kern/107665: [usb] [patch] uscanner support for epson stylus DX5050 MFP

Steinar Hamre steinarh at pvv.ntnu.no
Wed Jan 10 00:50:25 UTC 2007


The following reply was made to PR kern/107665; it has been noted by GNATS.

From: Steinar Hamre <steinarh at pvv.ntnu.no>
To: bug-followup at 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--


More information about the freebsd-usb mailing list