diff options
| author | Hans Petter Selasky <hselasky@FreeBSD.org> | 2014-03-14 08:42:30 +0000 |
|---|---|---|
| committer | Hans Petter Selasky <hselasky@FreeBSD.org> | 2014-03-14 08:42:30 +0000 |
| commit | e91fe3a90449875ebbfee67a46f45cde56c42e57 (patch) | |
| tree | 8a3b75d06927aee1ad6354b789d7bfa23e6faf3d /sys/dev/usb/usb_transfer.c | |
| parent | 2c2752d351ea8eeea0353c54f70783f4e2c58062 (diff) | |
Notes
Diffstat (limited to 'sys/dev/usb/usb_transfer.c')
| -rw-r--r-- | sys/dev/usb/usb_transfer.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sys/dev/usb/usb_transfer.c b/sys/dev/usb/usb_transfer.c index dccac403eaba..db912bc6a6bc 100644 --- a/sys/dev/usb/usb_transfer.c +++ b/sys/dev/usb/usb_transfer.c @@ -346,6 +346,7 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) usb_frcount_t n_frlengths; usb_frcount_t n_frbuffers; usb_frcount_t x; + uint16_t maxp_old; uint8_t type; uint8_t zmps; @@ -433,6 +434,11 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) if (xfer->max_packet_count > parm->hc_max_packet_count) { xfer->max_packet_count = parm->hc_max_packet_count; } + + /* store max packet size value before filtering */ + + maxp_old = xfer->max_packet_size; + /* filter "wMaxPacketSize" according to HC capabilities */ if ((xfer->max_packet_size > parm->hc_max_packet_size) || @@ -465,6 +471,13 @@ usbd_transfer_setup_sub(struct usb_setup_params *parm) } } + /* + * Check if the max packet size was outside its allowed range + * and clamped to a valid value: + */ + if (maxp_old != xfer->max_packet_size) + xfer->flags_int.maxp_was_clamped = 1; + /* compute "max_frame_size" */ usbd_update_max_frame_size(xfer); @@ -3432,3 +3445,13 @@ usbd_xfer_get_timestamp(struct usb_xfer *xfer) { return (xfer->isoc_time_complete); } + +/* + * The following function returns non-zero if the max packet size + * field was clamped to a valid value. Else it returns zero. + */ +uint8_t +usbd_xfer_maxp_was_clamped(struct usb_xfer *xfer) +{ + return (xfer->flags_int.maxp_was_clamped); +} |
