PERFORCE change 166176 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Thu Jul 16 20:14:55 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=166176
Change 166176 by hselasky at 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);
More information about the p4-projects
mailing list