Skip to content
Commit b3f72bac authored by David Zeuthen's avatar David Zeuthen
Browse files

If a drive is hotplugged and CanPowerOff is TRUE, set can_stop to TRUE

With this change, USB-connected drives that appear *during* the user
session will now be powered off when the user clicks the "Eject" icon
in the GUI. This involves powering off the USB port typically
resulting in LEDs and other user-visible features turning off. In
particular, bus-powered HDDs will completely turn off by virtue of
being, well, bus-powered.

This is generally what users expect and should make them feel all
cozy, warm inside and, most importantly, more confident removing the
device now that the LED is off. Or something.

Since we only do this for devices detected *during* the user session,
we should not run into problems with internal USB devices such as
laptop SD card readers or the various 4-in-1 flash card readers in
many workstations. This is actually important because removing the
power to the USB port of an "internal" device is generally a bad idea
as it requires a system restart to make the laptop BIOS power the port
up again (or the user to crack open the chassis).

(No, unfortunately there is no *reliable* way to determine if a USB
device is "internal" (e.g. reachable and/or servicable by the user) or
not. There are a couple of mechanisms - one is to look at various USB
device descriptors - but none of them seem very reliable. So instead
we simply look at whether the device is hotplugged.)

See also this udisks commit

 http://cgit.freedesktop.org/udisks/commit/?id=81dcb6eeaeceb6c6faae1a40a5b34a65cd5af653



introducing the Drive:CanPowerOff property and the Drive.PowerOff()
method.

Signed-off-by: default avatarDavid Zeuthen <zeuthen@gmail.com>
parent cdb8babf
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment