Re: ulpt problem (USB_ERR_IOERROR)

From: Hans Petter Selasky <hselasky_at_c2i.net>
Date: Fri, 17 Jul 2009 08:54:34 +0200
On Friday 17 July 2009 00:50:02 Patrick Lamaiziere wrote:
> Le Thu, 16 Jul 2009 22:22:10 +0200,
>

Hi,

> Hans Petter Selasky <hselasky_at_c2i.net> a écrit :
> > Could you try to add an "if (sc->sc_fflags == 0)" in front, like this:
> >
> > 	/*
> > 	 * Only read status while the device is not opened, due to
> > 	 * possible hardware or firmware bug in some printers.
> > 	 */
> > 	if (sc->sc_fflags == 0)
> > 		usbd_transfer_start(sc->sc_xfer[ULPT_INTR_DT_RD]);
>
> It works fine with this check. Cool!

I think this is the final patch.

> But why, that is not clear. FreeBSD 7.2 checks the status of the
> printer only when the device is opened and before each write.
> http://fxr.watson.org/fxr/source/dev/usb/ulpt.c?v=FREEBSD7#L637

I think your USB device has a hardware bug, where if a control transfer and a 
bulk transfer is started at the same time, it will crash the USB hardware in 
your printer. The status is read like a control transfer and the printer data 
is sent like bulk transfers.

>
> > > Not related but I noticed that usb_write() in usb_dev.c returns -1
> > > if I hit Ctrl-C when doing a "cat file > /dev/unlpt0". Because
> > > usb_fifo_wait(f) returns -1 (should be EINTR?).
> >
> > If cv_wait_sig() returns -1, then they do not behave like in the
> > manual page:
>
> Yes I saw, I will try to dig more into the code.
> (will open a new thread for this)
>

Ok.

--HPS
Received on Fri Jul 17 2009 - 04:54:54 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:52 UTC