summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2012-10-11 13:08:03 +0200
committerBastien Nocera <hadess@hadess.net>2012-10-11 13:11:51 +0200
commit170b350ab59a9bd8f7e50494f605b7630ea26244 (patch)
treef04a58c49642b12354b516436f319f3bb8f5439d
parentf697099afc9182b7e80a14a437954aeba979625f (diff)
downloadgnome-settings-daemon-170b350ab59a9bd8f7e50494f605b7630ea26244.tar.gz
power: Fix "no devices" error path in gsd-backlight-helper
Callers of the D-Bus API didn't get any reasons why the call failed, just that it did. Also use a correct return value for the helper, not some random unrelated error.
-rw-r--r--plugins/power/gsd-backlight-helper.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/power/gsd-backlight-helper.c b/plugins/power/gsd-backlight-helper.c
index 259d49b0..9ccfba32 100644
--- a/plugins/power/gsd-backlight-helper.c
+++ b/plugins/power/gsd-backlight-helper.c
@@ -34,6 +34,7 @@
#define GSD_BACKLIGHT_HELPER_EXIT_CODE_FAILED 1
#define GSD_BACKLIGHT_HELPER_EXIT_CODE_ARGUMENTS_INVALID 3
#define GSD_BACKLIGHT_HELPER_EXIT_CODE_INVALID_USER 4
+#define GSD_BACKLIGHT_HELPER_EXIT_CODE_NO_DEVICES 5
static gchar *
gsd_backlight_helper_get_type (GList *devices, const gchar *type)
@@ -58,10 +59,8 @@ gsd_backlight_helper_get_best_backlight ()
client = g_udev_client_new (NULL);
devices = g_udev_client_query_by_subsystem (client, "backlight");
- if (devices == NULL) {
- g_warning ("failed to find any devices");
+ if (devices == NULL)
goto out;
- }
/* search the backlight devices and prefer the types:
* firmware -> platform -> raw */
@@ -169,7 +168,10 @@ main (int argc, char *argv[])
/* find device */
filename = gsd_backlight_helper_get_best_backlight ();
if (filename == NULL) {
- retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_INVALID_USER;
+ retval = GSD_BACKLIGHT_HELPER_EXIT_CODE_NO_DEVICES;
+ g_print ("%s: %s\n",
+ "Could not get or set the value of the backlight",
+ "No backlight devices present");
goto out;
}