+static ssize_t
+flush_tx_buffer (void *user_data, void *vbuf, size_t bufsiz, size_t count)
+{
+ (void) bufsiz;
+
+ /* Don't write data unless link is open. */
+ if (s_cdcVcom.attach != 1 || s_cdcVcom.startTransactions != 1)
+ return count;
+
+ USB_DeviceSendRequest (user_data, USB_CDC_VCOM_BULK_IN_ENDPOINT,
+ vbuf, count);
+
+ /* Wait for USB_DeviceCdcAcmBulkIn() to set s_sendComplete. */
+ while (!s_sendComplete)
+ {
+ }
+
+ /* Reset for the next write. */
+ s_sendComplete = 0;
+
+ return count;
+}
+