Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create laptop backlight control by wrapping ddcutil #44

Open
digitaltrails opened this issue Feb 25, 2023 · 4 comments
Open

Create laptop backlight control by wrapping ddcutil #44

digitaltrails opened this issue Feb 25, 2023 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@digitaltrails
Copy link
Owner

Support some laptop backlight adjustment by wrapping ddcutil with a wrapper that accepts DDC/CI commands on behalf of the laptop and translates them into whatever really needs to be done. It must implement:

  • The DDC detect should return values for the laptop display (as well as any other displays).
  • Get and set vcp 10 brightness (and perhaps contrast).
  • Possibly the capabilities command, but that's not strictly necessary (vdu_controls already has an option to just hard wire the capabilities to brightness and contrast).

That all appears pretty easy, except I don't own a laptop. If anyone with a laptop would like to explore this, I'd be happy to try and create ddcutil wrapper script according for them to experiment with.

@digitaltrails digitaltrails added enhancement New feature or request help wanted Extra attention is needed labels Feb 25, 2023
@denilsonsa
Copy link
Contributor

denilsonsa commented Jul 8, 2023

Once upon a time I had my own script to change the brightness: https://github.com/denilsonsa/small_scripts/blob/master/obsolete/change_LCD_brightness.py I have no idea if it is still relevant or if it still works.

I'm now sharing some extra information that may help you:

$ ls -lR /sys/class/backlight
/sys/class/backlight:
total 0
lrwxrwxrwx 1 root root 0 Jun 21 14:08 intel_backlight -> ../../devices/pci0000:00/0000:00:02.0/drm/card0/card0-eDP-1/intel_backlight

$ ls -lR /sys/class/backlight/intel_backlight/
/sys/class/backlight/intel_backlight/:
total 0
-r--r--r-- 1 root root 4096 Jul  8 12:51 actual_brightness
-rw-r--r-- 1 root root 4096 Jul  8 12:51 bl_power
-rw-r--r-- 1 root root 4096 Jul  8 12:49 brightness
lrwxrwxrwx 1 root root    0 Jun 21 14:08 device -> ../../card0-eDP-1
-r--r--r-- 1 root root 4096 Jun 21 14:08 max_brightness
drwxr-xr-x 2 root root    0 Jul  8 12:51 power
-r--r--r-- 1 root root 4096 Jul  8 12:51 scale
lrwxrwxrwx 1 root root    0 Jun 21 14:08 subsystem -> ../../../../../../../class/backlight
-r--r--r-- 1 root root 4096 Jun 21 14:08 type
-rw-r--r-- 1 root root 4096 Jun 21 14:08 uevent

/sys/class/backlight/intel_backlight/power:
total 0
-rw-r--r-- 1 root root 4096 Jul  8 12:52 autosuspend_delay_ms
-rw-r--r-- 1 root root 4096 Jul  8 12:52 control
-r--r--r-- 1 root root 4096 Jul  8 12:52 runtime_active_time
-r--r--r-- 1 root root 4096 Jul  8 12:52 runtime_status
-r--r--r-- 1 root root 4096 Jul  8 12:52 runtime_suspended_time

$ cd /sys/class/backlight/intel_backlight/

$ grep '' * */*
actual_brightness:30001
bl_power:0
brightness:30001
grep: device: Is a directory
max_brightness:120000
grep: power: Is a directory
scale:unknown
grep: subsystem: Is a directory
type:raw
grep: device/device: Is a directory
device/dpms:On
grep: device/drm_dp_aux0: Is a directory
grep: device/edid: binary file matches
device/enabled:enabled
grep: device/firmware_node: Is a directory
grep: device/i2c-9: Is a directory
grep: device/intel_backlight: Is a directory
device/modes:1920x1080
device/modes:1920x1080
grep: device/power: Is a directory
device/status:connected
grep: device/subsystem: Is a directory
device/uevent:DEVTYPE=drm_connector
device/waiting_for_supplier:0
grep: power/autosuspend_delay_ms: Input/output error
power/control:auto
power/runtime_active_time:0
power/runtime_status:unsupported
power/runtime_suspended_time:0
grep: subsystem/intel_backlight: Is a directory

You may want to look at how LXQt, XFCE, OpenBox or any of those handle the XF86MonBrightnessDown/XF86MonBrightnessUp keys.

Some laptops also have a keyboard backlight. I know KDE shows a slider for the display brightness and for the keyboard backlight under the "Battery and Brightness" systray icon.

Good luck! I'm not sure how long I'll still have this laptop, so my contributions to this issue moving forward will be limited.

@digitaltrails
Copy link
Owner Author

digitaltrails commented Jul 8, 2023

Thanks for the extra info. Reading your script and other info (such as the arch wiki), it does look like providing some limited laptop capability is a temptingly close possibility.

I struggle with the thought of buying a laptop I don't need. It does seem different brands of laptop might work a bit differently - so I might need to get access to more than one brand.

I do have a 20 year old Toshiba laptop gathering dust in a closet. I doubt it's very representative of modern hardware, but perhaps I could get a 32 bit linux to run on it and start from there. I'm in no hurry though, it's not anything I have a need for.

@denilsonsa
Copy link
Contributor

I struggle with the thought of buying a laptop I don't need.

Then don't. ;) Don't buy if you don't need. Ask friends or relatives if they can help. Maybe a local repair shop might be able to help you, or may even be able to lend or rent a laptop for a few days. (I mean, it's an exceptional request, but it's worth asking. They may even like the idea of the project and thus more willing to contribute.)

@digitaltrails
Copy link
Owner Author

This idea could be implemented in ddcutil-service rather than in vdu_controls. Something to consider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants