aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2011-10-22 01:29:35 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2011-10-22 01:29:35 +0000
commit40011a16b347f3cbf63097ab063cd743b289da07 (patch)
tree631b983c2c9a56c8e07926b5a034bdd1a8cdd93a /sys/dev/usb
parent8618c22826c4a5ae97bee61e1a52fc5cfa27a8c0 (diff)
Notes
Diffstat (limited to 'sys/dev/usb')
-rw-r--r--sys/dev/usb/wlan/if_rum.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/usb/wlan/if_rum.c b/sys/dev/usb/wlan/if_rum.c
index 5a69792aeeaa..c51d48546235 100644
--- a/sys/dev/usb/wlan/if_rum.c
+++ b/sys/dev/usb/wlan/if_rum.c
@@ -1407,20 +1407,27 @@ rum_write_multi(struct rum_softc *sc, uint16_t reg, void *buf, size_t len)
{
struct usb_device_request req;
usb_error_t error;
+ int offset;
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = RT2573_WRITE_MULTI_MAC;
USETW(req.wValue, 0);
- USETW(req.wIndex, reg);
- USETW(req.wLength, len);
- error = rum_do_request(sc, &req, buf);
- if (error != 0) {
- device_printf(sc->sc_dev,
- "could not multi write MAC register: %s\n",
- usbd_errstr(error));
+ /* write at most 64 bytes at a time */
+ for (offset = 0; offset < len; offset += 64) {
+ USETW(req.wIndex, reg + offset);
+ USETW(req.wLength, MIN(len - offset, 64));
+
+ error = rum_do_request(sc, &req, (char *)buf + offset);
+ if (error != 0) {
+ device_printf(sc->sc_dev,
+ "could not multi write MAC register: %s\n",
+ usbd_errstr(error));
+ return (error);
+ }
}
- return (error);
+
+ return (USB_ERR_NORMAL_COMPLETION);
}
static void