Skip to content

Commit

Permalink
usb: netusb: ecm: Enable netusb for the right iface/alt_set
Browse files Browse the repository at this point in the history
Only enable netusb for the right configuration of interface and
alt_setting.

Fixes zephyrproject-rtos#13560

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
  • Loading branch information
finikorg committed Apr 3, 2019
1 parent 28e0e57 commit 604c26f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions subsys/usb/class/netusb/function_ecm.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,17 @@ static struct netusb_function ecm_function = {
.send_pkt = ecm_send,
};

static inline void ecm_status_interface(const u8_t *iface)
static inline void ecm_status_interface(const u8_t *desc)
{
LOG_DBG("iface %u", *iface);
const struct usb_if_descriptor *if_desc = (void *)desc;
u8_t iface_num = if_desc->bInterfaceNumber;
u8_t alt_set = if_desc->bAlternateSetting;

LOG_DBG("iface %u alt_set %u", iface_num, if_desc->bAlternateSetting);

/* First interface is CDC Comm interface */
if (*iface != ecm_get_first_iface_number() + 1) {
if (iface_num != ecm_get_first_iface_number() + 1 || !alt_set) {
LOG_DBG("Skip iface_num %u alt_set %u", iface_num, alt_set);
return;
}

Expand Down

0 comments on commit 604c26f

Please sign in to comment.