FreeBSD scanners

Warren Block wblock at wonkity.com
Sun Aug 22 08:15:49 PDT 2004


On Sun, 22 Aug 2004, Ian Moore wrote:

> I have a DiamondView DV650U scanner that is supported by SANE, but I always
> assumed that because FBSD doesn't detect it as a uscanner device, just a
> ugen, it wouldn't work. How would I edit uscanner.c & rebuild whatever to see
> if it works?
>
> usbdevs -v gives the following:
> -- Controller /dev/usb2:
> addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
> VIA(0x0000), rev 1.00
> port 1 addr 2: full speed, self powered, config 1, FlatbedScanner 22(0x20b0),
> Color(0x04a5), rev 1.20
> port 2 powered

I've been meaning to write this up, so here's a first pass, and I used 
your specific scanner as the example.  Feedback welcome...


Making FreeBSD Recognize A USB Scanner That Shows As "ugen"

1. Install FreeBSD source

2. Find the new device's product and vendor codes

# usbdevs -v
-- Controller /dev/usb2:
addr 1: full speed, self powered, config 1, UHCI root hub(0x0000),
VIA(0x0000), rev 1.00
  port 1 addr 2: full speed, self powered, config 1, FlatbedScanner 22(0x20b0),
Color(0x04a5), rev 1.20
  port 2 powered

The product code is shown first, then the vendor, so this is product
0x20b0 from vendor 0x04a5.

3. Add product and vendor codes to USB modules

# cd /usr/src/sys/dev/usb

Add vendor and product codes to /usr/src/sys/dev/usb/usbdevs.  For
example, the vendor code (0x04a5) shows that this "DiamondView DV650U"
is really an Acer scanner.  According to

http://www.sane-project.org

it is a rebadged Acer 4300, and Acer is now called Benq, so device names
can be somewhat variable.  We'll just call it an Acerscan 4300.

/usr/src/sys/dev/usb/usbdevs already has ACERP 0x04a5 as a vendor, so we
just have to add the product code for this scanner.  Search down in the
file for the list of ACERP products, copy and paste the line for one of
the other scanners, and change it:

product ACERP ACERSCAN_4300     0x20b0  Acerscan 4300

Following the instructions at the top of the file, use make to generate
the other USB source files:

# make -f Makefile.usbdevs

4. Add scanner string to uscanner.c

Now we need to add the new device to /usr/src/sys/dev/usb/uscanner.c. 
Find the ACERP section and copy one of the existing lines, modifying to
match the new device:

  {{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_4300 }, 0 },

5. Install

# cd /usr/src/sys/modules/usb
# make all install

6. Submit PR

After you've got the new device recognized and showing "uscanner" on
connection rather than "ugen", use send-pr to submit the changes you've
made to usbdevs and uscanner.c.


Notes

It's been a while since I've done this; if any steps are missing
or incorrect, please let me know.

This procedure only gets FreeBSD to recognize the scanner.  SANE
configuration is still required to use it with that program.

A cvsup of your source files will overwrite these changes.  That's why
step 6 is important.  Once the changes have been committed to the
FreeBSD source tree, they will be permanent improvements to FreeBSD's
scanner support.


-Warren Block * Rapid City, South Dakota USA


More information about the freebsd-questions mailing list