Skip to content

Commit

Permalink
Resolve vcgencmd path errors (#17)
Browse files Browse the repository at this point in the history
* Fix checks for vcgen

* Update `validate` method to support DSI displays and fix syntax errors

---------

Co-authored-by: Daniel McKnight <[email protected]>
  • Loading branch information
NeonDaniel and NeonDaniel authored Jan 3, 2024
1 parent 0cc2a3b commit b59ffd7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions ovos_gui_plugin_shell_companion/brightness.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ def validate():
if not platform.machine().startswith("arm"):
return False
# check if needed utils installed
if self.vcgencmd is None:
if shutil.which("vcgencmd") is None:
LOG.info("Missing vcgencmd command.")
return False
if self.ddcutil is None:
LOG.info("Missing ddcutil command.")
return False
# ddcutil is used only for HDMI displays
if shutil.which("ddcutil"):
LOG.debug("ddcutil not available for HDMI display adjustments")
return True

#### brightness manager - TODO generic non rpi support
# Check if the auto dim is enabled
Expand All @@ -82,7 +83,7 @@ def discover(self):
LOG.info("Discovering brightness control device interface")
proc = subprocess.Popen([self.vcgencmd,
"get_config", "display_default_lcd"], stdout=subprocess.PIPE)
if proc.stdout.read().decode("utf-8").strip() == "1":
if proc.stdout.read().decode("utf-8").strip() in ('1', 'display_default_lcd=1'):
self.device_interface = "DSI"
else:
self.device_interface = "HDMI"
Expand Down

0 comments on commit b59ffd7

Please sign in to comment.