summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>1999-05-30 13:03:00 +0000
committern_hibma <n_hibma@FreeBSD.org>1999-05-30 13:03:00 +0000
commitd13d00dd201d56537ddf0fa9877ac26d1016a4fd (patch)
treee6c99fa93bb70f7c38c7e2841dc92126f1500ecd
parent6dc9d0ed10ee69e634f3fdfd4d5bd97f3a6464ba (diff)
downloadFreeBSD-src-d13d00dd201d56537ddf0fa9877ac26d1016a4fd.zip
FreeBSD-src-d13d00dd201d56537ddf0fa9877ac26d1016a4fd.tar.gz
1) Add URL for printer class specification
2) Change name of UE_IN to UE_DIR 3) Enable printing of the Printer Id string 4) Clean up debugging output while we are at it.
-rw-r--r--sys/dev/usb/ulpt.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/sys/dev/usb/ulpt.c b/sys/dev/usb/ulpt.c
index 196e79e..b997e3d 100644
--- a/sys/dev/usb/ulpt.c
+++ b/sys/dev/usb/ulpt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ulpt.c,v 1.10 1999/01/08 11:58:25 augustss Exp $ */
+/* $NetBSD: ulpt.c,v 1.11 1999/01/10 11:13:36 augustss Exp $ */
/* $FreeBSD$ */
/*
@@ -38,6 +38,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+/*
+ * Printer Class spec: http://www.usb.org/developers/data/usbprn10.pdf
+ */
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/proc.h>
@@ -173,10 +177,8 @@ USB_ATTACH(ulpt)
usbd_device_handle dev = uaa->device;
usbd_interface_handle iface = uaa->iface;
usb_interface_descriptor_t *id = usbd_get_interface_descriptor(iface);
-#if 0
usb_config_descriptor_t *cd = usbd_get_config_descriptor(dev);
usb_device_request_t req;
-#endif
char devinfo[1024];
usb_endpoint_descriptor_t *ed;
usbd_status r;
@@ -191,7 +193,7 @@ USB_ATTACH(ulpt)
ed = usbd_interface2endpoint_descriptor(iface, 0);
if (!ed)
goto nobulk;
- if ((ed->bEndpointAddress & UE_IN) != UE_OUT ||
+ if ((ed->bEndpointAddress & UE_DIR) != UE_OUT ||
(ed->bmAttributes & UE_XFERTYPE) != UE_BULK) {
/* In case we are using a bidir protocol... */
ed = usbd_interface2endpoint_descriptor(iface, 1);
@@ -210,15 +212,12 @@ USB_ATTACH(ulpt)
USB_ATTACH_ERROR_RETURN;
sc->sc_ifaceno = id->bInterfaceNumber;
-#if 0
-XXX needs a different way to read the id string since the length
-is unknown. usbd_do_request() returns error on a short transfer.
req.bmRequestType = UT_READ_CLASS_INTERFACE;
req.bRequest = UR_GET_DEVICE_ID;
USETW(req.wValue, cd->bConfigurationValue);
USETW2(req.wIndex, id->bInterfaceNumber, id->bAlternateSetting);
USETW(req.wLength, sizeof devinfo - 1);
- r = usbd_do_request(dev, &req, devinfo);
+ r = usbd_do_request_flags(dev, &req, devinfo, USBD_SHORT_XFER_OK, NULL);
if (r == USBD_NORMAL_COMPLETION) {
int len;
char *idstr;
@@ -230,7 +229,6 @@ is unknown. usbd_do_request() returns error on a short transfer.
} else {
printf("%s: cannot get device id\n", USBDEVNAME(sc->sc_dev));
}
-#endif
USB_ATTACH_SUCCESS_RETURN;
@@ -369,7 +367,6 @@ ulptclose(dev, flag, mode, p)
sc->sc_state = 0;
- DPRINTF(("ulptclose: closed\n"));
return (0);
}
@@ -386,7 +383,6 @@ ulptwrite(dev, uio, flags)
usbd_status r;
USB_GET_SC(ulpt, ULPTUNIT(dev), sc);
- DPRINTF(("ulptwrite\n"));
reqh = usbd_alloc_request();
if (reqh == 0)
return (ENOMEM);
@@ -405,7 +401,7 @@ ulptwrite(dev, uio, flags)
DPRINTFN(1, ("ulptwrite: transfer %d bytes\n", n));
r = usbd_sync_transfer(reqh);
if (r != USBD_NORMAL_COMPLETION) {
- DPRINTF(("ulptwrite: error=%d\n", r));
+ DPRINTFN(1, ("ulptwrite: error=%d\n", r));
usbd_clear_endpoint_stall(sc->sc_bulkpipe);
error = EIO;
break;
OpenPOWER on IntegriCloud