Date: Mon, 13 Jul 2009 03:41:02 +0200 From: Patrick Lamaiziere <patfbsd@davenulle.org> To: Hans Petter Selasky <hselasky@c2i.net> Cc: freebsd-current@freebsd.org Subject: Re: ulpt problem (USB_ERR_IOERROR) Message-ID: <20090713034102.1362d27d@baby-jane.lamaiziere.net> In-Reply-To: <200907120952.30158.hselasky@c2i.net> References: <20090703172600.1971111e@baby-jane.lamaiziere.net> <200907072039.27811.hselasky@c2i.net> <20090711232635.24b28f1f@baby-jane.lamaiziere.net> <200907120952.30158.hselasky@c2i.net>
next in thread | previous in thread | raw e-mail | index | archive | help
Le Sun, 12 Jul 2009 09:52:29 +0200, Hans Petter Selasky <hselasky@c2i.net> a =E9crit : > > But the printer hangs after the first job (the data led on the > > printer stay on): > > unlpt_open: using defrag write mode > > ulpt_write_callback:237: state=3D0x0 actlen=3D0 > > ulpt_write_callback:237: state=3D0x1 actlen=3D32768 > > ulpt_write_callback:237: state=3D0x1 actlen=3D32768 > > ulpt_write_callback:237: state=3D0x1 actlen=3D32768 > > >=20 > The prints look good. >=20 > Did you restart/repower the printer, before trying to print? Oh yes, several times. > What document format is being used on /dev/ulpt? Maybe you have to > use another format. Did you use the correct PPD file for your > printer? I have a brother printer here which uses USB, and claims to > support PCL 6, but whenever I print something in PCL 6, it's not > recognized. I found out I had to download a special PPD file, and > install foomatic-rip, for cups. Then it worked using the GDI protocol. No the format is good, I've saved the file sent by cups to unlpt0 and tried this file several times on a 7.0-RELEASE=20 (cat file > /dev/unlpt0). It works fine on 7.X.=20 Now, i use this file on 8.0 to test without cups. But there was a small problem with your previous patch in usb_dev.c: static int usb_write(struct cdev *dev, struct uio *uio, int ioflag) { ... if (f->flag_have_fragment =3D=3D 0) { USB_MBUF_RESET(m); =20 io_len =3D m->cur_data_len; pdata =3D m->cur_data_ptr; if (io_len > uio->uio_resid) io_len =3D uio->uio_resid; m->cur_data_len =3D io_len; } else { io_len =3D m->max_data_len - m->cur_data_len; --- pdata =3D m->cur_data_ptr + io_len; +++ pdata =3D m->cur_data_ptr + m->cur_data_len; Now I've got some USB_ERR_STALLED errors but I'm able to print 3 or 4 times. unlpt_open: using defrag write mode=20 ulpt_write_callback:237: state=3D0x0 actlen=3D29561=20 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_status_callback:369: error=3DUSB_ERR_TIMEOUT ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_status_callback:369: error=3DUSB_ERR_STALLED ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_write_callback:237: state=3D0x1 actlen=3D32768 ulpt_status_callback:369: error=3DUSB_ERR_STALLED ulpt_write_callback:237: state=3D0x1 actlen=3D29561 ulpt_status_callback:369: error=3DUSB_ERR_STALLED ulpt_status_callback:369: error=3DUSB_ERR_STALLED (...) It looks like there is a probem to get the status. FreeBSD 7.0 uses a flag USBD_SHORT_XFER_OK, so I tried to add a flag .short_xfer_ok =3D 1 and to increase the timeout. But without luck. [ULPT_INTR_DT_RD] =3D { .type =3D UE_CONTROL, .endpoint =3D 0x00, /* Control pipe */ .direction =3D UE_DIR_ANY, .bufsize =3D sizeof(struct usb_device_request) + 1, .flags =3D {.short_xfer_ok =3D 1}, .callback =3D &ulpt_status_callback, .timeout =3D 5000, /* 5 second */ }, Thanks.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090713034102.1362d27d>