+
+int
+cc_usb_write(struct cc_usb *cc, void *buf, int c)
+{
+ uint8_t *b;
+ int this_time;
+
+ b = buf;
+ cc->show_input = 1;
+ while (c > 0) {
+ this_time = c;
+ if (this_time > CC_OUT_BUF - cc->out_count)
+ this_time = CC_OUT_BUF - cc->out_count;
+ memcpy(cc->out_buf + cc->out_count, b, this_time);
+ cc->out_count += this_time;
+ c -= this_time;
+ b += this_time;
+ while (cc->out_count >= CC_OUT_BUF) {
+ _cc_usb_sync(cc, 0, -1);
+ }
+ }
+ return 1;
+}