Fix USB driver and example

This commit is contained in:
NIIBE Yutaka
2016-04-18 17:23:10 +09:00
parent 82749ab97a
commit 0bbb43dd3a
4 changed files with 136 additions and 17 deletions

View File

@@ -199,7 +199,7 @@ main (int argc, const char *argv[])
/* Send ZLP at the beginning. */
stream_send (st, s, 0);
memcpy (s, "xx: Hello, World with Chopstx!\r\n\000", 32);
memcpy (s, "xx: Hello, World with Chopstx!\r\n", 32);
s[0] = hexchar (count >> 4);
s[1] = hexchar (count & 0x0f);
count++;
@@ -209,14 +209,19 @@ main (int argc, const char *argv[])
while (1)
{
int size = stream_recv (st, s);
int size = stream_recv (st, s + 4);
if (size < 0)
break;
if (size >= 0)
{
if (stream_send (st, s, size) < 0)
s[0] = hexchar (size >> 4);
s[1] = hexchar (size & 0x0f);
s[size + 4] = '\r';
s[size + 5] = '\n';
if (stream_send (st, s, size + 6) < 0)
break;
}