From owner-freebsd-current@FreeBSD.ORG Mon Jul 13 06:47:16 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 997F3106564A for ; Mon, 13 Jul 2009 06:47:16 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe09.swipnet.se [212.247.155.1]) by mx1.freebsd.org (Postfix) with ESMTP id 170178FC08 for ; Mon, 13 Jul 2009 06:47:15 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.0 c=1 a=BQeo18V-fugA:10 a=gg2W7PyvkLb8p4ie143lBA==:17 a=8kQB0OdkAAAA:8 a=KBC4pmnOWhsKKR86sE0A:9 a=gg1cJVDTZNdRjDOBbbkA:7 a=X6-PkTuFYvEcakZu3DB5XT89FioA:4 a=9aOQ2cSd83gA:10 Received: from [194.248.135.20] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe09.swip.net (CommuniGate Pro SMTP 5.2.13) with ESMTPA id 931155294; Mon, 13 Jul 2009 08:47:13 +0200 From: Hans Petter Selasky To: Patrick Lamaiziere Date: Mon, 13 Jul 2009 08:46:50 +0200 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA1; KDE/4.2.4; i386; ; ) References: <20090703172600.1971111e@baby-jane.lamaiziere.net> <200907120952.30158.hselasky@c2i.net> <20090713034102.1362d27d@baby-jane.lamaiziere.net> In-Reply-To: <20090713034102.1362d27d@baby-jane.lamaiziere.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200907130846.51980.hselasky@c2i.net> 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 06:47:16 -0000 On Monday 13 July 2009 03:41:02 Patrick Lamaiziere wrote: > 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 > > > > The prints look good. > > > > 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 > (cat file > /dev/unlpt0). It works fine on 7.X. > 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); > 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; > Yes, you are right there. Should be fixed in USB P4. This patch is not yet = in=20 8-current. > > 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 > ulpt_write_callback:237: state=3D0x0 actlen=3D29561 > 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 > (...) > The printing works besides from the status failing? > 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. Could you try increasing the timeout to 20 seconds? Maybe the printer USB=20 firmware is really simple and can only do one request at a time? > [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 */ > }, > =2D-HPS