summaryrefslogtreecommitdiff
path: root/src/linux/up-input.c
Commit message (Collapse)AuthorAgeFilesLines
* input: Fix FD handling and let input stream close itBenjamin Berg2022-02-251-10/+8
| | | | | | | | | The open() call needs to check against the FD being <0 for error detection. Also, add a missing close in one of the error paths and change the code to let the input stream close the FD when it is not needed anymore. We still open() it manually just because we need to do an ioctl once.
* all: Remove HAVE_CONFIG_H conditionalBastien Nocera2021-09-071-3/+1
| | | | | We always have a config.h now, and don't rely on autotools setting this cflags for us to know it.
* linux: Fix gudev includes for UpInputBastien Nocera2020-11-051-1/+0
|
* linux: Add support for running under umockdevBastien Nocera2020-11-051-2/+23
| | | | The sysfs path needs to be adjusted when running under umockdev.
* linux: Don't throw debug errors unless neededBastien Nocera2020-11-051-4/+7
| | | | | | It's really confusing seeing "not a switch [...]" when we actually managed to find a switch, so throw 2 errors in the debug when both checks fail, rather than as things are being tested.
* linux: Fix warning when compiling with mesonBastien Nocera2020-10-231-0/+1
| | | | | | | src/up-input.c:294:3: warning: implicit declaration of function ‘close’; did you mean ‘pclose’? [-Wimplicit-function-declaration] 294 | close (input->eventfp); | ^~~~~ | pclose
* linux: Remove unused headers in up-input.cBastien Nocera2020-10-221-10/+0
|
* linux: Remove UpDaemon dependency from UpInputBastien Nocera2020-10-221-11/+44
| | | | | Emit signals from UpInput for UpBackend to consume, rather than having UpInput poke the daemon directly.
* linux: Make watched switch a property of UpInputBastien Nocera2020-10-221-8/+72
| | | | And add up_input_new_for_switch() to watch other switches.
* linux: Remove duplicate header in up-input.cBastien Nocera2020-10-221-1/+0
|
* linux: Simplify UpInput object codeBastien Nocera2020-10-221-33/+33
| | | | | Use G_DECLARE_FINAL_TYPE() to clean up header and remove the use of a private struct, as the whole object struct is now private.
* Replace use of G_TYPE_INSTANCE_GET_PRIVATEChristian Kellner2019-02-211-2/+1
| | | | | | G_TYPE_INSTANCE_GET_PRIVATE has been deprecated since glib version 2.58 and should be replaced with the xxx_get_instance_private (obj) which is generated by G_ADD_PRIVATE.
* Replace use of deprecated g_type_class_add_privateChristian Kellner2019-02-211-2/+1
| | | | | | | | Use G_DEFINE_TYPE_WITH_CODE (..., G_PRIVATE_ADD (...)) instead of the (deprecated since glib 2.58) function g_type_class_add_private to add a private structure for a type. Bump the minimal required version of glib to 2.38.0, the version where G_PRIVATE_ADD was added.
* linux: Fix possible double-close on exitBastien Nocera2018-06-191-2/+3
| | | | | | | | | Fix double-close on exit. If we created a GIOChannel from the file descriptor, then g_io_channel_shutdown() will close that file descriptor as well. Close the channel first, so that the file descriptor is only closed manually if we didn't manage to create a GIOChannel from it. https://gitlab.freedesktop.org/upower/upower/issues/60
* linux: Use g_clear_object() when possibleBastien Nocera2017-10-311-2/+1
| | | | | | Rather than using != NULL, followed by unref(). https://bugs.freedesktop.org/show_bug.cgi?id=103380
* daemon: Remove unneeded reset of priv struct membersBastien Nocera2013-10-141-2/+0
| | | | It's already done by GObject.
* trivial: remove an overzealous warning when starting upRichard Hughes2011-09-281-1/+1
|
* up-input.c: fix bitmap checkArnaud Patard2011-03-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Port from EggDebug to the GLib built-in logging frameworkRichard Hughes2010-11-011-18/+16
|
* Provide UpDaemon with C setters rather than relying on GObject propertiesRichard Hughes2010-04-191-6/+2
|
* devkit-power-gobject/up-enum.h be goneMichael Biebl2010-02-061-1/+1
| | | | Port from devkit-power-gobject/up-enum.h to libupower-glib/up-types.h
* trivial: DkpInput -> UpInput (no ABI or API break)Richard Hughes2010-01-181-29/+29
|
* trivial: DkpDaemon -> UpDaemon (no ABI or API break)Richard Hughes2010-01-181-2/+2
|
* trivial: Rename a lot of the source files from dkp-foo to up-foo, no API or ↵Richard Hughes2010-01-181-0/+326
ABI changes