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

Commit b843ae51 authored by Tom Cherry's avatar Tom Cherry Committed by android-build-merger
Browse files

Merge "ueventd: fix subsystem list logic issues" am: edf03e23

am: 6698195d

Change-Id: I4b8e3285645ee956f313e3904c16825460b350e2
parents 0ae159a9 6698195d
Loading
Loading
Loading
Loading
+14 −16
Original line number Original line Diff line number Diff line
@@ -386,8 +386,11 @@ void DeviceHandler::HandleDeviceEvent(const Uevent& uevent) {
        if (StartsWith(uevent.path, "/devices")) {
        if (StartsWith(uevent.path, "/devices")) {
            links = GetBlockDeviceSymlinks(uevent);
            links = GetBlockDeviceSymlinks(uevent);
        }
        }
    } else if (StartsWith(uevent.subsystem, "usb")) {
    } else if (const auto subsystem =
        if (uevent.subsystem == "usb") {
                   std::find(subsystems_.cbegin(), subsystems_.cend(), uevent.subsystem);
               subsystem != subsystems_.cend()) {
        devpath = subsystem->ParseDevPath(uevent);
    } else if (uevent.subsystem == "usb") {
        if (!uevent.device_name.empty()) {
        if (!uevent.device_name.empty()) {
            devpath = "/dev/" + uevent.device_name;
            devpath = "/dev/" + uevent.device_name;
        } else {
        } else {
@@ -398,14 +401,9 @@ void DeviceHandler::HandleDeviceEvent(const Uevent& uevent) {
            int device_id = uevent.minor % 128 + 1;
            int device_id = uevent.minor % 128 + 1;
            devpath = StringPrintf("/dev/bus/usb/%03d/%03d", bus_id, device_id);
            devpath = StringPrintf("/dev/bus/usb/%03d/%03d", bus_id, device_id);
        }
        }
        } else {
    } else if (StartsWith(uevent.subsystem, "usb")) {
        // ignore other USB events
        // ignore other USB events
        return;
        return;
        }
    } else if (const auto subsystem =
                   std::find(subsystems_.cbegin(), subsystems_.cend(), uevent.subsystem);
               subsystem != subsystems_.cend()) {
        devpath = subsystem->ParseDevPath(uevent);
    } else {
    } else {
        devpath = "/dev/" + Basename(uevent.path);
        devpath = "/dev/" + Basename(uevent.path);
    }
    }
+1 −0
Original line number Original line Diff line number Diff line
@@ -72,6 +72,7 @@ class Subsystem {
    friend class SubsystemParser;
    friend class SubsystemParser;


    Subsystem() {}
    Subsystem() {}
    Subsystem(std::string name) : name_(std::move(name)) {}


    // Returns the full path for a uevent of a device that is a member of this subsystem,
    // Returns the full path for a uevent of a device that is a member of this subsystem,
    // according to the rules parsed from ueventd.rc
    // according to the rules parsed from ueventd.rc
+1 −1
Original line number Original line Diff line number Diff line
@@ -82,7 +82,7 @@ Result<Success> SubsystemParser::ParseSection(std::vector<std::string>&& args,
        return Error() << "ignoring duplicate subsystem entry";
        return Error() << "ignoring duplicate subsystem entry";
    }
    }


    subsystem_.name_ = args[1];
    subsystem_ = Subsystem(std::move(args[1]));


    return Success();
    return Success();
}
}