Detect VCP line state.
* Detect VCP line state, based on SET_CONTROL_LINE_STATE request
diff --git a/stm/usb.c b/stm/usb.c
index 802a70c..8f408b7 100644
--- a/stm/usb.c
+++ b/stm/usb.c
@@ -20,6 +20,7 @@
USB_OTG_CORE_HANDLE USB_OTG_Core;
static int dev_is_enabled = 0;
+int dev_is_connected=0; /* used by usbd_cdc_vcp */
static char rx_buf[64];
static int rx_buf_in;
static int rx_buf_out;
@@ -41,6 +42,10 @@
return dev_is_enabled;
}
+bool usb_vcp_is_connected(void) {
+ return dev_is_connected;
+}
+
void usb_vcp_receive(const char *buf, uint32_t len) {
if (dev_is_enabled) {
for (int i = 0; i < len; i++) {