summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2006-08-23 22:25:30 -0400
committerDavid Zeuthen <davidz@redhat.com>2006-08-23 22:25:30 -0400
commit39024923e8920736221f28bb01d8ade84a0afd2e (patch)
treec9c2dc3f979822692375c0e9a1b1d42265d599bd
parentf0471f48cdb4a8c2826e6050d69e407823af15c8 (diff)
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
-rw-r--r--doc/spec/hal-spec-properties.xml23
-rw-r--r--hald/linux/addons/addon-cpufreq.c19
2 files changed, 6 insertions, 36 deletions
diff --git a/doc/spec/hal-spec-properties.xml b/doc/spec/hal-spec-properties.xml
index b81aa9e2..18f383b1 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 16d04eed..92d1767b 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(DBusConnection *connection, DBusMessage
/** 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(DBusConnection *connection, DBusMessage *messa
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_function(DBusConnection *connection,
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_function(DBusConnection *connection,
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_function(DBusConnection *connection,
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_function(DBusConnection *connection,
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;
}