From 81b818b42156d3a6816f6a57072b992b0072c78a Mon Sep 17 00:00:00 2001 From: augustss Date: Thu, 27 Dec 2001 11:24:42 +0000 Subject: [PATCH] Add usbd_get_protocol(). --- sys/dev/usb/usbdi_util.c | 23 +++++++++++++++++++++-- sys/dev/usb/usbdi_util.h | 3 ++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index d245c8be2b36..9cff0d73ec3b 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi_util.c,v 1.38 2001/12/18 14:50:01 augustss Exp $ */ +/* $NetBSD: usbdi_util.c,v 1.39 2001/12/27 11:24:42 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi_util.c,v 1.14 1999/11/17 22:33:50 n_hibma Exp $ */ /* @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.38 2001/12/18 14:50:01 augustss Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi_util.c,v 1.39 2001/12/27 11:24:42 augustss Exp $"); #include #include @@ -222,6 +222,25 @@ usbd_set_port_feature(usbd_device_handle dev, int port, int sel) return (usbd_do_request(dev, &req, 0)); } +usbd_status +usbd_get_protocol(usbd_interface_handle iface, u_int8_t *report) +{ + usb_interface_descriptor_t *id = usbd_get_interface_descriptor(iface); + usbd_device_handle dev; + usb_device_request_t req; + + DPRINTFN(4, ("usbd_get_protocol: iface=%p, endpt=%d\n", + iface, id->bInterfaceNumber)); + if (id == NULL) + return (USBD_IOERROR); + usbd_interface2device_handle(iface, &dev); + req.bmRequestType = UT_READ_CLASS_INTERFACE; + req.bRequest = UR_GET_PROTOCOL; + USETW(req.wValue, 0); + USETW(req.wIndex, id->bInterfaceNumber); + USETW(req.wLength, 1); + return (usbd_do_request(dev, &req, report)); +} usbd_status usbd_set_protocol(usbd_interface_handle iface, int report) diff --git a/sys/dev/usb/usbdi_util.h b/sys/dev/usb/usbdi_util.h index 79f0e131988e..23054153f326 100644 --- a/sys/dev/usb/usbdi_util.h +++ b/sys/dev/usb/usbdi_util.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi_util.h,v 1.25 2001/12/18 14:50:01 augustss Exp $ */ +/* $NetBSD: usbdi_util.h,v 1.26 2001/12/27 11:24:42 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usbdi_util.h,v 1.9 1999/11/17 22:33:50 n_hibma Exp $ */ /* @@ -54,6 +54,7 @@ usbd_status usbd_set_port_feature(usbd_device_handle dev, int, int); usbd_status usbd_clear_port_feature(usbd_device_handle, int, int); usbd_status usbd_get_device_status(usbd_device_handle,usb_status_t*); usbd_status usbd_get_hub_status(usbd_device_handle, usb_hub_status_t *); +usbd_status usbd_get_protocol(usbd_interface_handle dev, u_int8_t *report); usbd_status usbd_set_protocol(usbd_interface_handle dev, int report); usbd_status usbd_get_report_descriptor(usbd_device_handle dev, int ifcno, int size, void *d);