Skip to content

Commit 08fede6

Browse files
author
Josuah Demangeon
committed
usb: host: update udev->addr after setting the address
The usbh_req_set_address() function did successfully set the device to its new address, but the udev->addr was not update, so there was a mismatch between the reality and udev. Signed-off-by: Josuah Demangeon <josuah.demangeon@nordicsemi.no>
1 parent dbcfb77 commit 08fede6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

subsys/usb/host/usbh_ch9.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,16 @@ int usbh_req_set_address(struct usb_device *const udev,
185185
{
186186
const uint8_t bmRequestType = USB_REQTYPE_DIR_TO_DEVICE << 7;
187187
const uint8_t bRequest = USB_SREQ_SET_ADDRESS;
188+
int ret;
189+
190+
ret = usbh_req_setup(udev, bmRequestType, bRequest, addr, 0, 0, NULL);
191+
if (ret != 0) {
192+
return ret;
193+
}
188194

189-
return usbh_req_setup(udev, bmRequestType, bRequest, addr, 0, 0, NULL);
195+
udev->addr = addr;
196+
197+
return 0;
190198
}
191199

192200
int usbh_req_set_cfg(struct usb_device *const udev,

0 commit comments

Comments
 (0)