Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion subsys/usb/device_next/class/usbd_cdc_ncm.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ static void ncm_handle_notifications(const struct device *dev, const int err)
if (data->if_state == IF_STATE_CONNECTION_STATUS_SUBMITTED) {
data->if_state = IF_STATE_CONNECTION_STATUS_SENT;
LOG_INF("Connection status sent");
net_if_carrier_on(data->iface);
Comment on lines 637 to +638
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log says "sent", should net_if_carrier_on() be placed before?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there also be a atomic_set_bit(&data->state, CDC_NCM_IFACE_UP); like cdc_ncm_iface_start() is doing?

}
}

Expand Down Expand Up @@ -840,6 +841,7 @@ static void usbd_cdc_ncm_update(struct usbd_class_data *const c_data,

if (data_iface == iface && alternate == 0) {
atomic_clear_bit(&data->state, CDC_NCM_DATA_IFACE_ENABLED);
net_if_carrier_off(data->iface);
data->tx_seq = 0;
data->rx_seq = 0;
}
Expand Down Expand Up @@ -868,6 +870,8 @@ static void usbd_cdc_ncm_disable(struct usbd_class_data *const c_data)
atomic_clear_bit(&data->state, CDC_NCM_DATA_IFACE_ENABLED);
atomic_clear_bit(&data->state, CDC_NCM_CLASS_SUSPENDED);

net_if_carrier_off(data->iface);

LOG_INF("Disabled %s", c_data->name);
}

Expand Down Expand Up @@ -1126,7 +1130,6 @@ static int cdc_ncm_iface_start(const struct device *dev)
LOG_DBG("Start interface %d", net_if_get_by_iface(data->iface));

atomic_set_bit(&data->state, CDC_NCM_IFACE_UP);
net_if_carrier_on(data->iface);

if (atomic_test_bit(&data->state, CDC_NCM_DATA_IFACE_ENABLED)) {
(void)k_work_reschedule(&data->notif_work, K_MSEC(1));
Expand Down