mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-04-22 12:25:38 +02:00
Merge branch 'master' into sd-card
This commit is contained in:
commit
205801625f
2 changed files with 3 additions and 3 deletions
|
@ -258,7 +258,7 @@ uses *udev* to monitor for changes.
|
||||||
| poll-interval
|
| poll-interval
|
||||||
: int
|
: int
|
||||||
: no
|
: no
|
||||||
: How often, in seconds, to poll for capacity changes (default=*60*)
|
: How often, in seconds, to poll for capacity changes (default=*60*). Set to `0` to disable polling (*warning*: many batteries do not support asynchronous reporting).
|
||||||
|
|
||||||
## EXAMPLES
|
## EXAMPLES
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,7 @@ run(struct module *mod)
|
||||||
{.fd = mod->abort_fd, .events = POLLIN},
|
{.fd = mod->abort_fd, .events = POLLIN},
|
||||||
{.fd = udev_monitor_get_fd(mon), .events = POLLIN},
|
{.fd = udev_monitor_get_fd(mon), .events = POLLIN},
|
||||||
};
|
};
|
||||||
poll(fds, 2, m->poll_interval * 1000);
|
poll(fds, 2, m->poll_interval > 0 ? m->poll_interval * 1000 : -1);
|
||||||
|
|
||||||
if (fds[0].revents & POLLIN) {
|
if (fds[0].revents & POLLIN) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -348,7 +348,7 @@ run(struct module *mod)
|
||||||
struct udev_device *dev = udev_monitor_receive_device(mon);
|
struct udev_device *dev = udev_monitor_receive_device(mon);
|
||||||
const char *sysname = udev_device_get_sysname(dev);
|
const char *sysname = udev_device_get_sysname(dev);
|
||||||
|
|
||||||
bool is_us = strcmp(sysname, m->battery) == 0;
|
bool is_us = sysname != NULL && strcmp(sysname, m->battery) == 0;
|
||||||
udev_device_unref(dev);
|
udev_device_unref(dev);
|
||||||
|
|
||||||
if (!is_us)
|
if (!is_us)
|
||||||
|
|
Loading…
Add table
Reference in a new issue