Add a DriveDetach() method to properly power down USB hard disk enclosures
authorDavid Zeuthen <davidz@redhat.com>
Tue, 9 Jun 2009 00:13:01 +0000 (20:13 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Tue, 9 Jun 2009 00:13:01 +0000 (20:13 -0400)
commit5b7350df8b63cf4178a2fe69ee740b5222130421
treedf72049221db0f1b3b75abb20e3a180899af22cb
parentb73d3ec4998b1c1e750b89e2f6dcd3dd597ea8ff
Add a DriveDetach() method to properly power down USB hard disk enclosures

This work is inspired by this thread

 http://thread.gmane.org/gmane.linux.hotplug.devel/14079

that is referencing this blog entry

 http://elliotli.blogspot.com/2009/01/safely-remove-usb-hard-drive-in-linux.html

The only difference here is that instead of unbinding the usb driver
from the usb device, we unbind the usb-storage driver from the usb
interface in question. This is to better handle multi-function devices
(e.g. multiple USB interfaces).

Things like GVfs (ie. Nautilus) can use this new method to offer an
"Eject" option for USB enclosures that can invoke DriveDetach() on
this service. (In GVfs, such devices currently have no eject option
since they don't support removable media).
12 files changed:
configure.ac
doc/man/devkit-disks.xml
policy/org.freedesktop.devicekit.disks.policy.in
src/Makefile.am
src/devkit-disks-device-private.c
src/devkit-disks-device-private.h
src/devkit-disks-device.c
src/devkit-disks-device.h
src/job-drive-detach.c [new file with mode: 0644]
src/org.freedesktop.DeviceKit.Disks.Device.xml
tools/devkit-disks-bash-completion.sh
tools/devkit-disks.c