Subject: Backporting uscanner driver to 1.5 (Was: ugen refusing writes)
To: Jasper Wallace <jasper@pointless.net>
From: Chris Baird <cjb@brushtail.apana.org.au>
List: netbsd-users
Date: 02/16/2001 11:53:56
 > Have you looked at the uscanner driver in -current?
 > I don't know how easy it would be to backport to 1.5...

I've just done this, and it wasn't much work at all. My hacking just
needed copying in -current's uscanner.c and usbdevs, and updating the
following files in my 1.5 kernel: (patches meant as a guide only--
someone who knows what they're doing will probably find flaws in this)

/sys/arch/i386/i386/conf.c

    *** 219,220 ****
    --- 219,222 ----
      cdev_decl(urio);
    + #include "uscanner.h"
    + cdev_decl(uscanner);
      #include "vcoda.h"

    *** 392,393 ****
    --- 395,398 ----
      	cdev_ses_init(NSES,ses),	/* 74: SCSI SES/SAF-TE */
    + 	cdev_ugen_init(NUSCANNER,uscanner), /* 75: USB scanner */
      };

/sys/dev/DEVNAMES

    *** 875,876 ****
    --- 875,877 ----
      usbbus			MI
    + uscanner			MI		
      ut			vax

/sys/dev/usb/files.usb

    *** 111 ****
    --- 111,118 ----
      file	dev/usb/uftdi.c			uftdi
    + 
    + # Scanners
    + # Generic scanner support
    + device	uscanner
    + attach	uscanner at uhub
    + file	dev/usb/uscanner.c		uscanner	needs-flag

/sys/dev/usb/usb_port.h

    *** 70,71 ****
    --- 70,72 ----
      #define UFTDI_DEBUG 1
    + #define USCANNER_DEBUG 1
      #define Static

    *** 224,225 ****
    --- 225,227 ----
      #define	ugenpoll		ugenselect
    + #define 	uscannerpoll            uscannerselect

Then copy in the updated USB device lists and uscanner.c code. (And
adding the id for my Epson 640U (0x04b8/0x010c) to both.)

    # cp /usr/tmp/current/sys/dev/usb/usbdevs .
    # cp /usr/tmp/current/sys/dev/usb/uscanner.c .

For the moment the new device sits on major number 75:

    # mknod /dev/uscanner0 c 75 0

And finally, configure sane with the new device:

    # echo "usb /dev/uscanner0" >/usr/X11R6/etc/sane.d/{mumble}.conf
    # chmod 666 /dev/uscanner0

-- 
Chris Baird,,