Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Aug 2004 21:04:42 +0930
From:      Ian Moore <imoore@picknowl.com.au>
To:        freebsd-questions@freebsd.org
Subject:   Re: FreeBSD scanners
Message-ID:  <200408232104.43173.imoore@picknowl.com.au>
In-Reply-To: <20040822091151.T16695@wonkity.com>
References:  <411E9639.2070609@spintech.ro> <200408222217.04232.imoore@picknowl.com.au> <20040822091151.T16695@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--Boundary-02=_TZdKB9NHnYqAiYH
Content-Type: text/plain;
  charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Mon, 23 Aug 2004 00:45, Warren Block wrote:
> 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

Thanks for replying Warren. I hope I can be of help in getting this=20
documented.
I've followed your instructions carefully, but my scanner still comes up as=
=20
ugen0.

I have the following in /usr/src/sys/dev/usb/usbdevs
/* Acer Peripherals, Inc. products */
product ACERP ACERSCAN_C310U    0x12a6  Acerscan C310U
product ACERP ACERSCAN_320U     0x2022  Acerscan 320U
product ACERP ACERSCAN_640U     0x2040  Acerscan 640U
product ACERP ACERSCAN_620U     0x2060  Acerscan 620U
product ACERP ACERSCAN_4300     0x20b0  Acerscan 4300

and in /usr/src/sys/dev/usb/uscanner.c

  /* Acer Peripherals */
 {{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_320U }, 0 },
 {{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_640U }, 0 },
 {{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_620U }, 0 },
 {{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_C310U }, 0 },
 {{ USB_VENDOR_ACERP, USB_PRODUCT_ACERP_ACERSCAN_4300 }, 0 },

then I did

daemon:/usr/src/sys/dev/usb % sudo make -f Makefile.usbdevs
which output:
/bin/rm -f usbdevs.h usbdevs_data.h
awk -v type=3DUSB -v os=3D`uname -s` -f devlist2h.awk usbdevs

Then I did:
daemon:/usr/src/sys/dev/usb % cd /usr/src/sys/modules/usb
daemon:/usr/src/sys/modules/usb % sudo make all install

This gives lots of output, but ends with:
touch /usr/src/sys/modules/usb/export_syms
awk -f /usr/src/sys/modules/usb/../../conf/kmod_syms.awk=20
usb.kld  /usr/src/sys/modules/usb/export_syms |  xargs -J% objcopy % usb.kld
ld -Bshareable  -d -warn-common -o usb.ko usb.kld
install -o root -g wheel -m 555   usb.ko /boot/kernel
kldxref /boot/kernel

After that, I rebooted & plugged the scanner in, but the response was:
Aug 23 20:40:55 daemon kernel: ugen0: Color FlatbedScanner 22, rev 1.00/1.2=
0,=20
addr 2

My kernel has the following USB devices in it:
uhci ohci usb ugen uhid ukbd ulpt umass ums  urio uscanner=20

I guess there's some step missing or wrong, but I don't know what.
BTW, I'm using 5.2.1-RELEASE=20

Cheers,
=2D-=20
Ian Moore

GPG Key: http://homepages.picknowl.com.au/imoore/imoore.asc
I delete all HTML mail unopened





--Boundary-02=_TZdKB9NHnYqAiYH
Content-Type: application/pgp-signature
Content-Description: signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQBBKdZTfITqkXhImmIRAnMoAJ0aoRjMDtOp/+N+9JMnSmPH3Pn0yQCfUlzz
NTdvytuKXh77QJl33rFyLWQ=
=+dQt
-----END PGP SIGNATURE-----

--Boundary-02=_TZdKB9NHnYqAiYH--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200408232104.43173.imoore>