Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e595259b authored by Prabir Pradhan's avatar Prabir Pradhan
Browse files

InputManagerService: Refresh device sysfs node when leds/battery added

The sysfs leds or power_supply nodes for a peripheral device are added
asynchronously relative to the evdev nodes. Therefore, we cannot use the
addition of an evdev node as an assumption that the peripheral has been
completely configured in the kernel. There could still be sysfs nodes
for leds or battery, for example, that are added later.

To account for these cases, we need to monitor for any UEvents sent by
the kernel to tell when any of these nodes are added.

In this CL, we create a new InputManagerService component called
SysfsNodeMonitor that watches for device additions. When a new external
device is added, it will start monitoring for UEvents for that device
for at most one minute, or until the device is disconnected. After
registering the UEvent observer, we force the watched sysfs node to
refresh to catch any UEvents that were potentially missed before the
observer was added.

The observer will look out for leds or power_supply node additions, and
will notify native code when it detects node additions.

For now, such a notification will cause the sysfs root node to be
refreshed in EventHub to look for any diffs in the recognized device
properties.

A change in the device properties will cause the input device to be
removed and immediately reopened with a new deviceId. This is a change
in behavior from before, where the immediate removal and re-addition
would not occur.

Bug: 397208968
Test: Presubmit
Flag: EXEMPT bug fix
Change-Id: Id982e6550cd49cdc52e53f1f0dd175068b5bd8a4
parent 5434639a
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment