summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_device.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-04-05 18:20:38 +0000
committerthompsa <thompsa@FreeBSD.org>2009-04-05 18:20:38 +0000
commitf498dc2227c7edc88b3ba4fdfbbe30ec4205369a (patch)
treeff099ee3c8b568709e18b80fe23a0f2cb176ef02 /sys/dev/usb/usb_device.c
parent0020f46b4a875816f7768284ac79b7b482aabf39 (diff)
downloadFreeBSD-src-f498dc2227c7edc88b3ba4fdfbbe30ec4205369a.zip
FreeBSD-src-f498dc2227c7edc88b3ba4fdfbbe30ec4205369a.tar.gz
MFp4 //depot/projects/usb@159909
- make usb2_power_mask_t 16-bit - remove "usb2_config_sub" structure from "usb2_config". To compensate for this "usb2_config" has a new field called "usb_mode" which select for which mode the current xfer entry is active. Options are: a) Device mode only b) Host mode only (default-by-zero) c) Both modes. This change was scripted using the following sed script: "s/\.mh\././g". - the standard packet size table in "usb_transfer.c" is now a function, hence the code for the function uses less memory than the table itself. Submitted by: Hans Petter Selasky
Diffstat (limited to 'sys/dev/usb/usb_device.c')
-rw-r--r--sys/dev/usb/usb_device.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/dev/usb/usb_device.c b/sys/dev/usb/usb_device.c
index 9ae7b61..f497b12 100644
--- a/sys/dev/usb/usb_device.c
+++ b/sys/dev/usb/usb_device.c
@@ -172,6 +172,14 @@ usb2_get_pipe(struct usb2_device *udev, uint8_t iface_index,
udev, iface_index, setup->endpoint,
setup->type, setup->direction, setup->ep_index);
+ /* check USB mode */
+
+ if ((setup->usb_mode != USB_MODE_MAX) &&
+ (udev->flags.usb2_mode != setup->usb_mode)) {
+ /* wrong mode - no pipe */
+ return (NULL);
+ }
+
/* setup expected endpoint direction mask and value */
if (setup->direction == UE_DIR_RX) {
@@ -1481,7 +1489,6 @@ usb2_alloc_device(device_t parent_dev, struct usb2_bus *bus,
*/
udev->power_mode = USB_POWER_MODE_ON;
udev->pwr_save.last_xfer_time = ticks;
-
/* we are not ready yet */
udev->refcount = 1;
OpenPOWER on IntegriCloud