[PATCH 2/4] Docking: Add o.f.h.Device.DockStation interface and Undock method
Holger Macht
hmacht at suse.de
Thu Jan 31 12:01:54 PST 2008
New interface org.freedesktop.Hal.Device.DockStation interface with method
'Undock' and add corresponding script hal-dockstation-undock(-linux).
Signed-off-by: Holger Macht <hmacht at suse.de>
---
diff --git a/fdi/policy/10osvendor/10-dockstation.fdi b/fdi/policy/10osvendor/10-dockstation.fdi
new file mode 100644
index 0000000..eb4d4ed
--- /dev/null
+++ b/fdi/policy/10osvendor/10-dockstation.fdi
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<deviceinfo version="0.2">
+ <device>
+ <match key="info.udi" contains="/org/freedesktop/Hal/devices/platform_dock_">
+ <append key="info.interfaces" type="strlist">org.freedesktop.Hal.Device.DockStation</append>
+ <append key="org.freedesktop.Hal.Device.DockStation.method_names" type="strlist">Undock</append>
+ <append key="org.freedesktop.Hal.Device.DockStation.method_signatures" type="strlist"></append>
+ <append key="org.freedesktop.Hal.Device.DockStation.method_argnames" type="strlist"></append>
+ <append key="org.freedesktop.Hal.Device.DockStation.method_execpaths" type="strlist">hal-dockstation-undock</append>
+ </match>
+ </device>
+</deviceinfo>
diff --git a/fdi/policy/10osvendor/Makefile.am b/fdi/policy/10osvendor/Makefile.am
index 5c05347..f9c7579 100644
--- a/fdi/policy/10osvendor/Makefile.am
+++ b/fdi/policy/10osvendor/Makefile.am
@@ -9,7 +9,8 @@ dist_fdi_DATA = \
10-laptop-panel-mgmt-policy.fdi \
15-storage-luks.fdi \
20-storage-methods.fdi \
- 30-wol.fdi
+ 30-wol.fdi \
+ 10-dockstation.fdi
if BUILD_KEYMAPS
dist_fdi_DATA += 10-keymap.fdi
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 7119566..c5576b7 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -170,6 +170,7 @@ script_SCRIPTS = \
hal-system-wol-supported \
hal-system-wol-enabled \
hal-system-wol-enable \
+ hal-dockstation-undock \
hal-functions
EXTRA_DIST=$(man_MANS) $(MAN_IN_FILES) gen-libgphoto-hal-fdi $(script_SCRIPTS)
diff --git a/tools/hal-dockstation-undock b/tools/hal-dockstation-undock
new file mode 100755
index 0000000..102cbf2
--- /dev/null
+++ b/tools/hal-dockstation-undock
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+. hal-functions
+
+hal_check_priv org.freedesktop.hal.dockstation.undock
+hal_exec_backend
diff --git a/tools/linux/Makefile.am b/tools/linux/Makefile.am
index a3553b0..426078d 100644
--- a/tools/linux/Makefile.am
+++ b/tools/linux/Makefile.am
@@ -38,6 +38,7 @@ script_SCRIPTS = \
hal-system-power-set-power-save-linux \
hal-system-killswitch-get-power-linux \
hal-system-killswitch-set-power-linux \
+ hal-dockstation-undock-linux \
hal-system-wol-linux
EXTRA_DIST = 90-hal.rules $(script_SCRIPTS)
diff --git a/tools/linux/hal-dockstation-undock-linux b/tools/linux/hal-dockstation-undock-linux
new file mode 100755
index 0000000..a29f43a
--- /dev/null
+++ b/tools/linux/hal-dockstation-undock-linux
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+DOCKED=`cat $HAL_PROP_LINUX_SYSFS_PATH/docked`
+if [ "$DOCKED" = "0" ]; then
+ echo "org.freedesktop.Hal.Device.DockStation.NotDocked"
+ exit 1
+fi
+
+RET=`echo 1 > $HAL_PROP_LINUX_SYSFS_PATH/undock`
+
+exit $RET
More information about the hal
mailing list