davidhi7 / ddcci-plasmoid Goto Github PK
View Code? Open in Web Editor NEWKDE Plasma widget to adjust the brightness of multiple external monitors
License: MIT License
KDE Plasma widget to adjust the brightness of multiple external monitors
License: MIT License
Hi @davidhi7 ,
It is no longer possible to install ddcci-plasmoid-backend via pip, due to the externally-managed-environment change.
Thanks for adding the pipx support for ddcci-plasmoid-backend.
Installing it via pipx install ddcci-plasmoid-backend
works.
But the Display Brightness widget then throws an error message saying:
/usr/bin/python3: No module named ddcci-plasmoid-backend
When installing ddcci-plasmoid-backend via pipx, does the "Backend executable command:" line in the Display Brightness widget general settings need to be changed to make it work?
By default it is set to python3 -m ddcci_plasmoid_backend
, but this does not work.
Regards
Title says it all. I have many monitors on my workstation and this widget has great practical value for me. My only complaint is an aesthetic one: it looks awkward on the panel when next to the system tray.
I don't know what it entails, but would it be possible to make ddcci-plasmoid a system tray component, so that its display enablement/disablement would be available in the system tray config panel, and its panel icon would be grouped with the rest of the system tray items?
Please consider a low priority feature request, but a prized one.
Hi there, this one will require some explanation.
So I have an older Samsung monitor, specifically 24" CF390. The issue is that DDC/CI communication works sporadically (it's just nowhere near consistent) (similar issue here).
So, the fix:
If you try enough times, at some point, you will get a proper output. As such running all ddcutil
commands until one is successful fixes the issue with my display. I did a very basic modification your code and it works. However I'm not experienced enough to implement this properly, so this issue.
If this would be implemented, something like --force
option could be used with ddcci_plasmoid_backend
to enable this functionality.
my code (only subprocess_wrapper
and async_subprocess_wrapper
require modification):
# Wrap sync and async subprocess calls for mocking
def subprocess_wrapper(cmd: str) -> CommandOutput:
logger.debug('Execute command: `' + cmd + '`')
proc = subprocess.run(cmd.split(' '), capture_output=True)
stdout = proc.stdout.decode()
while "DDC communication failed" in stdout:
proc = subprocess.run(cmd.split(' '), capture_output=True)
stdout = proc.stdout.decode()
#print(stdout)
stderr = proc.stderr.decode()
command_output = {
'returnCode': proc.returncode,
'stdout': stdout,
'stderr': stderr,
}
log_subprocess_output(cmd, command_output)
if proc.returncode > 0:
raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=cmd, output=stdout, stderr=stderr)
return command_output
async def async_subprocess_wrapper(cmd: str) -> CommandOutput:
logger.debug('Execute command: `' + cmd + '`')
proc = await asyncio.subprocess.create_subprocess_shell(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# it's safe to assume that the return code is not None at this point
return_code: int = 1 if proc.returncode is None else proc.returncode
stdout, stderr = await proc.communicate()
stdout = stdout.decode()
while "DDC communication failed" in stdout:
proc = await asyncio.subprocess.create_subprocess_shell(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# it's safe to assume that the return code is not None at this point
return_code: int = 1 if proc.returncode is None else proc.returncode
stdout, stderr = await proc.communicate()
stdout = stdout.decode()
stderr = stderr.decode()
command_output = {
'returnCode': return_code,
'stdout': stdout,
'stderr': stderr,
}
log_subprocess_output(cmd, command_output)
if proc.returncode > 0:
raise subprocess.CalledProcessError(returncode=proc.returncode, cmd=cmd, output=stdout, stderr=stderr)
return command_output
Hi, there is this error when I run the command "pip install ddcci-plasmoid-backend" :
ERROR: Could not find a version that satisfies the requirement ddcci-plasmoid-backend (from versions: none)
ERROR: No matching distribution found for ddcci-plasmoid-backend
pip3 --version
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.5 LTS
Release: 20.04
Codename: focal
How to reproduce :
System information :
Linux version 6.6.9-arch1-1
plasmashell 5.27.10
$ ddcutil detect
Display 1
I2C bus: /dev/i2c-12
DRM connector: card1-DP-1
EDID synopsis:
Mfg id: HKC - UNK
Model: 27E3Q
Product code: 10038 (0x2736)
Serial number: 0000000000001
Binary serial number: 1 (0x00000001)
Manufacture year: 2023, Week: 9
VCP version: 2.1
Looking at the code, it seems to execute:
$ ddcutil setvcp --bus 12 10 <brightness value>
indeed the command doesn't work on my external monitor. The one that works is this:
$ xrandr --output DP-1 --brightness 0.2
I don't know what's wrong with the ddcutil command.
I use your great plasmoid in panel left to system tray. I also have Command Output widget running. The ddcci-plasmoid consumes more width in the panel which makes it look a little odd (I'm a little picky with this ;) ). While I can adjust Command Output plasmoid width in the config ddcci comes with no option / a fixed width. I couldn't even fugure out where to play around in qml code.
Would be great if this can be adjusted or if you can give me a hint where to reduce width to e. g. 80%.
Thanks.
Makes packaging easier, if we have tags for all the versions.
Python version 3.9.12
ddcutil version 1.4.1
ddcutil detect
output
I2C bus: /dev/i2c-6
DRM connector: card0-DP-1
EDID synopsis:
Mfg id: ACR - Acer Technologies
Model: XB271HU
Product code: 1168 (0x0490)
Serial number: #ASNnbwQFBgfd
Binary serial number: 1663072682 (0x632079aa)
Manufacture year: 2016, Week: 32
VCP version: 2.2
Display 2
I2C bus: /dev/i2c-7
DRM connector: card0-DP-2
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: 27GN950
Product code: 23450 (0x5b9a)
Serial number: 206NTVS7U671
Binary serial number: 266671 (0x000411af)
Manufacture year: 2022, Week: 6
VCP version: 2.1
The standalone and system tray widgets both display the same error, which is also seen when running python -m ddcci_plasmoid_backend --debug detect
(excluding initial DEBUG line)
DEBUG __main__: Running version 0.1.5 in debug mode
Traceback (most recent call last):
File "/home/fargonaut/dev/dependencies/anaconda/anaconda3/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/home/fargonaut/dev/dependencies/anaconda/anaconda3/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/home/fargonaut/.local/lib/python3.9/site-packages/ddcci_plasmoid_backend/__main__.py", line 97, in <module>
main()
File "/home/fargonaut/.local/lib/python3.9/site-packages/ddcci_plasmoid_backend/__main__.py", line 28, in main
def handle_error(error: str | subprocess.CalledProcessError) -> NoReturn:
TypeError: unsupported operand type(s) for |: 'type' and 'type'
I'm worried it's a conda issue, something I honestly don't know much about, but so far hasn't caused issues with other python scripts. I thought I'd run it by here before I dig deeper.
I looked at #12, but I'm not sure there's a parallel solution here. Any thoughts?
I have limited knowledge about the KDE shortcut system so please correct me if I'm wrong, but to my understanding it is possible to add custom actions to the "shortcut" section, similar to what latte dock and spectacle did. Therefore it would be nice if this add-on implement actions that allow users to map key sequences of choice to "brightness up" and "brightness down", making the adjustment easier (just like the media keys for audio volume adjustment). It would also be nice if, when the key sequence for bright adjustment is triggered, a pop-up message can be displayed to indicate the adjusted brightness (again, just like the media keys for volume adjustment).
This widget is working great, and is a nice improvement over the built-in control.
Issue: it appears to be detecting/showing controls for only two of my three monitors. The third monitor (Display 3 in below output) works with the built-in plasma display brightness control but is missing from this widget.
output of ddcutil detect
:
Display 1
I2C bus: /dev/i2c-4
DRM connector: card0-DP-2
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: E2442
Product code: XXXXX (0xXXXX)
Serial number: XXXXXXXXXXXX
Binary serial number: XXXXXX (0xXXXXXXXX)
Manufacture year: 2013, Week: 1
VCP version: 2.1
Display 2
I2C bus: /dev/i2c-6
DRM connector: card0-HDMI-A-1
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: E2342
Product code: XXXXX (0xXXXX)
Serial number:
Binary serial number: XXXXXXXX (0xXXXXXXXX)
Manufacture year: 2011, Week: 1
VCP version: 2.1
Display 3
I2C bus: /dev/i2c-8
DRM connector: card0-DP-1
EDID synopsis:
Mfg id: PHL - Philips Consumer Electronics Company
Model: PHL 243V7
Product code: XXXXX (0xXXXX)
Serial number:
Binary serial number: XXXXX (0xXXXXXXXX)
Manufacture year: 2020, Week: 30
VCP version: 2.2
Looking at this code snippet:
ddcci-plasmoid/backend/ddcci_plasmoid_backend/ddcci.py
Lines 50 to 56 in 3c002d9
I suspect this may have something to do with two of the monitors having no Serial number
? (though they do both have a Binary serial number
).
It would be nice to have customizable presets for day and night. I made a proof of concept. It's enough for my needs. At least for now. I'm planning on combining it with night light somehow.
What monitors should have to make the plasmoid work with them? I have 2 monitors (and 1 projector). They have DCC/CI option enabled, yet ddcutil detect
describe them all as "Invalid display"
Invalid display
I2C bus: /dev/i2c-3
DRM connector: card0-DP-1
EDID synopsis:
Mfg id: BNQ - UNK
Model: BenQ GW2760HS
Product code: 30922 (0x78ca)
Serial number: F4E01278SL0
Binary serial number: 21573 (0x00005445)
Manufacture year: 2014, Week: 16
DDC communication failed
Invalid display
I2C bus: /dev/i2c-6
DRM connector: card0-HDMI-A-1
EDID synopsis:
Mfg id: NLK - UNK
Model: MStar Demo
Product code: 48 (0x0030)
Serial number:
Binary serial number: 1 (0x00000001)
Manufacture year: 2014, Week: 10
DDC communication failed
Invalid display
I2C bus: /dev/i2c-7
DRM connector: card0-DVI-D-1
EDID synopsis:
Mfg id: DEL - Dell Inc.
Model: DELL E2211H
Product code: 41074 (0xa072)
Serial number: NJ91T24I22KB
Binary serial number: 842156866 (0x32324b42)
Manufacture year: 2012, Week: 16
DDC communication failed
What am I missing?
ddcutil detect
is able to detect the monitorsddcci_plasmoid_backend detect
does see the monitors but bails with ddcci_plasmoid_backend.__main__: a coroutine was expected, got [{'id': 1, 'name': 'LG HDR 4K', 'bus_id': 6, 'brightness': 60}, {'id': 2, 'name': 'LG HDR 4K', 'bus_id': 7, 'brightness': 100}]
ddcci_plasmoid_backend -d set-brightness 6 99
worksI am aware of #45, but this is different as the getvcp
call works and returns: VCP 10 C 60 100
Regression was introduced with 0.1.10 as version 0.1.9 works as expected.
$ /nix/store/bjjnvhpwri8f9p04k19j2pqhi3sdjx55-ddcci_plasmoid_backend-0.1.10/bin/ddcci_plasmoid_backend -d detect
DEBUG ddcci_plasmoid_backend.__main__: backend version: 0.1.10
DEBUG ddcci_plasmoid_backend.__main__: ddcutil version: 2.0.0
DEBUG ddcci_plasmoid_backend.__main__: argv: /nix/store/bjjnvhpwri8f9p04k19j2pqhi3sdjx55-ddcci_plasmoid_backend-0.1.10/bin/ddcci_plasmoid_backend -d detect
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil detect`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil detect: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil detect: Display 1
I2C bus: /dev/i2c-6
DRM connector: card0-DP-1
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: LG HDR 4K
Product code: 30471 (0x7707)
Serial number:
Binary serial number: 211020 (0x0003384c)
Manufacture year: 2023, Week: 8
VCP version: 2.1
Display 2
I2C bus: /dev/i2c-7
DRM connector: card0-DP-2
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: LG HDR 4K
Product code: 30471 (0x7707)
Serial number:
Binary serial number: 210958 (0x0003380e)
Manufacture year: 2023, Week: 8
VCP version: 2.1
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil detect:
DEBUG ddcci_plasmoid_backend.ddcci: Found 2 entries at root level
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 6 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil getvcp --bus 6 --brief 10: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 6 --brief 10: VCP 10 C 60 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 6 --brief 10:
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 7 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil getvcp --bus 7 --brief 10: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 7 --brief 10: VCP 10 C 100 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 7 --brief 10:
DEBUG ddcci_plasmoid_backend.__main__: a coroutine was expected, got [{'id': 1, 'name': 'LG HDR 4K', 'bus_id': 6, 'brightness': 60}, {'id': 2, 'name': 'LG HDR 4K', 'bus_id': 7, 'brightness': 100}]
{"command": "detect", "error": "Failed to fetch monitor data"}
$ /nix/store/bjjnvhpwri8f9p04k19j2pqhi3sdjx55-ddcci_plasmoid_backend-0.1.10/bin/ddcci_plasmoid_backend -d set-brightness 6 99
DEBUG ddcci_plasmoid_backend.__main__: backend version: 0.1.10
DEBUG ddcci_plasmoid_backend.__main__: ddcutil version: 2.0.0
DEBUG ddcci_plasmoid_backend.__main__: argv: /nix/store/bjjnvhpwri8f9p04k19j2pqhi3sdjx55-ddcci_plasmoid_backend-0.1.10/bin/ddcci_plasmoid_backend -d set-brightness 6 99
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil setvcp --bus 6 10 99`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil setvcp --bus 6 10 99: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil setvcp --bus 6 10 99:
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil setvcp --bus 6 10 99:
{"command": "set-brightness", "value": {"bus_id": 6, "brightness": 99}}
I have 2 relatively cheap 4k panels of the same model, but I am only shown 1 monitor for which to adjust brightness.
I'm guessing (without having looked at the code) this has to do with the fact that they have the same serial number.
Display 1 I2C bus: /dev/i2c-6 DRM connector: card0-DP-1 EDID synopsis: Mfg id: HKC - UNK Model: N07 Product code: 10019 (0x2723) Serial number: 0000000000001 Binary serial number: 0 (0x00000000) Manufacture year: 2023, Week: 4 VCP version: 2.1 Display 2 I2C bus: /dev/i2c-7 DRM connector: card0-DP-2 EDID synopsis: Mfg id: HKC - UNK Model: N07 Product code: 10019 (0x2723) Serial number: 0000000000001 Binary serial number: 0 (0x00000000) Manufacture year: 2023, Week: 4 VCP version: 2.1
Just to add - this machine used to have 2 identical Dell monitors, but with those I could adjust the brightness of each monitor individually as expected.
So, I've noticed my screen dimming noticeably below the intended setting whenever I play a Youtube Video. After closing the video, I need to click within the widgets brightness slider again on the same spot it was originally left on in order for the monitor to brighten up again.
I use an Nvidia GPU btw, and otherwise the widget works great.
I have one display which requires the --noverify
option in order to accept the brightness value.
I would propose adding text field in the configuration window to pass additional arguments to ddcutil.
This monitor is detected by ddcutil detect
, and I am able to control the brightness with ddcutil setvcp 10 <value>
, but python3 -m ddcci_plasmoid_backend detect
returns: {"command": "detect", "value": []}
Debug Log:
DEBUG __main__: backend version: 0.1.8
DEBUG __main__: ddcutil version: 1.4.1
DEBUG __main__: argv: /home/ezra/.local/lib/python3.11/site-packages/ddcci_plasmoid_backend/__main__.py --debug-log /tmp/dddebug detect
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil detect`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil detect: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil detect: Invalid display
I2C bus: /dev/i2c-17
DRM connector: card2-eDP-2
EDID synopsis:
Mfg id: TMX - Thermotrex Corporation
Model: TL140ADXP01
Product code: 5249 (0x1481)
Serial number:
Binary serial number: 0 (0x00000000)
Manufacture year: 2021, Week: 29
DDC communication failed
This is an eDP laptop display. Laptop displays do not support DDC/CI.
Display 1
I2C bus: /dev/i2c-19
DRM connector: card2-DP-3
EDID synopsis:
Mfg id: GGL - Google Inc.
Model: GOOGLE JN32A
Product code: 58156 (0xe32c)
Serial number: 00110082
Binary serial number: 16843009 (0x01010101)
Manufacture year: 2020, Week: 11
VCP version: 2.1
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil detect:
DEBUG ddcci_plasmoid_backend.ddcci: Found 2 entries at root level
DEBUG ddcci_plasmoid_backend.ddcci: Key Invalid display does not match pattern for valid display, so skip it
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 19 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil getvcp --bus 19 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 19 --brief 10: VCP 10 ERR
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 19 --brief 10:
DEBUG __main__: Command 'ddcutil getvcp --bus 19 --brief 10' returned non-zero exit status 1.
DEBUG __main__: Detected 0 working monitor busses, 1 non-working bus.
Hi @davidhi7 ,
Thanks a lot for this useful app.
When using more than one monitor, ddcci-plasmoid requires to adjust multiple sliders, one after another.
It would be more convenient if there would be an option to allow to adjust multiple (all) monitors simultaneously, i.e. with one slider that controls multiple (all) monitors.
Regards
Currently the widget doesn't work on Plasma 6.0 beta 1.
EDIT: Nevermind
I ran pip install ddcci-plasmoid-backend --break-system-packages
and it worked. Could you please add that in the readme file for arch users, or whomever you think would get this message?
I used to be able to install it just fine, but now the system is not liking pip and it throws this error when I run pip install ddcci-plasmoid-backend
This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
python-xyz', where xyz is the package you are trying to
install.
If you wish to install a non-Arch-packaged Python package,
create a virtual environment using 'python -m venv path/to/venv'.
Then use path/to/venv/bin/python and path/to/venv/bin/pip.
If you wish to install a non-Arch packaged Python application,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. Make sure you have python-pipx
installed via pacman.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
I Have installed pip and tried - still failed
I have used pipx (it was suggested when I searched) - still failed
Not sure what else I can do to install the ddcci-plasmoid-backend
. It is not available anywhere to install
Hi,
is it possible to ignore certain monitors in the widget? I have an issue with internal display which flickers everytime DDC is used, so this widget causes this flicker every minute.
Is it possible to ignore a display so it is not queried at all? There are no settings for this available in the widget nor any option in the backend as far as I can see.
IMO it would be sufficient to add some flags to the backend, so I could add them in the widget settings.
% ddcci_plasmoid_backend detect
Traceback (most recent call last):
File "/home/sandorex/.local/bin/ddcci_plasmoid_backend", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/sandorex/.local/pipx/venvs/ddcci-plasmoid-backend/lib/python3.11/site-packages/ddcci_plasmoid_backend/__main__.py", line 102, in main
print(json.dumps({
^^^^^^^^^^^^
File "/usr/lib/python3.11/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type CalledProcessError is not JSON serializable
I have two identical monitors and only one of them is detected. The issue seems to be the concurrently executed ddcutil getvcp
which lead to an error which renders one monitor undetected.
Output from python3 -m ddcci_plasmoid_backend -d detect
:
DEBUG __main__: backend version: 0.1.8
DEBUG __main__: ddcutil version: 1.4.1
DEBUG __main__: argv: /home/christian-anke/.local/lib/python3.11/site-packages/ddcci_plasmoid_backend/__main__.py -d detect
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil detect`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil detect: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil detect: Invalid display
I2C bus: /dev/i2c-12
DRM connector: card0-eDP-1
EDID synopsis:
Mfg id: SHP - Sharp Corporation
Model:
Product code: 5329 (0x14d1)
Serial number:
Binary serial number: 0 (0x00000000)
Manufacture year: 2020, Week: 4
DDC communication failed
This is an eDP laptop display. Laptop displays do not support DDC/CI.
Phantom display
I2C bus: /dev/i2c-13
DRM connector: card0-DP-1
EDID synopsis:
Mfg id: MSI - Microstep
Model: MSI G241
Product code: 15268 (0x3ba4)
Serial number:
Binary serial number: 803 (0x00000323)
Manufacture year: 2021, Week: 14
DDC communication failed
Use non-phantom device bus /dev/i2c-16
Display 1
I2C bus: /dev/i2c-16
DRM connector: card0-DP-4
EDID synopsis:
Mfg id: MSI - Microstep
Model: MSI G241
Product code: 15268 (0x3ba4)
Serial number:
Binary serial number: 803 (0x00000323)
Manufacture year: 2021, Week: 14
VCP version: 2.1
Display 2
I2C bus: /dev/i2c-17
DRM connector: card0-DP-5
EDID synopsis:
Mfg id: MSI - Microstep
Model: MSI G241
Product code: 15268 (0x3ba4)
Serial number:
Binary serial number: 120 (0x00000078)
Manufacture year: 2020, Week: 44
VCP version: 2.1
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil detect:
DEBUG ddcci_plasmoid_backend.ddcci: Found 4 entries at root level
DEBUG ddcci_plasmoid_backend.ddcci: Key Invalid display does not match pattern for valid display, so skip it
DEBUG ddcci_plasmoid_backend.ddcci: Key Phantom display does not match pattern for valid display, so skip it
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 16 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 17 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil getvcp --bus 16 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 16 --brief 10: No monitor detected on bus /dev/i2c-16
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 16 --brief 10:
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil getvcp --bus 17 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 17 --brief 10: VCP 10 C 100 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 17 --brief 10:
DEBUG __main__: Command 'ddcutil getvcp --bus 16 --brief 10' returned non-zero exit status 1.
DEBUG __main__: Detected 1 working monitor bus, 1 non-working bus.
{"command": "detect", "value": [{"id": 2, "name": "MSI G241", "bus_id": 17, "brightness": 100}]}
And this can be reproduced with simple shell: ddcutil getvcp --bus 16 --brief 10 & ddcutil getvcp --bus 17 --brief 10
[1] 16898
No monitor detected on bus /dev/i2c-16
VCP 10 C 100 100
[1]+ Exit 1 ddcutil getvcp --bus 16 --brief 10
Were as executing them in sequence makes the error safely disappear: ddcutil getvcp --bus 16 --brief 10; ddcutil getvcp --bus 17 --brief 10
VCP 10 C 100 100
VCP 10 C 100 100
It might be better to avoid the async execution here.
After ddcutil got updated to 2.0.0, the plasmoid is no longer detecting my monitor.
The output of ddcutil detect
busno=6, Feature 0x41 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
busno=6, Feature 0xdd should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
busno=6, Feature 0x00 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
Display 1
I2C bus: /dev/i2c-6
DRM connector: card1-DP-1
EDID synopsis:
Mfg id: DEL - Dell Inc.
Model: DELL P2418D
Product code: 53441 (0xd0c1)
Serial number:
Binary serial number:
Manufacture year: 2019, Week: 4
VCP version: 2.1
The output of ddcci_plasmoid_backend -d detect
DEBUG ddcci_plasmoid_backend.__main__: backend version: 0.1.8
DEBUG ddcci_plasmoid_backend.__main__: ddcutil version: 2.0.0
DEBUG ddcci_plasmoid_backend.__main__: argv: /home/oleksandr/.local/bin/ddcci_plasmoid_backend -d detect
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil detect`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil detect: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil detect: busno=6, Feature 0x41 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
busno=6, Feature 0xdd should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
busno=6, Feature 0x00 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
Display 1
I2C bus: /dev/i2c-6
DRM connector: card1-DP-1
EDID synopsis:
Mfg id: DEL - Dell Inc.
Model: DELL P2418D
Product code: 53441 (0xd0c1)
Serial number:
Binary serial number:
Manufacture year: 2019, Week: 4
VCP version: 2.1
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil detect:
DEBUG ddcci_plasmoid_backend.ddcci: Found 4 entries at root level
DEBUG ddcci_plasmoid_backend.ddcci: Key busno=6, Feature 0x41 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64 does not match pattern for valid display, so skip it
DEBUG ddcci_plasmoid_backend.ddcci: Key busno=6, Feature 0xdd should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64 does not match pattern for valid display, so skip it
DEBUG ddcci_plasmoid_backend.ddcci: Key busno=6, Feature 0x00 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64 does not match pattern for valid display, so skip it
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 6 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil getvcp --bus 6 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 6 --brief 10: busno=6, Feature 0x41 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
busno=6, Feature 0xdd should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
busno=6, Feature 0x00 should not exist but ddc_get_nontable_vcp_value() succeeds, returning mh=0x00 ml=0x64 sh=0x00 sl=0x64
VCP 10 C 40 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 6 --brief 10:
DEBUG ddcci_plasmoid_backend.__main__: too many values to unpack (expected 5)
DEBUG ddcci_plasmoid_backend.__main__: Detected 0 working monitor busses, 1 non-working bus.
{"command": "detect", "value": []}
I suspect the issue might be caused by unexpected warnings which are present in the output. But I'm not sure if this is something that should be addressed in ddcutil, or maybe ddcci_plasmoid_backend can simply ignore them
I am having some strange issue with this widget. Installed it following the instructions on the repo but getting "Unable to parse error response" error on the widget itself. When trying to run "ddcutil detect" I get output as follows:
Invalid display
I2C bus: /dev/i2c-5
DRM connector: card0-eDP-1
EDID synopsis:
Mfg id: LEN - Lenovo Group Limited
Model:
Product code: 16570 (0x40ba)
Serial number:
Binary serial number: 0 (0x00000000)
Manufacture year: 2018, Week: 0
DDC communication failed
This is an eDP laptop display. Laptop displays do not support DDC/CI.
Display 1
I2C bus: /dev/i2c-6
DRM connector: card0-DP-1
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: LG HDR 4K
Product code: 30471 (0x7707)
Serial number:
Binary serial number: 538649 (0x00083819)
Manufacture year: 2020, Week: 7
VCP version: 2.1
I am also able to change settings of the monitor using ddcutil and dddcontrol. I got the same error both under Manjaro and Kubuntu
I own an nvidia GT440 and and ddcutil outputs this additional string each time it runs:
(is_nvidia_einval_bug ) nvida/i2c-dev bug encountered. Forcing future io I2C_IO_STRATEGY_FILEIO. Retrying
The code which parses the output of ddcutil fails when it encounters the nvidia warning.
To make it work on my machine I patched async_subprocess_wrapper
and subprocess_wrapper
functions:
stdout = stdout.decode().replace('(is_nvidia_einval_bug ) nvida/i2c-dev bug encountered. Forcing future io I2C_IO_STRATEGY_FILEIO. Retrying\n', '')
Hi, thank you for this useful plasmoid.
It would be nice to add the ability to rename displays under general settings
I, have nvidia rtx A4000 so I copied this file : 90-nvidia-i2c.conf
Driver "nvidia"
Identifier "Dev0"
Option "RegistryDwords" "RMUseSwI2c=0x01; RMI2cSpeed=100"
# solves problem of i2c errors with nvidia driver
# per https://devtalk.nvidia.com/default/topic/572292/-solved-does-gddccontrol-work-for-anyone-here-nvidia-i2c-monitor-display-ddc/#4309293
EndSection
to
/usr/share/ddcutil/data
Hello
similar to issue #21 I am missing support for Apple External Displays. Currently I am using https://github.com/jenrik/acdcontrol from comand line it seems to me that it might be called similarly as ddcutil.
Maybe it would be nice to generally have option for multiple backends?
Thanks
I love this widget. It's very useful.
It would be great if I could also change the contrast on my monitor somehow. Or if this is supported already, if it was made more clear how to do it in the documenation.
Thanks
Hi, thanks for creating this plasmoid.
I'd like to be able to set the brightness to different levels depending on the time of day. This may be similar to how when Plasma's Night Color Switching times setting is configured with the Custom times option the user can enter Begin night color at: and Start day color at: values.
I often find that although the custom times I have set for Night Color have kicked in my monitor is still way too bright in the afternoon/evening and I have to turn the brightness down. I think a set-and-forget option to handle this automatically would be a great addition.
I'm not a huge nerd on linux, so forgive me for sounding foolish if this is already possible;
I already have the plugin installed, it functions beautifully on my DDC/CI monitor- though the extra functionality of being able to change my laptop screen brightness in the same menu would also be incredibly nice- perhaps similarly to how Monitorian on windows handles this?
A plugin I found that does this is Display Brightness Control, which can actually put the display brightness below what it typically is.
Anyways~! Just thought I'd put all this out there!~ Love your program. I'm glad it's on the plugin store! (Been looking for something like this for KDE for a while)
On my machine (Arch Linux, KDE Plasma 5.27.4, X11), the backend script throws the following error on os.getlogin()
at line 46 of __main__.py
, when run by the widget.
This does not occur when running the backend script from a terminal. Seems that the problem would stem from os.getlogin()
being called outside a login shell.
Using os.environ["USER"]
instead of os.getlogin()
is a more robust way of getting the current login username according to a couple of threads online, such as https://stackoverflow.com/a/48346349. Making this modification resolves the issue for me.
Btw, thanks for making this! It's just what I've been looking for.
First of all, you did a great job with your widget, it should definitely be included in plasma by default! I was looking for a widget like this for so long, tried many, but none of them worked like yours. Very simple and easy but does its job perfectly!
I have a feature request that's common for plasma widgets. It's the ability to increase/decrease the value by pointing the mouse to the tray icon and scrolling with the mouse wheel. We see this feature in the audio devices widget or the battery and brightness widget so it would be really beneficial to have it standardized in your widget also. It saves from unnecessary clicking :-)
I've got another unable to parse error message error.
What's notable is that my second display does not have a serial number, I think that might be related.
DEBUG __main__: Run in debug mode
DEBUG __main__: Command: detect
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil detect`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil detect: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil detect: Invalid display
I2C bus: /dev/i2c-2
EDID synopsis:
Mfg id: ENC
Model: FS2434
Serial number: 25670074
Manufacture year: 2014
EDID version: 1.3
DDC communication failed
Display 1
I2C bus: /dev/i2c-4
EDID synopsis:
Mfg id: GSM
Model: 24MB56
Serial number:
Manufacture year: 2012
EDID version: 1.3
VCP version: 2.1
Display 2
I2C bus: /dev/i2c-7
EDID synopsis:
Mfg id: BNQ
Model: ZOWIE XL LCD
Serial number: 9AJ01919SL0
Manufacture year: 2018
EDID version: 1.4
VCP version: 2.2
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil detect: Open failed for /dev/usb/hiddev4: errno=EACCES(13): Permission denied
Open failed for /dev/usb/hiddev5: errno=EACCES(13): Permission denied
DEBUG ddcci_plasmoid_backend.ddcci: Found 3 entries at root level
DEBUG ddcci_plasmoid_backend.ddcci: Key Invalid display does not match pattern for valid display, so skip it
Traceback (most recent call last):
File "/usr/lib64/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib64/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/user/.local/lib/python3.10/site-packages/ddcci_plasmoid_backend/__main__.py", line 49, in <module>
result = asyncio.run(ddcci.detect())
File "/usr/lib64/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib64/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/user/.local/lib/python3.10/site-packages/ddcci_plasmoid_backend/ddcci.py", line 79, in detect
binary_serial_number=get_EDID_value(child, 'Binary serial number')
File "/home/user/.local/lib/python3.10/site-packages/ddcci_plasmoid_backend/ddcci.py", line 97, in get_EDID_value
return node.child_by_key['EDID synopsis'].child_by_key[value].value
KeyError: 'Binary serial number'
I2C bus: /dev/i2c-2
EDID synopsis:
Mfg id: ENC
Model: FS2434
Serial number: 25670074
Manufacture year: 2014
EDID version: 1.3
DDC communication failed
Display 1
I2C bus: /dev/i2c-4
EDID synopsis:
Mfg id: GSM
Model: 24MB56
Serial number:
Manufacture year: 2012
EDID version: 1.3
VCP version: 2.1
Display 2
I2C bus: /dev/i2c-7
EDID synopsis:
Mfg id: BNQ
Model: ZOWIE XL LCD
Serial number: 9AJ01919SL0
Manufacture year: 2018
EDID version: 1.4
VCP version: 2.2
Thanks David for taking the time to do what I had planned for a long time.
I solved the issue myself, but posting it for others.
When installing the plamoid (and the python backend) on my system (openSuse TW) with conda, the plasmoid was not able to find the python module (the error in the plasmoid is "Unable to parse error message").
This is because with conda installed, the python used by default is the python from your "base" environment. However in my case, because the base environment was python3.7 and ddcci_plasmoid_backend requires 3.10, pip installed it in the system python (in /usr/lib/python3.10/
).
Update the conda "base" environement to 3.10 (conda update -n base python
) and this time pip installs in the right location.
This is not a super elegant solution anyways, as it doesn't make much sense to install the backend for a plasmoid in a user-specific conda env, so I'm kind of opening the discussion here:
how can we get the plasmoid to run using the system python (ie /usr/bin/python
) so that we can just conda deactivate && pip install ddcci_plasmoid_backend
or even better, have a rpm package containing the whole plasmoid ?
It might make sense to generate this file instead of manually maintaining and then injecting the version then.
Per JonMagon/plasma-screendimmer#2 (comment), reported here.
I would like to properly implement support for setting --sleep-multiplier 2.0 in the ddcci calls, e.g. ddcutil getvcp -d 1 -v --sleep-multiplier 2.0 10
. This sleep multiplier is required to communicate with my HP z27 monitor from an AMD-based laptop.
What would be the best way to go about implementing this?
The command on the readme doesn't show i2c-dev to be loaded if it's compiled into the kernel.
lsmod doesn't return anything, despite i2c-dev being ready to use:
$ lsmod | grep i2c_dev
$ grep I2C_CHARDEV /boot/config-$(uname -r)
CONFIG_I2C_CHARDEV=y
$
It took me a while to understand that I was looking for another error.
Please include a note on the readme.
More about this on a question on askubuntu.com.
When I use ddcci_plasmoid_backend
on my tiled LG 5K monitor, the wrong "submonitor" seems to be selected for control:
$ ddcci_plasmoid_backend -d detect
DEBUG ddcci_plasmoid_backend.__main__: backend version: 0.1.6
DEBUG ddcci_plasmoid_backend.__main__: ddcutil version: 1.4.1
DEBUG ddcci_plasmoid_backend.__main__: argv: /usr/bin/ddcci_plasmoid_backend -d detect
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil detect`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil detect: 0
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil detect: Invalid display
I2C bus: /dev/i2c-16
DRM connector: card0-eDP-1
EDID synopsis:
Mfg id: SHP - Sharp Corporation
Model:
Product code: 5399 (0x1517)
Serial number:
Binary serial number: 0 (0x00000000)
Manufacture year: 2021, Week: 10
DDC communication failed
This is an eDP laptop display. Laptop displays do not support DDC/CI.
Display 1
I2C bus: /dev/i2c-19
DRM connector: card0-DP-3
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: LG HDR 5K
Product code: 30497 (0x7721)
Serial number: 106NTWGDP049
Binary serial number: 465049 (0x00071899)
Manufacture year: 2021, Week: 6
VCP version: Detection failed
Display 2
I2C bus: /dev/i2c-20
DRM connector: card0-DP-4
EDID synopsis:
Mfg id: GSM - Goldstar Company Ltd (LG)
Model: LG HDR 5K
Product code: 30497 (0x7721)
Serial number: 106NTWGDP049
Binary serial number: 465049 (0x00071899)
Manufacture year: 2021, Week: 6
VCP version: 2.1
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil detect:
DEBUG ddcci_plasmoid_backend.ddcci: Found 3 entries at root level
DEBUG ddcci_plasmoid_backend.ddcci: Key Invalid display does not match pattern for valid display, so skip it
DEBUG ddcci_plasmoid_backend.ddcci: LG HDR 5K id=2: Duplicate monitor found and removed
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 19 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code] ddcutil getvcp --bus 19 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 19 --brief 10: VCP 10 ERR
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 19 --brief 10:
DEBUG ddcci_plasmoid_backend.__main__: Command 'ddcutil getvcp --bus 19 --brief 10' returned non-zero exit status 1.
DEBUG ddcci_plasmoid_backend.__main__: Detected 0 working monitor busses, 1 non-working bus.
{"command": "detect", "value": []}
The first display is my laptop screen, which is correctly ignored. Then the second and third represent the tiled monitor. However, only the second display has VCP enabled, but it is excluded as a duplicate. Of course, that is exactly the one that you would want to get picked.
Maybe the solution is to ignore displays that have "VCP version: Detection failed"?
Attempting to run pip install ddcci-plasmoid-backend
, this error comes up:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
python-xyz', where xyz is the package you are trying to
install.
If you wish to install a non-Arch-packaged Python package,
create a virtual environment using 'python -m venv path/to/venv'.
Then use path/to/venv/bin/python and path/to/venv/bin/pip.
If you wish to install a non-Arch packaged Python application,
it may be easiest to use 'pipx install xyz', which will manage a
virtual environment for you. Make sure you have python-pipx
installed via pacman.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
I am aware that i can pass --break-system-packages
but I am unsure if this package has the potential to break anything managed by pacman/yay on my system, or break python in the process. Is this package safe to install via pip, or should I work on getting this installed by pacman somehow despite the fact that a pacman equivalent does not exist
My use case:
When plugging my laptop into a USB type-C dock with attached displays, I have to manually click refresh in the applet for the display(s) to appear. Ideally I would like it to already have done the refresh when a monitor is plugged in.
It should be possible to listen to the dbus event that is triggered on a new display connection and then simply do a refresh once.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.