Package: acpid Version: 1:2.0.31-2 When using netlink and the input layer, acpid opens the existing devices in /dev/input/event* first and only after sets an inotify to be told about newly created devices. If an event device is created between the time acpid reads the directory and the time it sets the inotify, it won't open that device and events provided by that device will be lost.
On my system, this race happens frequently for /dev/input/event8 "Video Bus" during boot, preventing acpid from handling my system's brightness keys. The attached patch changes the ordering, setting the inotify before opening the existing devices. It also adds a check to prevent double-opening of a device if it is created between the inotify and the reading of the directory.
diff -urN acpid-2.0.31-old/acpid.c acpid-2.0.31/acpid.c --- acpid-2.0.31-old/acpid.c 2018-03-29 11:05:57.252312727 -0400 +++ acpid-2.0.31/acpid.c 2019-07-27 15:48:34.468992622 -0400 @@ -99,12 +99,12 @@ } if (netlink) { - /* open the input layer */ - open_input(); - /* watch for new input layer devices */ open_inotify(); + /* open the input layer */ + open_input(); + /* open netlink */ open_netlink(); } diff -urN acpid-2.0.31-old/input_layer.c acpid-2.0.31/input_layer.c --- acpid-2.0.31-old/input_layer.c 2018-08-01 10:11:59.934141098 -0400 +++ acpid-2.0.31/input_layer.c 2019-07-27 15:50:55.725832853 -0400 @@ -490,6 +490,12 @@ for (i = 0; i < globbuf.gl_pathc; ++i) { filename = globbuf.gl_pathv[i]; + /* skip if already opened */ + if (find_connection_name(filename) != NULL) { + success = 1; + continue; + } + /* open this input layer device file */ if (open_inputfile(filename) == 0) success = 1;