Commit 05ad0c0
committed
Add UIDs to all Linux brightness methods
The UID here is based on the I2C path of the display, which is easily exposed for I2C and DDCutil.
For SysFiles and XRandr, the process is a bit more complicated. It relies on the idea that we can
link the entries in `/sys/class/backlight` to `/sys/class/drm` which should contain a link to the
I2C system.
For SysFiles, we expand the `/sys/class/backlight/*/device` symlink to expose the path to the
underlying display connection (in this case, usually eDP). We can follow this link to the
equivalent path in `/sys/class/drm` which will usually have an `i2c-X` or `ddc/i2c-dev` folder
inside that maps to a relevant I2C connection.
On XRandr, it's a similar process, except we start by looking in `/sys/class/drm` and matching the
connection names to our interface name. For example: HDMI-1 -> card0-HDMI-A-1 or DP-1 -> card0-DP-1.
We can then find the I2C connection by browsing the folder tree.
I have tested this on multiple devices and in all cases, both laptop and desktop displays were able
to be uniquely identified in this manner across brightness methods. This means that displays can
avoid being duplicated across all methods even if there is no EDID information available.
There are a few cases in which this doesn't work. On my Pinebook Pro, the edp-backlight subsystem
seems to be a completely different subsystem to the actual display, with no tangible connection
between the two. In this case, a UID cannot be found.
On a laptop running a Fedora Wayland live CD, there was no `intel_backlight` folder, which meant
that no UID was found. On the same laptop running X11 mint, `intel_backlight` was present and the
UID was found so I believe this is a driver/kernel module issue.1 parent 011a847 commit 05ad0c0
1 file changed
+83
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
45 | 50 | | |
46 | 51 | | |
47 | 52 | | |
| |||
54 | 59 | | |
55 | 60 | | |
56 | 61 | | |
57 | | - | |
| 62 | + | |
| 63 | + | |
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| |||
77 | 83 | | |
78 | 84 | | |
79 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
80 | 92 | | |
81 | 93 | | |
82 | 94 | | |
| |||
371 | 383 | | |
372 | 384 | | |
373 | 385 | | |
374 | | - | |
| 386 | + | |
| 387 | + | |
375 | 388 | | |
376 | 389 | | |
377 | 390 | | |
| |||
439 | 452 | | |
440 | 453 | | |
441 | 454 | | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
442 | 486 | | |
443 | 487 | | |
444 | 488 | | |
| |||
472 | 516 | | |
473 | 517 | | |
474 | 518 | | |
475 | | - | |
| 519 | + | |
| 520 | + | |
476 | 521 | | |
477 | 522 | | |
478 | 523 | | |
| |||
606 | 651 | | |
607 | 652 | | |
608 | 653 | | |
609 | | - | |
| 654 | + | |
| 655 | + | |
610 | 656 | | |
611 | 657 | | |
612 | 658 | | |
613 | 659 | | |
614 | 660 | | |
615 | 661 | | |
616 | 662 | | |
| 663 | + | |
617 | 664 | | |
618 | 665 | | |
619 | 666 | | |
| |||
739 | 786 | | |
740 | 787 | | |
741 | 788 | | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
742 | 821 | | |
743 | 822 | | |
744 | 823 | | |
| |||
0 commit comments