[PATCH] GetBrightness method has to return _unsigned_ int

Holger Macht hmacht at suse.de
Wed May 30 05:20:35 PDT 2007


The GetBrightness method in the macbook* addons wrongly supplies a signed
integer as the first argument in the reply. This makes a call similar to

  dbus_message_get_args(reply, &err, DBUS_TYPE_UINT32,
	                &brightness, DBUS_TYPE_INVALID)) {

fail in the calling process.

However, all applications I looked into (gpm, kpowersave, powersaved) have
a call similar to this.

I currently don't see where it is specified that the GetBrightness method
has to return an UINT32 at all. Neither the
hal-system-lcd-get-brightness-linux script nor
10-laptop-panel-mgmt-policy.fdi doesn't assume this AFAICS. Maybe someone
can tell...

Regards,
	Holger

---
 hald/linux/addons/addon-macbook-backlight.c    |    2 +-
 hald/linux/addons/addon-macbookpro-backlight.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hald/linux/addons/addon-macbook-backlight.c b/hald/linux/addons/addon-macbook-backlight.c
index 4841f1d..83c3a37 100644
--- a/hald/linux/addons/addon-macbook-backlight.c
+++ b/hald/linux/addons/addon-macbook-backlight.c
@@ -276,7 +276,7 @@ filter_function (DBusConnection * connec
 			level = CLAMP (level, 0, 117);
 
 			if ((reply = dbus_message_new_method_return (message)))
-				dbus_message_append_args (reply, DBUS_TYPE_INT32,
+				dbus_message_append_args (reply, DBUS_TYPE_UINT32,
 							  &level, DBUS_TYPE_INVALID);
 		}
 	}
diff --git a/hald/linux/addons/addon-macbookpro-backlight.c b/hald/linux/addons/addon-macbookpro-backlight.c
index b31f5d0..dd36831 100644
--- a/hald/linux/addons/addon-macbookpro-backlight.c
+++ b/hald/linux/addons/addon-macbookpro-backlight.c
@@ -353,7 +353,7 @@ filter_function (DBusConnection *connect
 				goto error;
 
 			dbus_message_append_args (reply,
-						  DBUS_TYPE_INT32, &brightness,
+						  DBUS_TYPE_UINT32, &brightness,
 						  DBUS_TYPE_INVALID);
 			dbus_connection_send (connection, reply, NULL);
 		}
-- 
1.4.3.4



More information about the hal mailing list