From owner-p4-projects@FreeBSD.ORG Thu Jul 16 20:14:55 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7A757106568A; Thu, 16 Jul 2009 20:14:54 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 36ED91065674 for ; Thu, 16 Jul 2009 20:14:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 0AC8F8FC1C for ; Thu, 16 Jul 2009 20:14:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n6GKErqp024776 for ; Thu, 16 Jul 2009 20:14:53 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n6GKErpn024774 for perforce@freebsd.org; Thu, 16 Jul 2009 20:14:53 GMT (envelope-from hselasky@FreeBSD.org) Date: Thu, 16 Jul 2009 20:14:53 GMT Message-Id: <200907162014.n6GKErpn024774@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 166176 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2009 20:14:55 -0000 http://perforce.freebsd.org/chv.cgi?CH=166176 Change 166176 by hselasky@hselasky_laptop001 on 2009/07/16 20:14:28 ULPT: - revert defrag patch - add conditional printer status checking Affected files ... .. //depot/projects/usb/src/sys/dev/usb/serial/ulpt.c#17 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/serial/ulpt.c#17 (text+ko) ==== @@ -110,7 +110,6 @@ struct ulpt_softc { struct usb_fifo_sc sc_fifo; struct usb_fifo_sc sc_fifo_noreset; - struct usb_fifo_sc sc_fifo_raw; struct mtx sc_mtx; struct usb_callout sc_watchdog; @@ -148,7 +147,6 @@ static usb_fifo_ioctl_t ulpt_ioctl; static usb_fifo_open_t ulpt_open; static usb_fifo_open_t unlpt_open; -static usb_fifo_open_t urlpt_open; static struct usb_fifo_methods ulpt_fifo_methods = { .f_close = &ulpt_close, @@ -172,17 +170,6 @@ .basename[0] = "unlpt", }; -static struct usb_fifo_methods urlpt_fifo_methods = { - .f_close = &ulpt_close, - .f_ioctl = &ulpt_ioctl, - .f_open = &urlpt_open, - .f_start_read = &ulpt_start_read, - .f_start_write = &ulpt_start_write, - .f_stop_read = &ulpt_stop_read, - .f_stop_write = &ulpt_stop_write, - .basename[0] = "urlpt", -}; - static void ulpt_reset(struct ulpt_softc *sc) { @@ -432,27 +419,6 @@ } static int -urlpt_open(struct usb_fifo *fifo, int fflags) -{ - struct ulpt_softc *sc = usb_fifo_softc(fifo); - - /* we assume that open is a serial process */ - - if (sc->sc_fflags == 0) { - - /* reset USB paralell port */ - - ulpt_reset(sc); - } - /* set raw write mode */ - - if (fflags & FWRITE) { - usb_fifo_set_write_defrag(fifo, 0); - } - return (unlpt_open(fifo, fflags)); -} - -static int ulpt_open(struct usb_fifo *fifo, int fflags) { struct ulpt_softc *sc = usb_fifo_softc(fifo); @@ -465,11 +431,6 @@ ulpt_reset(sc); } - /* set defrag write mode */ - - if (fflags & FWRITE) { - usb_fifo_set_write_defrag(fifo, 1); - } return (unlpt_open(fifo, fflags)); } @@ -675,13 +636,6 @@ if (error) { goto detach; } - error = usb_fifo_attach(uaa->device, sc, &sc->sc_mtx, - &urlpt_fifo_methods, &sc->sc_fifo_raw, - unit, 0 - 1, uaa->info.bIfaceIndex, - UID_ROOT, GID_OPERATOR, 0644); - if (error) { - goto detach; - } /* start reading of status */ mtx_lock(&sc->sc_mtx); @@ -703,7 +657,6 @@ usb_fifo_detach(&sc->sc_fifo); usb_fifo_detach(&sc->sc_fifo_noreset); - usb_fifo_detach(&sc->sc_fifo_raw); mtx_lock(&sc->sc_mtx); usb_callout_stop(&sc->sc_watchdog); @@ -770,7 +723,12 @@ mtx_assert(&sc->sc_mtx, MA_OWNED); - usbd_transfer_start(sc->sc_xfer[ULPT_INTR_DT_RD]); + /* + * 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]); usb_callout_reset(&sc->sc_watchdog, hz, &ulpt_watchdog, sc);