+ 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))));
+ }