Skip to content

Commit 4bf0381

Browse files
jfischer-nojhedberg
authored andcommitted
usb: device_next: cdc_ncm: disable data interface when disconnected
Disable the data interface when the device is disconnected or when the CDC-NCM and CDC-ECM instances are disabled for any reason. Signed-off-by: Johann Fischer <[email protected]>
1 parent a54a83f commit 4bf0381

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

subsys/usb/device_next/class/usbd_cdc_ecm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ static void usbd_cdc_ecm_disable(struct usbd_class_data *const c_data)
402402
const struct device *dev = usbd_class_get_private(c_data);
403403
struct cdc_ecm_eth_data *data = dev->data;
404404

405+
atomic_clear_bit(&data->state, CDC_ECM_DATA_IFACE_ENABLED);
405406
atomic_clear_bit(&data->state, CDC_ECM_CLASS_SUSPENDED);
406407
LOG_INF("Disabled %s", c_data->name);
407408
}

subsys/usb/device_next/class/usbd_cdc_ncm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,6 +865,7 @@ static void usbd_cdc_ncm_disable(struct usbd_class_data *const c_data)
865865
const struct device *dev = usbd_class_get_private(c_data);
866866
struct cdc_ncm_eth_data *data = dev->data;
867867

868+
atomic_clear_bit(&data->state, CDC_NCM_DATA_IFACE_ENABLED);
868869
atomic_clear_bit(&data->state, CDC_NCM_CLASS_SUSPENDED);
869870

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

0 commit comments

Comments
 (0)