abcminiuser / lufa

LUFA - the Lightweight USB Framework for AVRs.
http://www.lufa-lib.org
1.04k stars 325 forks source link

Mass storage, eject/unmount detection? #183

Open jmamma opened 2 years ago

jmamma commented 2 years ago

How can we prevent re-enumeration when the mass storage device is unmounted from the host computer?

After unmounting on Windows/Mac it remounts a short time afterwards.

I'm running this on an Atmega16/32u2.

I've experimented with EVENT_USB_Device_Disconnect(), EVENT_USB_Device_Reset() and EVENT_USB_Device_Suspend() to prevent re-enumeration but no luck.

Is this a consequence of VBUS sense ?

jmamma commented 2 years ago

Worked out this needs to be done at the SCSI layer.

case SCSI_CMD_START_STOP_UNIT:

Is the medium eject command.