Commit graph

8 commits

Author SHA1 Message Date
Richard Hughes
fe643d6fc0 trivial: remove an overzealous warning when starting up 2011-09-28 16:12:40 +01:00
Arnaud Patard
8b9ee53133 up-input.c: fix bitmap check
In up_input_coldplug(), some checks are done on the input device found in order
to detect if it's a lid switch or not.

The following one is problematic :

         /* convert to a bitmask */
         num_bits = up_input_str_to_bitmask (contents, bitmask, sizeof (bitmask));
         if (num_bits != 1) {
                 g_debug ("not one bitmask entry for %s", native_path);
                 ret = FALSE;
                 goto out;
         }

Checking if there's only 1 bit set is wrong. It's nice if you have a x86 with
acpi using 1 input device for the lid switch but it's not always nice.
One can create input devices with gpios-keys like this:

 static struct gpio_keys_button keys[] = {
         {
                 .code = SW_LID,
                 .gpio = ...,
                 .type = EV_SW,
                 .desc = "Lid Switch",
         },
         {
                 .code = SW_RFKILL_ALL,
                 .gpio = ...,
                 .type = EV_SW,
                 .desc = "rfkill",
         },
 };

The resulting SW bitmap will be 9 and thus there are 2 bits sets and due to the
mentionned check, the device is ignored by upower.

As a fix, I'm checking if the number of bits is between 0 and SW_CNT
bits.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Richard Hughes <richard@hughsie.com>
2011-03-04 17:29:44 +00:00
Richard Hughes
59893663fb Port from EggDebug to the GLib built-in logging framework 2010-11-01 11:28:31 +00:00
Richard Hughes
3dee7b22f8 Provide UpDaemon with C setters rather than relying on GObject properties 2010-04-19 17:05:59 +01:00
Michael Biebl
8e3791afe4 devkit-power-gobject/up-enum.h be gone
Port from devkit-power-gobject/up-enum.h to libupower-glib/up-types.h
2010-02-06 13:46:03 +00:00
Richard Hughes
c8cec18f06 trivial: DkpInput -> UpInput (no ABI or API break) 2010-01-18 13:15:47 +00:00
Richard Hughes
d2550b4c78 trivial: DkpDaemon -> UpDaemon (no ABI or API break) 2010-01-18 12:35:47 +00:00
Richard Hughes
15ac5102c8 trivial: Rename a lot of the source files from dkp-foo to up-foo, no API or ABI changes 2010-01-18 12:26:55 +00:00
Renamed from src/linux/dkp-input.c (Browse further)