Skip to content

Commit

Permalink
Dynamic brightness control path for RPi 7" Display
Browse files Browse the repository at this point in the history
  • Loading branch information
breakingspell committed Aug 13, 2024
1 parent 054df1e commit 27c4432
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion plugins/brightness/official_rpi/official_rpi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@

OfficialRPi::OfficialRPi() : brightness_attribute(this->PATH)
{
this->brightness_attribute.open(QIODevice::WriteOnly);
QString fkms_path = "/sys/class/backlight/rpi_backlight/brightness";
QString kms_path = "/sys/class/backlight/10-0045/brightness";

if (QFileInfo(kms_path).exists()) {
PATH = kms_path;
} else {
PATH = fkms_path;
}
brightness_attribute.setFileName(PATH);
brightness_attribute.open(QIODevice::WriteOnly);
}

OfficialRPi::~OfficialRPi()
Expand Down
2 changes: 1 addition & 1 deletion plugins/brightness/official_rpi/official_rpi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class OfficialRPi : public QObject, BrightnessPlugin {
void set(int brightness) override;

private:
const QString PATH = "/sys/class/backlight/rpi_backlight/brightness";
QString PATH;

QFile brightness_attribute;
};

0 comments on commit 27c4432

Please sign in to comment.