Subject: Re: usb printers?
To: Lennart Augustsson <lennart@augustsson.net>
From: Alfred Perlstein <bright@mu.org>
List: tech-kern
Date: 02/25/2002 14:07:41
* Lennart Augustsson <lennart@augustsson.net> [020224 16:39] wrote:
> Alfred Perlstein wrote:
> 
> > Well I just booted a 1.5AZ kernel and it didn't seem to like it
> > all that much.  I'll tell you more after I get it installed.
> 
> What printer?
> 
> 
> > Any chance I can convince you to look at what we did wrong in FreeBSD
> > wrt to USB?  Printing seems really broken, in fact 'cat /dev/ulpt0'
> > under -stable causes a hang when and a crash under -current when
> > cat ternimates and the device node is closed.
> 
> 'cat /dev/ulpt0'?  On NetBSD you can't open /dev/ulpt0 for reading.  It's not
> made for that.

What about ioctls?  What about bi-directional transfers?

Anyhow, here's a patch that fixes a hang for me,
otherwise you pass the RequestType in uninitialized:


Index: ulpt.c
===================================================================
RCS file: /home/netcvs/syssrc/sys/dev/usb/ulpt.c,v
retrieving revision 1.48
diff -u -r1.48 ulpt.c
--- ulpt.c	2002/02/11 15:11:49	1.48
+++ ulpt.c	2002/02/26 01:06:36
@@ -454,6 +467,7 @@
 	 * UT_WRITE_CLASS_INTERFACE.  Many printers use the old one,
 	 * so we try both.
 	 */
+	req.bmRequestType = UT_WRITE_CLASS_OTHER;
 	if (usbd_do_request(sc->sc_udev, &req, 0)) {	/* 1.0 */
 		req.bmRequestType = UT_WRITE_CLASS_INTERFACE;
 		(void)usbd_do_request(sc->sc_udev, &req, 0); /* 1.1 */