summaryrefslogtreecommitdiff
path: root/src/login/logind-button.c
Commit message (Collapse)AuthorAge
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-08-24
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Suspend on lid close based on power status. (#8016)Simon Fowler2018-05-30
| | | | | | | | This change adds support for controlling the suspend-on-lid-close behaviour based on the power status as well as whether the machine is docked or has an external monitor. For backwards compatibility the new configuration file variable is ignored completely by default, and must be set explicitly before being considered in any decisions.
* Prep v236 : Add missing SPDX-License-Identifier (5/9) src/loginSven Eden2018-03-26
|
* logind: filter out input devices that have none of the keys/switche we care ↵Lennart Poettering2017-07-25
| | | | | | | about Let's check what keys are there, before we actually hang on to the opened devices.
* logind: make use of EVIOCSMASK input ioctl to mask out events we aren't ↵Lennart Poettering2017-07-25
| | | | | | | | | | | | | | | interested in This way logind will get woken up only when an actual event took place, and not for every key press on the system. The ioctl EVIOCSMASK was added by @dvdhrm already in October 2015, for the use in logind, among others, hence let's actually make use of it now. While we are at it, also fix usage of the EVIOCGSW ioctl, where we assumed a byte array, even though a unsigned long native endian array is returned.
* tree-wide: add SD_ID128_MAKE_STR, remove LOG_MESSAGE_IDZbigniew Jędrzejewski-Szmek2017-07-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Embedding sd_id128_t's in constant strings was rather cumbersome. We had SD_ID128_CONST_STR which returned a const char[], but it had two problems: - it wasn't possible to statically concatanate this array with a normal string - gcc wasn't really able to optimize this, and generated code to perform the "conversion" at runtime. Because of this, even our own code in coredumpctl wasn't using SD_ID128_CONST_STR. Add a new macro to generate a constant string: SD_ID128_MAKE_STR. It is not as elegant as SD_ID128_CONST_STR, because it requires a repetition of the numbers, but in practice it is more convenient to use, and allows gcc to generate smarter code: $ size .libs/elogind{,-logind,-journald}{.old,} text data bss dec hex filename 1265204 149564 4808 1419576 15a938 .libs/elogind.old 1260268 149564 4808 1414640 1595f0 .libs/elogind 246805 13852 209 260866 3fb02 .libs/elogind-logind.old 240973 13852 209 255034 3e43a .libs/elogind-logind 146839 4984 34 151857 25131 .libs/elogind-journald.old 146391 4984 34 151409 24f71 .libs/elogind-journald It is also much easier to check if a certain binary uses a certain MESSAGE_ID: $ strings .libs/elogind.old|grep MESSAGE_ID MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x MESSAGE_ID=%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x $ strings .libs/elogind|grep MESSAGE_ID MESSAGE_ID=c7a787079b354eaaa9e77b371893cd27 MESSAGE_ID=b07a249cd024414a82dd00cd181378ff MESSAGE_ID=641257651c1b4ec9a8624d7a40a9e1e7 MESSAGE_ID=de5b426a63be47a7b6ac3eaac82e2f6f MESSAGE_ID=d34d037fff1847e6ae669a370e694725 MESSAGE_ID=7d4958e842da4a758f6c1cdc7b36dcc5 MESSAGE_ID=1dee0369c7fc4736b7099b38ecb46ee7 MESSAGE_ID=39f53479d3a045ac8e11786248231fbf MESSAGE_ID=be02cf6855d2428ba40df7e9d022f03d MESSAGE_ID=7b05ebc668384222baa8881179cfda54 MESSAGE_ID=9d1aaa27d60140bd96365438aad20286
* tree-wide: use mfree moreZbigniew Jędrzejewski-Szmek2017-07-05
|
* Prep v229: Remove remaining emacs settings [4/6] src/loginSven Eden2017-05-17
|
* Prep v228: Add remaining updates from upstream (3/3)Sven Eden2017-04-26
| | | | | Apply remaining fixes and the performed move of utility functions into their own foo-util.[hc] files on the rest of elogind.
* [4/5] Apply missing fixes from upstreamSven Eden2017-03-29
|
* tree-wide: drop redundant if checks before safe_close()Lennart Poettering2017-03-29
| | | | | | | | | | | Replace this: if (fd >= 0) safe_close(fd); by this: safe_close(fd);
* tree-wide: make more code use safe_close()Lennart Poettering2017-03-29
| | | | | | | | | | | Replace this: close(fd); fd = -1; write this: fd = safe_close(fd);
* logind: rework display counting when detecting whether the system is dockedLennart Poettering2017-03-14
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we'd just count connected displays, and if there was 2 or more we assumed a "docked" state. With this change we now: - Only count external displays, ignore internal ones (which we detect by checking the connector name against a whitelist of known external plug types) - We ignore connectors which are explicitly disabled - We then compare the count with >= 1 rather than >= 2 as before This new logic has the benefit that systems that disconnect the internal display when the lid is closed are better supported. Also, explicitly disabled ports do not confuse the algorithm anymore. This new algorithm has been suggested here: http://lists.freedesktop.org/archives/intel-gfx/2015-June/068821.html This also makes two functions static, that are not used outside of their .c files.
* logind: cast close() call to (void)Lennart Poettering2017-03-14
|
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-23
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* util: rework strappenda(), and rename it strjoina()Lennart Poettering2015-02-03
| | | | | | After all it is now much more like strjoin() than strappend(). At the same time, add support for NULL sentinels, even if they are normally not necessary.
* treewide: another round of simplificationsMichal Schmidt2014-11-28
| | | | | Using the same scripts as in f647962d64e "treewide: yet more log_*_errno + return simplifications".
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-28
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: no need to negate errno for log_*_errno()Michal Schmidt2014-11-28
| | | | It corrrectly handles both positive and negative errno values.
* treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt2014-11-28
| | | | | | | | | | | | | As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
* log: fix order of log_unit_struct() to match other logging callsLennart Poettering2014-11-28
| | | | | Also, while we are at it, introduce some syntactic sugar for creating ERRNO= and MESSAGE= structured logging fields.
* logind: add HandleLidSwitchDocked= option to logind.conf + documentationBen Wolsieffer2014-08-26
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=82485
* util: replace close_nointr_nofail() by a more useful safe_close()Lennart Poettering2014-03-18
| | | | | | | | | | | | | | | safe_close() automatically becomes a NOP when a negative fd is passed, and returns -1 unconditionally. This makes it easy to write lines like this: fd = safe_close(fd); Which will close an fd if it is open, and reset the fd variable correctly. By making use of this new scheme we can drop a > 200 lines of code that was required to test for non-negative fds or to reset the closed fd variable afterwards.
* logind: detect whether the system is docked, and if it is inhibit lid switch ↵Lennart Poettering2014-02-24
| | | | | | | processing This should make operation nicer with docking stations, but will not cover anything that does not implement SW_DOCK.
* logind: when we wake up from suspend and the lid is still closed, go to ↵Lennart Poettering2014-02-21
| | | | | | | | | | | | | | | | | | | sleep immediately again This is quite useful on laptops such as the Lenovo Yoga, where the power button is placed on the front side of the laptop and can be pressed by accident even if the lid is closed. This reworks a bit of the logind logic to repeatedly try to suspend the system as long as a lid is closed. We use the new "post" event source for this, so that we don't keep things busy. This also adds some code to check the lid status on boot, so that a powered-off machine that is accidentaly powered on goes into suspend immediately. Yay! From now on I can put my Yoga safely in my backpack without fearing that it might turn itself on and drain the battery.
* api: in constructor function calls, always put the returned object pointer ↵Lennart Poettering2014-02-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | first (or second) Previously the returned object of constructor functions where sometimes returned as last, sometimes as first and sometimes as second parameter. Let's clean this up a bit. Here are the new rules: 1. The object the new object is derived from is put first, if there is any 2. The object we are creating will be returned in the next arguments 3. This is followed by any additional arguments Rationale: For functions that operate on an object we always put that object first. Constructors should probably not be too different in this regard. Also, if the additional parameters might want to use varargs which suggests to put them last. Note that this new scheme only applies to constructor functions, not to all other functions. We do give a lot of freedom for those. Note that this commit only changes the order of the new functions we added, for old ones we accept the wrong order and leave it like that.
* event: be more conservative when returning errors from event handler callbacksLennart Poettering2013-12-13
| | | | | We really should return errors from event handlers if we have a continous problem and don't know any other solution.
* button: don't exit if we cannot handle a button pressLennart Poettering2013-11-10
|
* logind: port logind to libsystemd-busLennart Poettering2013-11-05
|
* logind: don't hit an assert if an close() on an input device fd fails with ↵Lennart Poettering2013-03-07
| | | | | | ENODEV because the device is gone https://bugzilla.redhat.com/show_bug.cgi?id=907890
* logind: add MESSAGE_IDs to interesting eventsZbigniew Jędrzejewski-Szmek2013-01-27
|
* logind: add support for automatic suspend/hibernate/shutdown on idleLennart Poettering2012-12-24
|
* logind: unify all session lock loopLennart Poettering2012-10-30
|
* login: trivial grammar fixZbigniew Jędrzejewski-Szmek2012-10-28
|
* logind: add 'lock' as possible choice for handling hw keysLennart Poettering2012-10-28
|
* logind: support for hybrid sleep (i.e. suspend+hibernate at the same time)Lennart Poettering2012-10-28
|
* logind: split up HandleSleepKey= into HandleSuspendKey= and HandleHibernateKey=Lennart Poettering2012-09-21
| | | | | The kernel and X11 distuingish these two, and Thinkpad keys have both, hence we really should distinguish them too.
* logind: allow users to override their own suspend/sleep inhibitorsLennart Poettering2012-09-21
|
* logind: if a lid-switch lock was taken while the lid was closed, recheck lid ↵Lennart Poettering2012-09-19
| | | | status when the lock is released
* logind: rework power key/suspend key/lid switch handlingLennart Poettering2012-09-19
| | | | | | | | http://lists.freedesktop.org/archives/systemd-devel/2012-September/006604.html https://bugzilla.gnome.org/show_bug.cgi?id=680689 This changes the meaning of the HandlePowerKey=/HandleSleepKey=/HandleLidSwitch= setting of logind.conf
* log.h: new log_oom() -> int -ENOMEM, use itShawn Landden2012-07-26
| | | | | | also a number of minor fixups and bug fixes: spelling, oom errors that didn't print errors, not properly forwarding error codes, few more consistency issues, et cetera
* use "Out of memory." consistantly (or with "\n")Shawn Landden2012-07-25
| | | | | | | | glibc/glib both use "out of memory" consistantly so maybe we should consider that instead of this. Eliminates one string out of a number of binaries. Also fixes extra newline in udev/scsi_id
* logind: rework button setting semanticsLennart Poettering2012-05-30
| | | | | If a graphical session without full DE that handles power/suspend events is used this can now be controlled by logind instead, optionally.
* logind: add missing filesLennart Poettering2012-05-30