hal: Branch 'master'
David Zeuthen
david at kemper.freedesktop.org
Wed Aug 23 19:25:37 PDT 2006
doc/spec/hal-spec-properties.xml | 23 -----------------------
hald/linux/addons/addon-cpufreq.c | 19 ++++++-------------
2 files changed, 6 insertions(+), 36 deletions(-)
New commits:
diff-tree 39024923e8920736221f28bb01d8ade84a0afd2e (from f0471f48cdb4a8c2826e6050d69e407823af15c8)
Author: David Zeuthen <davidz at redhat.com>
Date: Wed Aug 23 22:25:30 2006 -0400
make cpufreq addon use standard D-Bus expections for unknown methods
Rather than throwing org.freedesktop.Hal.Device.CPUFreq.UnknownMethod
and .InvalidMessage, just return NOT_YET_HANDLED and D-Bus will take
care of it. Example
$ dbus-send --system --dest=org.freedesktop.Hal --print-reply \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.CPUFreq.SetCPUFreqPerformance \
string:322
Error org.freedesktop.DBus.Error.UnknownMethod: Method
"SetCPUFreqPerformance" with signature "s" on interface
"org.freedesktop.Hal.Device.CPUFreq" doesn't exist
$ dbus-send --system --dest=org.freedesktop.Hal --print-reply \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.CPUFreq.SetCPUFreqPerformanceThisMethodDoesNotExist
Error org.freedesktop.DBus.Error.UnknownMethod: Method
"SetCPUFreqPerformanceThisMethodDoesNotExist" with signature
"" on interface "org.freedesktop.Hal.Device.CPUFreq" doesn't
exist
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index b81aa9e..18f383b 100644
--- a/doc/spec/hal-spec-properties.xml
+++ b/doc/spec/hal-spec-properties.xml
@@ -5634,17 +5634,6 @@
</row>
<row>
<entry>
- <literal>UnknownMethod</literal>
- </entry>
- <entry>
- The executed method doesn't exist.
- </entry>
- <entry>
- The method which was tried to be executed.
- </entry>
- </row>
- <row>
- <entry>
<literal>UnknownGovernor</literal>
</entry>
<entry>
@@ -5656,18 +5645,6 @@
</row>
<row>
<entry>
- <literal>InvalidMessage</literal>
- </entry>
- <entry>
- The message that was sent to the interface is invalid.
- For instance, a parameter is missing.
- </entry>
- <entry>
- A DBus error message.
- </entry>
- </row>
- <row>
- <entry>
<literal>PermissionDenied</literal>
</entry>
<entry>
diff --git a/hald/linux/addons/addon-cpufreq.c b/hald/linux/addons/addon-cpufreq.c
index 16d04ee..92d1767 100644
--- a/hald/linux/addons/addon-cpufreq.c
+++ b/hald/linux/addons/addon-cpufreq.c
@@ -48,9 +48,7 @@
#define DBUS_INTERFACE "org.freedesktop.Hal.Device.CPUFreq"
#define CPUFREQ_ERROR_GENERAL "GeneralError"
-#define CPUFREQ_ERROR_UNKNOWN_METHOD "UnknownMethod"
#define CPUFREQ_ERROR_UNKNOWN_GOVERNOR "UnknownGovernor"
-#define CPUFREQ_ERROR_INVALID_MESSAGE "InvalidMessage"
#define CPUFREQ_ERROR_PERMISSION_DENIED "PermissionDenied"
#define CPUFREQ_ERROR_NO_SUITABLE_GOVERNOR "NoSuitableGovernor"
#define CPUFREQ_ERROR_GOVERNOR_INIT_FAILED "GovernorInitFailed"
@@ -939,7 +937,6 @@ static gboolean dbus_send_reply_strlist(
/** gets one argument from message with the given dbus_type and stores it
* in arg
*
- * @raises InvalidMessage
*/
static gboolean dbus_get_argument(DBusConnection *connection, DBusMessage *message,
DBusError *dbus_error, int dbus_type, void *arg)
@@ -949,10 +946,6 @@ static gboolean dbus_get_argument(DBusCo
if (dbus_error_is_set(dbus_error)) {
HAL_WARNING(("Could not get argument of DBus message: %s",
dbus_error->message));
-
- dbus_raise_error(connection, message,
- CPUFREQ_ERROR_INVALID_MESSAGE,
- "%s", dbus_error->message);
dbus_error_free(dbus_error);
return FALSE;
}
@@ -987,7 +980,7 @@ static DBusHandlerResult dbus_filter_fun
if (!dbus_get_argument(connection, message, &dbus_error,
DBUS_TYPE_STRING, &arg)) {
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
HAL_DEBUG(("Received argument: %s", arg));
@@ -1000,7 +993,7 @@ static DBusHandlerResult dbus_filter_fun
if (!dbus_get_argument(connection, message, &dbus_error,
DBUS_TYPE_INT32, &arg)) {
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
HAL_DEBUG(("Received argument: %d", arg));
@@ -1013,7 +1006,7 @@ static DBusHandlerResult dbus_filter_fun
if (!dbus_get_argument(connection, message, &dbus_error,
DBUS_TYPE_BOOLEAN, &arg)) {
- return DBUS_HANDLER_RESULT_HANDLED;
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
HAL_DEBUG(("Received argument: %d", arg));
@@ -1057,9 +1050,9 @@ static DBusHandlerResult dbus_filter_fun
dbus_connection_unref(connection);
g_timeout_add(5000, (GSourceFunc)dbus_init, NULL);
- } else
- dbus_raise_error(connection, message, CPUFREQ_ERROR_UNKNOWN_METHOD,
- "No such method '%s'", member);
+ } else {
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ }
return DBUS_HANDLER_RESULT_HANDLED;
}
More information about the hal-commit
mailing list