summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Taylor <rob.taylor@codethink.co.uk>2007-08-22 14:37:23 +0100
committerRob Taylor <rob.taylor@codethink.co.uk>2007-08-22 15:17:50 +0100
commitfb7a82c5a7425d14e248a44d5a7fc15e987a8943 (patch)
tree305318c10c315b8766e1cd73f018e87092f2bd5d
parent26315eca26197a541184190f41d6683f8939d003 (diff)
fix backlight plugin not to crash when no laptop_panels found.
Fix backlight plugin not to crash when no laptop_panels found.
-rw-r--r--plugins/glue/backlight/ohm-plugin-backlight.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/glue/backlight/ohm-plugin-backlight.c b/plugins/glue/backlight/ohm-plugin-backlight.c
index 8950972..19c0272 100644
--- a/plugins/glue/backlight/ohm-plugin-backlight.c
+++ b/plugins/glue/backlight/ohm-plugin-backlight.c
@@ -148,17 +148,19 @@ plugin_initalize (OhmPlugin *plugin)
/* get the only device with capability and watch it */
num = ohm_plugin_hal_add_device_capability (plugin, "laptop_panel");
- if (num != 1) {
+ if (num > 1) {
g_warning ("not tested with not one laptop_panel");
}
- /* get levels that the adapter supports -- this does not change ever */
- ohm_plugin_hal_get_int (plugin, 0, "laptop_panel.num_levels", &data.levels);
- if (data.levels == 0) {
- g_error ("levels zero!");
- return;
+ if (num != 0) {
+ /* get levels that the adapter supports -- this does not change ever */
+ ohm_plugin_hal_get_int (plugin, 0, "laptop_panel.num_levels", &data.levels);
+ if (data.levels == 0) {
+ g_error ("levels zero!");
+ return;
+ }
+ ohm_plugin_conf_set_key (plugin, "backlight.num_levels", data.levels);
}
- ohm_plugin_conf_set_key (plugin, "backlight.num_levels", data.levels);
}
/**