hal/hald/linux2/addons addon-usb-csr.c,1.1,1.2

David Zeuthen david at freedesktop.org
Mon Apr 4 09:06:45 PDT 2005


Update of /cvs/hal/hal/hald/linux2/addons
In directory gabe:/tmp/cvs-serv20331/hald/linux2/addons

Modified Files:
	addon-usb-csr.c 
Log Message:
2005-04-02  Richard hughes  <richard at hughsie.com>
	
	* hald/linux2/addons/addon-usb-csr: Fix a problem where
	the capability was being added before the charge_level key
	way set, causing programs watching for the "new capability"
	to not be able to query the key until it was restarted.
 


Index: addon-usb-csr.c
===================================================================
RCS file: /cvs/hal/hal/hald/linux2/addons/addon-usb-csr.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- addon-usb-csr.c	24 Mar 2005 01:15:31 -0000	1.1
+++ addon-usb-csr.c	4 Apr 2005 16:06:43 -0000	1.2
@@ -112,7 +112,12 @@
 					   the_device_udi, 
 					   "battery.command_interface", "csr",
 					   &err);
+}
 
+static void add_capability (void)
+{
+	DBusError err;
+	dbus_error_init (&err);
 	libhal_device_add_capability (hal_context, 
 				      the_device_udi, 
 				      "battery",
@@ -430,10 +435,15 @@
 	
 	dbg ("** Addon started\n");
 
+	/* do coldplug */
+	check_all_batteries (NULL);
+
+	/* only add capability when initial charge_level key has been set */
+	add_capability ();
+
 	main_loop = g_main_loop_new (NULL, FALSE);
 
 	g_timeout_add (1000L * check_interval, check_all_batteries, NULL);
-	check_all_batteries (NULL);
 
 	g_main_loop_run (main_loop);
 




More information about the hal-commit mailing list