bkbilly / lnxlink

🖥 Effortlessly manage your Linux machine using MQTT.
https://bkbilly.gitbook.io/lnxlink
MIT License
274 stars 29 forks source link

No Screen On/Off or brightness - Surface Pro 4 - Ubuntu #94

Closed CamHaug closed 8 months ago

CamHaug commented 8 months ago

What type of installation are you running?

Desktop

Which Linux OS are you using?

Vanilla Ubuntu 22.04.3

Which version of LNXLink has the issue?

2024.2.2

Description

Not sure if I am missing something - I have installed the service and can read from sensors etc. Restart and power profiles also work - however, Screen off and brightness do not seem to have any affect - Device is a surface pro 4 running the current surface kernel in case it makes a difference.

Thanks,

Cam

bkbilly commented 8 months ago

You need to have the display_env module enabled for them to work. The screen_onoff module uses the xset package and the brightness module is using the xrandr package, so make sure you have them installed on your system.

Make sure you check the logs for any errors that are located at the same directory as your config.yaml file and it's called lnxlink.log.

CamHaug commented 8 months ago

Thanks for the quick response!

bkbilly commented 8 months ago

On Home Assistant you can find under the Diagnostics, the Display Environment entity. You should enable this and check it's output. Make sure that this is the same as your system's $DISPLAY environment variable: echo $DISPLAY

If it's the same, you can try running the display off manually like so:

xset -display $DISPLAY dpms force off

For the brightness, the command is a bit more complicated, but it works in a similar way as the screen_onoff.

CamHaug commented 8 months ago

So The display environment entity matches it is :0

I get 'Server does not have extension for dpms option' with that command - quick google suggests that is because ubuntu uses Wayland?

Cam

bkbilly commented 8 months ago

I am also using Ubuntu 22.04 on a Desktop PC and it works for me. I saw on a forum a suggestion that the libxext6 needs to be installed.

If you find another command that works on your Tablet, please let me know to update the modules.

bkbilly commented 8 months ago

You can also try the brightness command to check what error you get.

Get the connected displays:

xrandr --verbose --current | grep ' connected'

Control the brightness, replace the DP-4 with the output the command above:

xrandr --output DP-4 --brightness 0.5
CamHaug commented 8 months ago

libxext6 is already installed (I saw that post too).

Nothing happens with those commands - no output - no change :\

XWAYLAND0 connected primary 2736x1824+0+0 (0x23) normal (normal left inverted right x axis y axis) 260mm x 170mm cameron@Surface-Pro-4:~$ xrandr --output XWAYLAND0 --brightness 0.5 cameron@Surface-Pro-4:~$

bkbilly commented 8 months ago

The xrandr and xset commands, if they are successful, they won't output anything. The modules I've created are depending on these packages, so if they don't work, I don't think I can be more helpful...

In case you find the solution with these or supplementary packages, please let me know.

CamHaug commented 8 months ago

Will Do - I am assuming this is something to do with how the Surface handles brightness/screen control (probably the same reason there is an entire project devoted to getting Linux on these devices).

Fingers crossed I find something as these devices running linux with the battery removed are a pretty good solution for a Home assistant dash and can basically be found for free at this point. That or Ill give it a shot running windows - it just isn't as quick though :D

Thanks for all the help!

bkbilly commented 8 months ago

That's a really nice idea of using it as a Dashboard. I don't know if it helps, but I found an article that suggests some workarounds for the screen brightness by changing the GRUB options. Hope you manage to fix this issue.