Skip to content
Permalink
Browse files

usb: device: Use set_endpoint helper

Use helper set_endpoint() for endpoint configuration.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information...
finikorg authored and galak committed Mar 28, 2019
1 parent 2b58594 commit 42b92e254e51c2752d83b716940b3b72013d761f
Showing with 2 additions and 16 deletions.
  1. +2 −16 subsys/usb/usb_device.c
@@ -570,8 +570,6 @@ static bool usb_set_interface(u8_t iface, u8_t alt_setting)
LOG_DBG("iface %u alt_setting %u", iface, alt_setting);

while (p[DESC_bLength] != 0U) {
struct usb_dc_ep_cfg_data ep_cfg;

switch (p[DESC_bDescriptorType]) {
case DESC_INTERFACE:
/* remember current alternate setting */
@@ -583,27 +581,15 @@ static bool usb_set_interface(u8_t iface, u8_t alt_setting)
if_desc = (void *)p;
}

LOG_DBG("iface_num %u alt_set %u",
cur_iface, cur_alt_setting);
LOG_DBG("iface_num %u alt_set %u", iface, alt_setting);
break;
case DESC_ENDPOINT:
if ((cur_iface != iface) ||
(cur_alt_setting != alt_setting)) {
break;
}

/* Endpoint is found for desired interface and
* alternate setting
*/
ep_cfg.ep_type = p[ENDP_DESC_bmAttributes];
ep_cfg.ep_mps = (p[ENDP_DESC_wMaxPacketSize]) |
(p[ENDP_DESC_wMaxPacketSize + 1] << 8);
ep_cfg.ep_addr = p[ENDP_DESC_bEndpointAddress];
usb_dc_ep_configure(&ep_cfg);
usb_dc_ep_enable(ep_cfg.ep_addr);

found = true;
LOG_DBG("Found: ep_addr 0x%x", ep_cfg.ep_addr);
found = set_endpoint((struct usb_ep_descriptor *)p);
break;
default:
break;

0 comments on commit 42b92e2

Please sign in to comment.
You can’t perform that action at this time.