From ee8eed599956c7c685363dc1af3bcfc40aa87155 Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 8 Jun 2020 09:31:52 +0000 Subject: [PATCH] MFC r361582: Fix check for wMaxPacketSize in USB bluetooth driver, in case device is not FULL speed. Sponsored by: Mellanox Technologies git-svn-id: svn://svn.freebsd.org/base/stable/9@361917 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c index d3182c0ba..1315db3dd 100644 --- a/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c +++ b/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c @@ -506,7 +506,7 @@ ubt_attach(device_t dev) struct ubt_softc *sc = device_get_softc(dev); struct usb_endpoint_descriptor *ed; struct usb_interface_descriptor *id; - uint16_t wMaxPacketSize; + uint32_t wMaxPacketSize; uint8_t alt_index, i, j; uint8_t iface_index[2] = { 0, 1 }; @@ -596,9 +596,10 @@ ubt_attach(device_t dev) if ((ed->bDescriptorType == UDESC_ENDPOINT) && (ed->bLength >= sizeof(*ed)) && (i == 1)) { - uint16_t temp; + uint32_t temp; - temp = UGETW(ed->wMaxPacketSize); + temp = usbd_get_max_frame_length( + ed, NULL, usbd_get_speed(uaa->device)); if (temp > wMaxPacketSize) { wMaxPacketSize = temp; alt_index = j; -- 2.45.0