backlight: fix detection of multiple graphic cards
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 3 Apr 2024 20:45:11 +0000 (05:45 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 4 Apr 2024 20:29:57 +0000 (21:29 +0100)
Follow-up for e0504dd011189d97a1ea813aabfe1e696742bcf5.

Hopefully, devices in PCI subsystem have some properties, thus have
their udev database file. But, that may not be true. Here, we only read
sysattrs of enumerated devices, hence it is not necessary to check if
the device is initialized or not.

src/backlight/backlight.c

index 61264059941b769a0e9d4ab748e368e3d57dc8d4..2de6c2008af0d6e01f9c74c94f7250b4fbcc7ff9 100644 (file)
@@ -55,6 +55,10 @@ static int has_multiple_graphics_cards(void) {
         if (r < 0)
                 return r;
 
+        r = sd_device_enumerator_allow_uninitialized(e);
+        if (r < 0)
+                return r;
+
         r = sd_device_enumerator_add_match_subsystem(e, "pci", /* match = */ true);
         if (r < 0)
                 return r;