From e6094789b42d5fb253813177a06288961c371c9c Mon Sep 17 00:00:00 2001 From: Sriharsha Allenki Date: Tue, 10 Nov 2020 11:44:59 +0530 Subject: [PATCH] ueventd: Add support for updating permissions on bind Current implementation updates the permissions of sysfs nodes of a device upon the following actions: "add", "change" and "online". But certain sysfs nodes (ex: wakeup capabilities under power management) of devices are not present when the device is added, but these are generally dependent on the device driver and are added once the driver is bound. This is particularly common in USB host stack. If the bind action events are not parsed the ueventd will not update the permissions of these nodes. Hence, add the support for updating permissions on bind action as well. Bug: 174215510 Test: Verified permissions updated on bind action Change-Id: Ic1a147e3993ef78dd6c539bbae652e8107207b87 --- init/devices.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/init/devices.cpp b/init/devices.cpp index 5888c063f..3513bc9ca 100644 --- a/init/devices.cpp +++ b/init/devices.cpp @@ -461,9 +461,10 @@ void DeviceHandler::HandleAshmemUevent(const Uevent& uevent) { } void DeviceHandler::HandleUevent(const Uevent& uevent) { - if (uevent.action == "add" || uevent.action == "change" || uevent.action == "online") { - FixupSysPermissions(uevent.path, uevent.subsystem); - } + if (uevent.action == "add" || uevent.action == "change" || + uevent.action == "bind" || uevent.action == "online") { + FixupSysPermissions(uevent.path, uevent.subsystem); + } // if it's not a /dev device, nothing to do if (uevent.major < 0 || uevent.minor < 0) return;