Send a null packet on end of USB transfer if last data packet is full.

This commit is contained in:
Gareth McMullin 2014-08-06 12:38:57 +12:00
parent d265b76001
commit 84fc40085e
1 changed files with 12 additions and 0 deletions

View File

@ -47,6 +47,18 @@ void gdb_if_putchar(unsigned char c, int flush)
}
while(usbd_ep_write_packet(usbdev, CDCACM_GDB_ENDPOINT,
buffer_in, count_in) <= 0);
if (flush && (count_in == CDCACM_PACKET_SIZE)) {
/* We need to send an empty packet for some hosts
* to accept this as a complete transfer. */
/* libopencm3 needs a change for us to confirm when
* that transfer is complete, so we just send a packet
* containing a null byte for now.
*/
while (usbd_ep_write_packet(usbdev, CDCACM_GDB_ENDPOINT,
"\0", 1) <= 0);
}
count_in = 0;
}
}