Rockbox mail archiveSubject: USB and safely remove hardware
USB and safely remove hardware
From: Frank Gevaerts <frank_at_gevaerts.be>
Date: Sun, 8 Mar 2009 16:19:14 +0100
Currently devices with the rockbox usb stack leave USB mode when the host OS
sends an eject command to all exposed drives (usually one, but the sansas
have two). It does not leave USB mode when the host OS sends "allow medium
In practice this means that "safely remove hardware" in windows does not make
the device leave USB mode, while selecting Eject from the context menu does.
This is not a very serious problem, as obviously people who want to let the
device charge after copying files can just unplug and replug while pressing
the appropriate button.
There are several solutions for this :
(a) leave USB mode when getting the "allow medium removal" command. This would
certainly work, but it will cause the device to leave USB mode when the
user unmounts the device, which doesn't *always* mean that the user is
done with it (maybe it needs to be reformatted, fscked, ...). Also, linux
sends this command after a program that accesses the raw device closes the
device (dd, fsck, mkfs,...). I think this means that this is not a good
solution to the problem.
(b) the device has received "allow medium removal" for all drives, show a
"safe to disconnect" message, and leave USB mode when the uses presses a
button. I think this is a nice and clean solution, but it requires some
work : obviously the code itself, but also new strings, changes to the
USB screen code to actually show those strings, choosing the proper button,
and updating the manual. I don't think one day before the freeze is the
right time for this (we're talking about something that is a very minor
issue after all)
Of course we'll still keep the current way of leaving USB mode when getting
eject commands for all drives.
Any thoughts on this, especially regarding 3.2?
-- "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." - Brian W. KernighanReceived on 2009-03-08