aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGareth McMullin2011-11-12 13:46:16 +1300
committerGareth McMullin2011-11-12 13:46:16 +1300
commit7b13bae8dcfbbbd5dc56eb9950aec93c96340cb7 (patch)
treeca8c2dc4de16e57cf998d0e0c0c8fb74578f3df2 /src
parent33e1352c34fbfed9c3b3536c34daf985390dd55c (diff)
Don't send anything on USB if not configured or DTR is released.
Diffstat (limited to 'src')
-rw-r--r--src/stm32/gdb_if.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/stm32/gdb_if.c b/src/stm32/gdb_if.c
index 2ed8c41..59e9c2b 100644
--- a/src/stm32/gdb_if.c
+++ b/src/stm32/gdb_if.c
@@ -39,6 +39,12 @@ void gdb_if_putchar(unsigned char c, int flush)
{
buffer_in[count_in++] = c;
if(flush || (count_in == VIRTUAL_COM_PORT_DATA_SIZE)) {
+ /* Refuse to send if USB isn't configured, and
+ * don't bother if nobody's listening */
+ if((cdcacm_get_config() != 1) || !cdcacm_get_dtr()) {
+ count_in = 0;
+ return;
+ }
while(usbd_ep_write_packet(1, buffer_in, count_in) <= 0);
count_in = 0;
}