Loading init/README.ueventd.md +4 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,10 @@ For example Will launch `/vendor/bin/led_coeffs.bin` as the system user instead of serving the default firmware for `/devices/leds/red/firmware/coeffs.bin`. The `devpath` argument may include asterisks (`*`) to match multiple paths. For example, the string `/dev/*/red` will match `/dev/leds/red` as well as `/dev/lights/red`. The pattern matching follows the rules of the fnmatch() function. Ueventd will provide the uevent `DEVPATH` and `FIRMWARE` to this external program on the environment via environment variables with the same names. Ueventd will use the string written to stdout as the new name of the firmware to load. It will still look for the new firmware in the list of firmware Loading init/firmware_handler_test.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,23 @@ int HandleBadPath(int argc, char** argv) { return 0; } TEST(firmware_handler, Matching) { ExternalFirmwareHandler h("/dev/path/a.bin", getuid(), "/test"); ASSERT_TRUE(h.match("/dev/path/a.bin")); ASSERT_FALSE(h.match("/dev/path/a.bi")); h = ExternalFirmwareHandler("/dev/path/a.*", getuid(), "/test"); ASSERT_TRUE(h.match("/dev/path/a.bin")); ASSERT_TRUE(h.match("/dev/path/a.bix")); ASSERT_FALSE(h.match("/dev/path/b.bin")); h = ExternalFirmwareHandler("/dev/*/a.bin", getuid(), "/test"); ASSERT_TRUE(h.match("/dev/path/a.bin")); ASSERT_TRUE(h.match("/dev/other/a.bin")); ASSERT_FALSE(h.match("/dev/other/c.bin")); ASSERT_FALSE(h.match("/dev/path/b.bin")); } } // namespace init } // namespace android Loading Loading
init/README.ueventd.md +4 −0 Original line number Diff line number Diff line Loading @@ -130,6 +130,10 @@ For example Will launch `/vendor/bin/led_coeffs.bin` as the system user instead of serving the default firmware for `/devices/leds/red/firmware/coeffs.bin`. The `devpath` argument may include asterisks (`*`) to match multiple paths. For example, the string `/dev/*/red` will match `/dev/leds/red` as well as `/dev/lights/red`. The pattern matching follows the rules of the fnmatch() function. Ueventd will provide the uevent `DEVPATH` and `FIRMWARE` to this external program on the environment via environment variables with the same names. Ueventd will use the string written to stdout as the new name of the firmware to load. It will still look for the new firmware in the list of firmware Loading
init/firmware_handler_test.cpp +17 −0 Original line number Diff line number Diff line Loading @@ -103,6 +103,23 @@ int HandleBadPath(int argc, char** argv) { return 0; } TEST(firmware_handler, Matching) { ExternalFirmwareHandler h("/dev/path/a.bin", getuid(), "/test"); ASSERT_TRUE(h.match("/dev/path/a.bin")); ASSERT_FALSE(h.match("/dev/path/a.bi")); h = ExternalFirmwareHandler("/dev/path/a.*", getuid(), "/test"); ASSERT_TRUE(h.match("/dev/path/a.bin")); ASSERT_TRUE(h.match("/dev/path/a.bix")); ASSERT_FALSE(h.match("/dev/path/b.bin")); h = ExternalFirmwareHandler("/dev/*/a.bin", getuid(), "/test"); ASSERT_TRUE(h.match("/dev/path/a.bin")); ASSERT_TRUE(h.match("/dev/other/a.bin")); ASSERT_FALSE(h.match("/dev/other/c.bin")); ASSERT_FALSE(h.match("/dev/path/b.bin")); } } // namespace init } // namespace android Loading