Get knowledge when a host App connect or disconnect trought VCP

PHOTO EMBED

Wed Jun 09 2021 11:15:36 GMT+0000 (UTC)

Saved by @dimitri9494 #stm32 #vcp

/*

On file: usbd_cdc_if.c 
*/

 typedef enum {
     isOpen,
     isClosed
 }
 VcpStatus;


 case CDC_SET_CONTROL_LINE_STATE:
    {
        USBD_SetupReqTypedef * req = (USBD_SetupReqTypedef *)pbuf;


        if(req->wValue &0x0001 != 0)
        {
            vcp_status = isOpen;
        }
        else
            vcp_status = isClosed;

        break;
    }
/*
Now it is possible to know if the "VCP connection" is open or not.
Make variable global or implement get method
*/
content_copyCOPY

This allow you to know when a host application connects or disconnects through VCP