diff options
author | thompsa <thompsa@FreeBSD.org> | 2009-04-05 18:20:13 +0000 |
---|---|---|
committer | thompsa <thompsa@FreeBSD.org> | 2009-04-05 18:20:13 +0000 |
commit | f69b0a755f98343aabcba52ce0e14dd4a70d8d78 (patch) | |
tree | 7f7afe1d0936c65d14daefc601019b20b69d5964 | |
parent | 50e6ad14e556fcc8682c56be4b9185c7d1078231 (diff) | |
download | FreeBSD-src-f69b0a755f98343aabcba52ce0e14dd4a70d8d78.zip FreeBSD-src-f69b0a755f98343aabcba52ce0e14dd4a70d8d78.tar.gz |
MFp4 //depot/projects/usb@159897
Add new endpoint direction values for use with usb2_config
Submitted by: Hans Petter Selasky
-rw-r--r-- | sys/dev/usb/usb.h | 6 | ||||
-rw-r--r-- | sys/dev/usb/usb_device.c | 10 |
2 files changed, 13 insertions, 3 deletions
diff --git a/sys/dev/usb/usb.h b/sys/dev/usb/usb.h index fa5e5dd..3d9dcc3 100644 --- a/sys/dev/usb/usb.h +++ b/sys/dev/usb/usb.h @@ -461,8 +461,10 @@ struct usb2_endpoint_descriptor { uByte bEndpointAddress; #define UE_GET_DIR(a) ((a) & 0x80) #define UE_SET_DIR(a,d) ((a) | (((d)&1) << 7)) -#define UE_DIR_IN 0x80 -#define UE_DIR_OUT 0x00 +#define UE_DIR_IN 0x80 /* IN-token endpoint, fixed */ +#define UE_DIR_OUT 0x00 /* OUT-token endpoint, fixed */ +#define UE_DIR_RX 0xfd /* for internal use only! */ +#define UE_DIR_TX 0xfe /* for internal use only! */ #define UE_DIR_ANY 0xff /* for internal use only! */ #define UE_ADDR 0x0f #define UE_ADDR_ANY 0xff /* for internal use only! */ diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c index 7ce59fb..9ae7b61 100644 --- a/sys/dev/usb/usb_device.c +++ b/sys/dev/usb/usb_device.c @@ -174,7 +174,15 @@ usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index, /* setup expected endpoint direction mask and value */ - if (setup->direction == UE_DIR_ANY) { + if (setup->direction == UE_DIR_RX) { + ea_mask = (UE_DIR_IN | UE_DIR_OUT); + ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ? + UE_DIR_OUT : UE_DIR_IN; + } else if (setup->direction == UE_DIR_TX) { + ea_mask = (UE_DIR_IN | UE_DIR_OUT); + ea_val = (udev->flags.usb2_mode == USB_MODE_DEVICE) ? + UE_DIR_IN : UE_DIR_OUT; + } else if (setup->direction == UE_DIR_ANY) { /* match any endpoint direction */ ea_mask = 0; ea_val = 0; |