From owner-freebsd-current@FreeBSD.ORG Fri Jul 17 06:54:54 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 1DB811065670 for ; Fri, 17 Jul 2009 06:54:54 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.swip.net [212.247.154.33]) by mx1.freebsd.org (Postfix) with ESMTP id A68868FC13 for ; Fri, 17 Jul 2009 06:54:53 +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=dT19lrtdAAAA:8 a=isXxE2cy6gNJ0YLftV0A:9 a=pOZlE0SHg40TgpsHlqsA:7 a=L2A70rfahtqhD6lx8nz9m6L4lPsA:4 a=9aOQ2cSd83gA:10 Received: from [194.248.135.20] (account mc467741@c2i.net HELO laptop.adsl.tele2.no) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.13) with ESMTPA id 1288593178; Fri, 17 Jul 2009 08:54:51 +0200 From: Hans Petter Selasky To: Patrick Lamaiziere Date: Fri, 17 Jul 2009 08:54:34 +0200 User-Agent: KMail/1.11.4 (FreeBSD/8.0-BETA2; KDE/4.2.4; i386; ; ) References: <20090703172600.1971111e@baby-jane.lamaiziere.net> <200907162222.11736.hselasky@c2i.net> <20090717005002.1ffccfff@baby-jane.lamaiziere.net> In-Reply-To: <20090717005002.1ffccfff@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: <200907170854.35902.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: Fri, 17 Jul 2009 06:54:54 -0000 On Friday 17 July 2009 00:50:02 Patrick Lamaiziere wrote: > Le Thu, 16 Jul 2009 22:22:10 +0200, > Hi, > Hans Petter Selasky a =E9crit : > > Could you try to add an "if (sc->sc_fflags =3D=3D 0)" in front, like th= is: > > > > /* > > * Only read status while the device is not opened, due to > > * possible hardware or firmware bug in some printers. > > */ > > if (sc->sc_fflags =3D=3D 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=3DFREEBSD7#L637 I think your USB device has a hardware bug, where if a control transfer and= a=20 bulk transfer is started at the same time, it will crash the USB hardware i= n=20 your printer. The status is read like a control transfer and the printer da= ta=20 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. =2D-HPS