summaryrefslogtreecommitdiff
path: root/src/class/cdc/cdc_host.c
diff options
context:
space:
mode:
authorhathach <[email protected]>2022-12-14 16:52:28 +0700
committerhathach <[email protected]>2022-12-16 17:08:37 +0700
commit4f0369508450883504e377b40aaec8860c8cb256 (patch)
treedbb24cbf44216c9a7eb402c158566ace255ecae2 /src/class/cdc/cdc_host.c
parent159aa599be42534cd9a37ae03c71c228c3e72e90 (diff)
adding tuh_cdc_mount_cb/tuh_cdc_umount_cb
start adding cdc_app.c to example
Diffstat (limited to 'src/class/cdc/cdc_host.c')
-rw-r--r--src/class/cdc/cdc_host.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/class/cdc/cdc_host.c b/src/class/cdc/cdc_host.c
index ee824cb4e..aa3a7e1e5 100644
--- a/src/class/cdc/cdc_host.c
+++ b/src/class/cdc/cdc_host.c
@@ -239,6 +239,8 @@ bool cdch_open(uint8_t rhport, uint8_t dev_addr, tusb_desc_interface_t const *it
bool cdch_set_config(uint8_t dev_addr, uint8_t itf_num)
{
(void) dev_addr; (void) itf_num;
+
+ if (tuh_cdc_mount_cb) tuh_cdc_mount_cb(dev_addr);
return true;
}
@@ -254,6 +256,16 @@ void cdch_close(uint8_t dev_addr)
TU_VERIFY(dev_addr <= CFG_TUH_DEVICE_MAX, );
cdch_data_t * p_cdc = get_itf(dev_addr);
+
+ // Invoke application callback
+ if (tuh_cdc_umount_cb)
+ {
+ if (p_cdc->ep_out || p_cdc->ep_in || p_cdc->ep_notif)
+ {
+ tuh_cdc_umount_cb(dev_addr);
+ }
+ }
+
tu_memclr(p_cdc, sizeof(cdch_data_t));
}