diff options
author | joe <joe@FreeBSD.org> | 2002-02-11 01:04:46 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2002-02-11 01:04:46 +0000 |
commit | d3bb574305f1a0155c84da7c6cd5624ecc72f32f (patch) | |
tree | 3156a844ee08ce96882f1a0d3b6dddb34de32a76 /sys/dev/usb/ulpt.c | |
parent | 0dea933ddd3c0cb3b936bc1ae8dcf9a0b5442a34 (diff) | |
download | FreeBSD-src-d3bb574305f1a0155c84da7c6cd5624ecc72f32f.zip FreeBSD-src-d3bb574305f1a0155c84da7c6cd5624ecc72f32f.tar.gz |
Merge from NetBSD: revs 1.43 + 1.45
From the NetBSD logs:
revision 1.45
date: 2001/11/29 11:07:12; author: augustss; state: Exp; lines: +12 -2
Plug a memory leak in an error case.
----------------------------
revision 1.43
date: 2001/10/19 15:30:25; author: nathanw; state: Exp; lines: +5 -3
Match printers that report their interface as IEEE 1284 in addition to
bidirectional.
Diffstat (limited to 'sys/dev/usb/ulpt.c')
-rw-r--r-- | sys/dev/usb/ulpt.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c index a28f4fe..6e48286 100644 --- a/sys/dev/usb/ulpt.c +++ b/sys/dev/usb/ulpt.c @@ -1,4 +1,4 @@ -/* $NetBSD: ulpt.c,v 1.42 2001/04/16 00:18:06 augustss Exp $ */ +/* $NetBSD: ulpt.c,v 1.46 2001/12/31 12:15:21 augustss Exp $ */ /* $FreeBSD$ */ /* @@ -44,12 +44,13 @@ #include <sys/param.h> #include <sys/systm.h> +#include <sys/proc.h> #include <sys/kernel.h> #if defined(__NetBSD__) || defined(__OpenBSD__) -#include <sys/proc.h> #include <sys/device.h> #include <sys/ioctl.h> #elif defined(__FreeBSD__) +#include <sys/ioccom.h> #include <sys/module.h> #include <sys/bus.h> #endif @@ -155,7 +156,9 @@ int ulpt_status(struct ulpt_softc *); void ulpt_reset(struct ulpt_softc *); int ulpt_statusmsg(u_char, struct ulpt_softc *); +#if 0 void ieee1284_print_id(char *); +#endif #define ULPTUNIT(s) (minor(s) & 0x1f) #define ULPTFLAGS(s) (minor(s) & 0xe0) @@ -176,7 +179,8 @@ USB_MATCH(ulpt) id->bInterfaceClass == UICLASS_PRINTER && id->bInterfaceSubClass == UISUBCLASS_PRINTER && (id->bInterfaceProtocol == UIPROTO_PRINTER_UNI || - id->bInterfaceProtocol == UIPROTO_PRINTER_BI)) + id->bInterfaceProtocol == UIPROTO_PRINTER_BI || + id->bInterfaceProtocol == UIPROTO_PRINTER_1284)) return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO); return (UMATCH_NONE); } @@ -225,7 +229,8 @@ USB_ATTACH(ulpt) id->bInterfaceNumber == ifcd->bInterfaceNumber) { if (id->bInterfaceClass == UICLASS_PRINTER && id->bInterfaceSubClass == UISUBCLASS_PRINTER && - id->bInterfaceProtocol == UIPROTO_PRINTER_BI) + (id->bInterfaceProtocol == UIPROTO_PRINTER_BI || + id->bInterfaceProtocol == UIPROTO_PRINTER_1284)) goto found; altno++; } @@ -328,6 +333,8 @@ USB_ATTACH(ulpt) UID_ROOT, GID_OPERATOR, 0644, "unlpt%d", device_get_unit(self)); #endif + usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, + USBDEV(sc->sc_dev)); USB_ATTACH_SUCCESS_RETURN; } @@ -402,6 +409,9 @@ USB_DETACH(ulpt) destroy_dev(sc->dev_noprime); #endif + usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, + USBDEV(sc->sc_dev)); + return (0); } @@ -461,7 +471,7 @@ ulpt_input(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) usbd_transfer(sc->sc_in_xfer1); } -int ulptusein = 0; +int ulptusein = 1; /* * Reset the printer, then wait until it's selected and not busy. @@ -542,8 +552,18 @@ ulptopen(dev_t dev, int flag, int mode, usb_proc_ptr p) sc->sc_in_xfer2 = usbd_alloc_xfer(sc->sc_udev); if (sc->sc_in_xfer1 == NULL || sc->sc_in_xfer2 == NULL) { error = ENOMEM; + if (sc->sc_in_xfer1 != NULL) { + usbd_free_xfer(sc->sc_in_xfer1); + sc->sc_in_xfer1 = NULL; + } + if (sc->sc_in_xfer2 != NULL) { + usbd_free_xfer(sc->sc_in_xfer2); + sc->sc_in_xfer2 = NULL; + } usbd_close_pipe(sc->sc_out_pipe); sc->sc_out_pipe = NULL; + usbd_close_pipe(sc->sc_in_pipe); + sc->sc_in_pipe = NULL; sc->sc_state = 0; goto done; } |