Fix MSD bug causing CBW packets to get stalled
Fix MSD bug causing CBW packets to get stalled

If DAPLink dismounts at the correct time in the middle of a mass
storage out transfer then a stall will be sent in response to the next
CBW packet. This causes the host to perform a USB reset of the device.

This patch fixes that problem by not setting a stall flag if the last
packet has been transferred. Failure status will still be returned when
the CSW is read.

This problem can be reproduced by using pyusb to trigger a mass storage
remount and sending a CBW packet, waiting enough time for a dismount
and then sending MSD OUT data while the device is dismounted followed
by reading the CSW as usual. The next CBW will be stalled. Note - the
problem is the most common on the atsam3u interface chip since the
MSD endpoint size is as big as a sector (512 bytes).

google/DAPLink-port,sg-/DAPLink,google/DAPLink-port,sg-/DAPLink,google/DAPLink-port,sg-/DAPLink,google/DAPLink-port