Skip to content

Commit

Permalink
usb-msc: fix write acknowledgement bug in msc driver from PR libopenc…
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Holzapfel committed Feb 10, 2018
1 parent 7933ba2 commit 7bdcb0e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/usb/usb_msc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 7bdcb0e

Please sign in to comment.