Fix writting large packets.
Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
parent
b70a7474f2
commit
3912775ccb
2 changed files with 5 additions and 5 deletions
|
|
@ -95,7 +95,7 @@ void hid_write(uint16_t size) {
|
|||
uint16_t send_buffer_size = 0;
|
||||
|
||||
void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, /*uint16_t*/ uint8_t len) {
|
||||
uint8_t seq = report[4] & TYPE_MASK ? 0 : report[4]+1;
|
||||
uint8_t seq = report[4] & TYPE_MASK ? 0 : report[4] + 1;
|
||||
if (send_buffer_size > 0) {
|
||||
ctap_resp->cid = ctap_req->cid;
|
||||
ctap_resp->cont.seq = seq;
|
||||
|
|
@ -106,8 +106,8 @@ void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, /*uint1
|
|||
}
|
||||
|
||||
int driver_write(const uint8_t *buffer, size_t buffer_size) {
|
||||
int ret = tud_hid_report(0, buffer, buffer_size);
|
||||
return ret;
|
||||
tud_hid_report(0, buffer, buffer_size);
|
||||
return MIN(64, buffer_size);
|
||||
}
|
||||
|
||||
size_t driver_read(uint8_t *buffer, size_t buffer_size) {
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ uint32_t usb_write_offset(uint16_t len, uint16_t offset) {
|
|||
w = driver_write(tx_buffer+offset, MIN(len, pkt_max));
|
||||
w_len -= w;
|
||||
tx_r_offset += w;
|
||||
return w;
|
||||
return MIN(w_len, pkt_max);
|
||||
}
|
||||
|
||||
size_t usb_rx(const uint8_t *buffer, size_t len) {
|
||||
|
|
@ -182,9 +182,9 @@ void usb_task() {
|
|||
// printf("\r\n ------ M = %lu\r\n",m);
|
||||
if (has_m) {
|
||||
if (m == EV_EXEC_FINISHED) {
|
||||
timeout_stop();
|
||||
driver_exec_finished(finished_data_size);
|
||||
led_set_blink(BLINK_MOUNTED);
|
||||
timeout_stop();
|
||||
}
|
||||
else if (m == EV_PRESS_BUTTON) {
|
||||
uint32_t flag = wait_button() ? EV_BUTTON_TIMEOUT : EV_BUTTON_PRESSED;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue