login: use device_is_in_action()

This commit is contained in:
Yu Watanabe
2019-03-12 03:49:53 +09:00
parent a7f95575b1
commit 91bd2c349b
2 changed files with 7 additions and 9 deletions
+4 -6
View File
@@ -24,6 +24,7 @@
#include "process-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "udev-util.h"
#include "user-util.h"
void manager_reset_config(Manager *m) {
@@ -238,14 +239,12 @@ int manager_add_button(Manager *m, const char *name, Button **_button) {
}
int manager_process_seat_device(Manager *m, sd_device *d) {
const char *action;
Device *device;
int r;
assert(m);
if (sd_device_get_property_value(d, "ACTION", &action) >= 0 &&
streq(action, "remove")) {
if (device_for_action(d, DEVICE_ACTION_REMOVE)) {
const char *syspath;
r = sd_device_get_syspath(d, &syspath);
@@ -305,7 +304,7 @@ int manager_process_seat_device(Manager *m, sd_device *d) {
}
int manager_process_button_device(Manager *m, sd_device *d) {
const char *action, *sysname;
const char *sysname;
Button *b;
int r;
@@ -315,8 +314,7 @@ int manager_process_button_device(Manager *m, sd_device *d) {
if (r < 0)
return r;
if (sd_device_get_property_value(d, "ACTION", &action) >= 0 &&
streq(action, "remove")) {
if (device_for_action(d, DEVICE_ACTION_REMOVE)) {
b = hashmap_get(m->buttons, sysname);
if (!b)
+3 -3
View File
@@ -26,6 +26,7 @@
#include "signal-util.h"
#include "strv.h"
#include "terminal-util.h"
#include "udev-util.h"
static Manager* manager_unref(Manager *m);
DEFINE_TRIVIAL_CLEANUP_FUNC(Manager*, manager_unref);
@@ -559,7 +560,7 @@ static int manager_dispatch_device_udev(sd_device_monitor *monitor, sd_device *d
static int manager_dispatch_vcsa_udev(sd_device_monitor *monitor, sd_device *device, void *userdata) {
Manager *m = userdata;
const char *name, *action;
const char *name;
assert(m);
assert(device);
@@ -569,8 +570,7 @@ static int manager_dispatch_vcsa_udev(sd_device_monitor *monitor, sd_device *dev
if (sd_device_get_sysname(device, &name) >= 0 &&
startswith(name, "vcsa") &&
sd_device_get_property_value(device, "ACTION", &action) >= 0 &&
streq(action, "remove"))
device_for_action(device, DEVICE_ACTION_REMOVE))
seat_preallocate_vts(m->seat0);
return 0;