From d6ef9cbb33658c71d98ce85bfc30adca4f70a8c0 Mon Sep 17 00:00:00 2001 From: augustss Date: Thu, 23 Jul 1998 13:44:21 +0000 Subject: [PATCH] Add some comments and a function to set the alternate settings in an interface. --- sys/dev/usb/uhci.c | 14 +++++++++----- sys/dev/usb/usbdi.c | 19 ++++++++++++++++--- sys/dev/usb/usbdi.h | 3 ++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c index 6f930fff9f85..e13392187917 100644 --- a/sys/dev/usb/uhci.c +++ b/sys/dev/usb/uhci.c @@ -1,4 +1,4 @@ -/* $NetBSD: uhci.c,v 1.5 1998/07/23 09:18:37 augustss Exp $ */ +/* $NetBSD: uhci.c,v 1.6 1998/07/23 13:44:21 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1216,8 +1216,9 @@ void uhci_device_bulk_abort(reqh) usbd_request_handle reqh; { - /* XXX */ - usbd_delay_ms(2); /* make sure it is finished */ + /* XXX inactivate */ + usbd_delay_ms(1); /* make sure it is finished */ + /* XXX call done */ } /* Close a device bulk pipe. */ @@ -1330,8 +1331,9 @@ void uhci_device_ctrl_abort(reqh) usbd_request_handle reqh; { - /* XXX */ - usbd_delay_ms(2); /* make sure it is finished */ + /* XXX inactivate */ + usbd_delay_ms(1); /* make sure it is finished */ + /* XXX call done */ } /* Close a device control pipe. */ @@ -1352,6 +1354,7 @@ uhci_device_intr_abort(reqh) { struct uhci_pipe *upipe; + /* XXX inactivate */ usbd_delay_ms(2); /* make sure it is finished */ if (reqh->pipe->intrreqh == reqh) { DPRINTF(("uhci_device_intr_abort: remove\n")); @@ -2238,6 +2241,7 @@ void uhci_root_ctrl_abort(reqh) usbd_request_handle reqh; { + /* Nothing to do, all transfers are syncronous. */ } /* Close the root pipe. */ diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index 269dfe31009a..f03cf5ac8b94 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.2 1998/07/22 12:22:09 augustss Exp $ */ +/* $NetBSD: usbdi.c,v 1.3 1998/07/23 13:44:22 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -60,8 +60,6 @@ extern int usbdebug; #define DPRINTFN(n,x) #endif -#define X { printf("usbdi: unimplemented\n"); return USBD_XXX; } - static usbd_status usbd_ar_pipe __P((usbd_pipe_handle pipe)); static usbd_status usbd_ar_iface __P((usbd_interface_handle iface)); static void usbd_transfer_cb __P((usbd_request_handle reqh)); @@ -766,6 +764,21 @@ usbd_unlock(tok) splx(tok); } +/* XXX need to check that the interface is idle */ +usbd_status +usbd_set_interface(iface, aiface) + usbd_interface_handle iface; + int aiface; +{ + usb_device_request_t req; + + req.bmRequestType = UT_WRITE_INTERFACE; + req.bRequest = UR_SET_INTERFACE; + USETW(req.wValue, aiface); + USETW(req.wIndex, iface->idesc->iInterface); + USETW(req.wLength, 0); + return usbd_do_request(iface->device, &req, 0); +} /*** Internal routines ***/ diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index d7b69126eada..adf9e9e34bcd 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.h,v 1.1 1998/07/12 19:52:01 augustss Exp $ */ +/* $NetBSD: usbdi.h,v 1.2 1998/07/23 13:44:22 augustss Exp $ */ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -213,6 +213,7 @@ usb_config_descriptor_t *usbd_get_config_descriptor __P((usbd_device_handle dev)); usb_device_descriptor_t *usbd_get_device_descriptor __P((usbd_device_handle dev)); +usbd_status usbd_set_interface __P((usbd_interface_handle, int)); /* NetBSD attachment information */