Ludwig Nussel wrote:
Carl-Daniel Hailfinger wrote:
Ludwig Nussel wrote:
On Thursday 14 September 2006 14:02, Bernhard Walle wrote:
* Ludwig Nussel
[2006-09-14 13:12]: By calling the Eject() method of the object that represents the device in hal. Is there a command line utitlity to achieve this? It would be also interesting if there's a command line utility to perform mount/unmount. You can use dbus-send to call any method. For mount/umount there is halmount (package ivman) Working example please. Especially for the eject call.
According to the dbus-send man page, the following should work. But it simply does nothing, even if the CD is no longer mounted. dbus-send --system --dest=org.freedesktop.Hal.Device.Volume /org/freedesktop/Hal/devices/volume_label_K3b_data_CD org.freedesktop.Hal.Device.Volume.Eject
dbus-send --system --print-reply --dest=org.freedesktop.Hal \ /org/freedesktop/Hal/devices/volume_label_foo \ org.freedesktop.Hal.Device.Volume.Eject \ array:string:
Would you please merge the first attached patch into halmount
(against halmount from factory) and the second attached patch
into the ivman config files?
That would give us the complete eject button functionality.
Thanks!
Carl-Daniel
--- /usr/bin/halmount.py 2006-05-19 19:06:04.000000000 +0200
+++ halmount.py 2006-10-04 18:27:35.000000000 +0200
@@ -233,6 +233,28 @@
return ret
+ def eject(self, name):
+ ret = 0
+ found = False
+ if name != "/": name = name.rstrip("/")
+
+ for dev in self.mountable:
+ if (self.all or (name[0:5] == "/dev/" and dev.device == name) or dev.mountpoint == name):
+ found = True;
+ obj = self.bus.get_object("org.freedesktop.Hal", dev.udi)
+ try:
+ ret = obj.Eject([""], dbus_interface="org.freedesktop.Hal.Device.Volume")
+ except dbus.DBusException, msg:
+ err(dev.device + ": " + str(msg))
+ ret += 1;
+
+ if found == False:
+ if name != "": err(name + " not found")
+ else: err("no device found")
+ ret += 1
+
+ return ret
+
parser = OptionParser(usage="%prog [options]