From owner-freebsd-current@FreeBSD.ORG Mon Jul 13 01:41:06 2009 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5E6CA1065670 for ; Mon, 13 Jul 2009 01:41:06 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from smtp.lamaiziere.net (net.lamaiziere.net [91.121.44.19]) by mx1.freebsd.org (Postfix) with ESMTP id 0D0A98FC19 for ; Mon, 13 Jul 2009 01:41:05 +0000 (UTC) (envelope-from patfbsd@davenulle.org) Received: from baby-jane.lamaiziere.net (105.10.87-79.rev.gaoland.net [79.87.10.105]) by smtp.lamaiziere.net (Postfix) with ESMTPA id 6114963317E; Mon, 13 Jul 2009 03:41:04 +0200 (CEST) Received: from baby-jane.lamaiziere.net (localhost [127.0.0.1]) by baby-jane.lamaiziere.net (Postfix) with ESMTP id 499CDBBFA; Mon, 13 Jul 2009 03:41:03 +0200 (CEST) Date: Mon, 13 Jul 2009 03:41:02 +0200 From: Patrick Lamaiziere To: Hans Petter Selasky 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> X-Mailer: Claws Mail 3.7.2 (GTK+ 2.16.4; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org Subject: Re: ulpt problem (USB_ERR_IOERROR) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Jul 2009 01:41:06 -0000 Le Sun, 12 Jul 2009 09:52:29 +0200, Hans Petter Selasky 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.