- memcpy(b+c->arg[0], c->d.asBytes, USB_CMD_DATA_SIZE);
- cmd_send(CMD_ACK,0,0,0,0,0);
+ memcpy( b + c->arg[0], c->d.asBytes, USB_CMD_DATA_SIZE);
+ cmd_send(CMD_ACK,1,0,0,0,0);
+ break;
+ }
+ case CMD_DOWNLOAD_EML_BIGBUF: {
+ LED_B_ON();
+ uint8_t *cardmem = BigBuf_get_EM_addr();
+ size_t len = 0;
+ for(size_t i=0; i < c->arg[1]; i += USB_CMD_DATA_SIZE) {
+ len = MIN((c->arg[1] - i), USB_CMD_DATA_SIZE);
+ cmd_send(CMD_DOWNLOADED_EML_BIGBUF, i, len, CARD_MEMORY_SIZE, cardmem + c->arg[0] + i, len);
+ }
+ // Trigger a finish downloading signal with an ACK frame
+ cmd_send(CMD_ACK, 1, 0, CARD_MEMORY_SIZE, 0, 0);
+ LED_B_OFF();