Re: ulpt problem (USB_ERR_IOERROR)

From: Hans Petter Selasky <hselasky_at_c2i.net>
Date: Thu, 16 Jul 2009 22:22:10 +0200
Hi,

On Thursday 16 July 2009 21:55:28 Patrick Lamaiziere wrote:
> Le Mon, 13 Jul 2009 08:46:50 +0200,
>
> Hans Petter Selasky <hselasky_at_c2i.net> a écrit :
> > The printing works besides from the status failing?
>
> Yes.
>
>
> Do you mean here? :
Yes.
> [ULPT_INTR_DT_RD] = { .type = UE_CONTROL,
> ...
>    .timeout = 20000,        /* 20 second */
>
> If yes, I tried but this does not change anything. I also tried to
> change the ticks of the callout_reset in usb_watchdog().
>
> But If I remove the transfer start in usb_watchdog() (so I never read
> the status of the printer), it works well.

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]);


> With cups and without the deframentation of the datas to write it seems
> to work too (the same configuration as the top of this thread). Are you
> sure this it required by my printer?

No. I've removed that patch.

> 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:

man cv_wait_sig

You have to do a "kill" to kill it. What I've seen is the code hangs in the 
flushing loop in the close call:

			/* check if flushed already */
			while (f->flag_flushing &&
			    (!f->flag_iserror)) {
				/* wait until all data has been written */
				f->flag_sleeping = 1;
				err = cv_wait_sig(&f->cv_io, f->priv_mtx);
				if (err) {
					DPRINTF("signal received\n");
					break;
				}
			}

I have no idea why. Seems like the signals are blocked, so that CTRL+C is not 
passed another time! Please investigate, if you have some time.

New patch:

1) cvsup to 8-current.
2) Replace serial/ulpt.c with the one from USB P4

http://perforce.freebsd.org/chv.cgi?CH=166176

--HPS
Received on Thu Jul 16 2009 - 18:22:30 UTC

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