Subject: ugen refusing writes
To: None <netbsd-users@netbsd.org>
From: Chris Baird <cjb@brushtail.apana.org.au>
List: netbsd-users
Date: 02/14/2001 16:32:50
System: NetBSD 1.5 "RELEASE"

While attempting to get a USB scanner configured for SANE under NetBSD
(I've already successfully done this with the same dual-boot system in
Linux), I've come across the problem of all writes to /dev/ugen0.00
returning ENODEV.

The usb attach information is thusly:

        ugen0 at uhub0 port 1
        ugen0: EPSON Perfection640  , rev 1.00/0.01, addr 2

/dev/ugen0.00 would be the correct device file to use, correct? (It's
the only one I can find that responds like it exists. I thought
/dev/ugen0.02 would could have been it, but that's not the case.)

"ktrace scanimage -L" reveals:

  2480 scanimage NAMI  "/dev/ugen0.00"
  2480 scanimage RET   open 5
  2480 scanimage CALL  write(0x5,0xbfbfcee6,0x2)
  2480 scanimage RET   write -1 errno 19 Operation not supported by device
  2480 scanimage CALL  write(0x5,0xbfbfb714,0x2)
  2480 scanimage RET   write -1 errno 19 Operation not supported by device
  2480 scanimage CALL  __fstat13(0x2,0xbfbfb634)
  2480 scanimage RET   __fstat13 0
  2480 scanimage CALL  write(0x2,0xbfbfaffc,0x15)
  2480 scanimage GIO   fd 2 wrote 21 bytes
       "[epson] ident failed\n"

Apparently this is the code responsible in /sys/dev/usb/ugen.c:ugen_do_write

	if (endpt == USB_CONTROL_ENDPOINT)
		return (ENODEV);

The ugen(4) man page seems to contradicts this:

     If an endpoint address is used both for input and output the device can
     be opened for both read or write.

(Btw, an Epson Perfection 640U has vendor=0x4b8, product=0x10c in case anyone
wants to update the usbdevs file.)

-- 
Chris Baird,, <cjb@brushtail.apana.org.au>