-
Notifications
You must be signed in to change notification settings - Fork 988
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSC device cannot be unmounted on Windows #549
Comments
I don't think this is up to tinyusb to do. In order to not appear again you need to track the eject and change the readiness of the drive. The example doesn't do this because the drive is in RAM and always available. Relevant code is here: https://github.com/hathach/tinyusb/blob/master/examples/device/cdc_msc/src/msc_disk.c#L156 Here is how we do it in CircuitPython: https://github.com/adafruit/circuitpython/blob/main/supervisor/shared/usb/usb_msc_flash.c#L210 |
thanks @tannewt for answering, yeah, this is application level code and beyond a usb stack to handle. @dobairoland please analyze the scsi command and its parameter when host issue the msc eject. Then act accordingly to whatever your application want to do e.g disconnected usb, make device not ready, not mountable etc... it is good idea to read the SCSI reference for more details. |
@tannewt Thank you for the kind help. It is working now. @hathach I think the example should be ejectable even if the RAM drive is always ready. For example, if I have an USB flash HDD ejected then it is ejected properly and is not showing anymore in "This PC" even though I still have the disk in the USB. |
It should, would you mind submitting a PR for it ? |
Make the disk disappear on Windows after it was ejected. The device need to be re-inserted or reseted to re-appear again. This doesn't affect Linux where the device can be mounted and unmounted repeatedly. Closes hathach#549
We actually use the non-disappearance in CircuitPython so that we can use "Eject" to flush any remaining writes to the disk, but then not have to unplug and plug it back in. There is no other simple way to flush writes. This is particularly important because Windows in the past has not flushed writes to FAT12 drives for up to 90 seconds. Supposedly this has been fixed in newer versions of Windows 10, but I haven't had a chance to test it yet.
|
Another way to do this is to un-set the tinyusb/src/class/msc/msc_device.c Line 339 in a65a0a7
|
Set up
Describe the bug
Linux can unmount the disc without any issue. The device cannot be "ejected" using the same firmware on Windows. (The same computer is used)
To reproduce
Linux:
Windows:
"Safe to remove hardware" message is shown but drive remains attached and can be "ejected" again.
The text was updated successfully, but these errors were encountered: