- if (ReceiveCommandPoll(&cmdbuf)) {
- for (int i = 0; i < strlen(PROXPROMPT); i++)
- putchar(0x08);
- UsbCommandReceived(&cmdbuf);
- // there is a big bug )
- if (cmdbuf.cmd >= 0x0100 && cmdbuf.cmd <= 0x0110) { // debug commands
- printf(">");
-// rl_on_new_line_with_prompt();
-// rl_forced_update_display();
- }
- fflush(NULL);
+ rxlen = sizeof(UsbCommand);
+ if (uart_receive(sp,rx,&rxlen)) {
+ if ((rxlen % sizeof(UsbCommand)) != 0) {
+ PrintAndLog("ERROR: received %zd bytes, which does not seem to be one or more command(s)\n",rxlen);
+ continue;
+ }
+ cmd_count = rxlen / sizeof(UsbCommand);
+// printf("received %zd bytes, which represents %zd commands\n",rxlen, cmd_count);
+ for (size_t i=0; i<cmd_count; i++) {
+ UsbCommandReceived((UsbCommand*)(rx+(i*sizeof(UsbCommand))));
+ }