usb-msc: fix write acknowledgement bug
Fixes https://github.com/libopencm3/libopencm3/issues/409
This commit is contained in:
parent
f871e539ed
commit
64a6f362b8
@ -594,6 +594,21 @@ static void msc_data_rx_cb(usbd_device *usbd_dev, uint8_t ep)
|
||||
trans->current_block++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Fix "writes aren't acknowledged" bug on Linux (PR #409) */
|
||||
if (false == trans->csw_valid) {
|
||||
scsi_command(ms, trans, EVENT_NEED_STATUS);
|
||||
trans->csw_valid = true;
|
||||
}
|
||||
left = sizeof(struct usb_msc_csw) - trans->csw_sent;
|
||||
if (0 < left) {
|
||||
max_len = MIN(ms->ep_out_size, left);
|
||||
p = &trans->csw.buf[trans->csw_sent];
|
||||
len = usbd_ep_write_packet(usbd_dev, ms->ep_in, p,
|
||||
max_len);
|
||||
trans->csw_sent += len;
|
||||
}
|
||||
|
||||
} else if (trans->byte_count < trans->bytes_to_write) {
|
||||
if (0 < trans->block_count) {
|
||||
if ((0 == trans->byte_count) && (NULL != ms->lock)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user