davidhi7 / ddcci-plasmoid

KDE Plasma widget to adjust the brightness of multiple external monitors
MIT License
390 stars 11 forks source link

Sometimes im getting an error #34

Open sandorex opened 1 year ago

sandorex commented 1 year ago
% 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

Screenshot_20230713_211803

davidhi7 commented 1 year ago

Please provide the output of ddcci_plasmoid_backend detect --debug

sandorex commented 1 year ago

That does not work

% ddcci_plasmoid_backend detect --debug-log log
usage: plasma-ddcci-backend [-h] [-d] [--debug-log LOG_FILE] {version,detect,set-brightness} ...
plasma-ddcci-backend: error: unrecognized arguments: --debug-log log

% ddcci_plasmoid_backend detect --debug                                                                                                              [ 2 ] 
usage: plasma-ddcci-backend [-h] [-d] [--debug-log LOG_FILE] {version,detect,set-brightness} ...
plasma-ddcci-backend: error: unrecognized arguments: --debug

Ah it seems its ddci_plasmoid_backend --debug detect so the --debug has to go before command

% ddcci_plasmoid_backend --debug 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: /home/sandorex/.local/bin/ddcci_plasmoid_backend --debug 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-0
   DRM connector:           card0-HDMI-A-1
   EDID synopsis:
      Mfg id:               DEL - Dell Inc.
      Model:                DELL U2414H
...
   VCP version:         2.1

Display 2
   I2C bus:  /dev/i2c-1
   DRM connector:           card0-DVI-D-1
   EDID synopsis:
      Mfg id:               AUS - UNK
      Model:                VA249
...
      Manufacture year:     2019,  Week: 53
   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 0 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 1 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 1 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 1 --brief 10: VCP 10 C 25 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 1 --brief 10: 

DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 0 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 0 --brief 10: VCP 10 C 25 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 0 --brief 10: 

DEBUG ddcci_plasmoid_backend.__main__: Detected 2 working monitor busses, 0 non-working busses.
{"command": "detect", "value": [{"id": 1, "name": "DELL U2414H", "bus_id": 0, "brightness": 25}, {"id": 2, "name": "VA249", "bus_id": 1, "brightness": 25}]}

It didnt work on fresh boot, now it works but still displays the error message as in the picture above

Please do not close this yet, ill try to reproduce it tomorrow and post the log here

sandorex commented 1 year ago

On boot it acts weird but the backend worked fine

% ddcci_plasmoid_backend --debug 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: /home/sandorex/.local/bin/ddcci_plasmoid_backend --debug 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-0
   DRM connector:           card0-HDMI-A-1
   EDID synopsis:
      Mfg id:               DEL - Dell Inc.
      Model:                DELL U2414H
...
      Manufacture year:     2016,  Week: 46
   VCP version:         2.1

Display 2
   I2C bus:  /dev/i2c-1
   DRM connector:           card0-DVI-D-1
   EDID synopsis:
      Mfg id:               AUS - UNK
      Model:                VA249
...
      Manufacture year:     2019,  Week: 53
   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 0 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 1 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 0 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 0 --brief 10: VCP 10 C 30 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 0 --brief 10: 

DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 1 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 1 --brief 10: VCP 10 C 20 100
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 1 --brief 10: 

DEBUG ddcci_plasmoid_backend.__main__: Detected 2 working monitor busses, 0 non-working busses.
{"command": "detect", "value": [{"id": 1, "name": "DELL U2414H", "bus_id": 0, "brightness": 30}, {"id": 2, "name": "VA249", "bus_id": 1, "brightness": 20}]}

But only one monitor shows up Screenshot_20230714_105906

davidhi7 commented 1 year ago

To see the errors on boot, go to the widget settings and append --debug-log ~/ddcci_plasmoid_backend.log to the backend executable field. This should write all backend output to this file, allowing you to see what happens right after booting and what output the widget receives.

sandorex commented 1 year ago

I tried that and it seems to be random as it does no happen every boot, can you keep this open for a day or two so i can see if i can recreate it if not ill close it myself

davidhi7 commented 1 year ago

Sure, thanks for the effort to reproduce this.

sandorex commented 1 year ago

Ok got it

DEBUG ddcci_plasmoid_backend.ddcci: Found 2 entries at root level
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 0 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 1 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 0 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 0 --brief 10: No monitor detected on bus /dev/i2c-0
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 0 --brief 10: 

DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 1 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 1 --brief 10: No monitor detected on bus /dev/i2c-1
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 1 --brief 10: 

DEBUG ddcci_plasmoid_backend.__main__: Command 'ddcutil getvcp --bus 0 --brief 10' returned non-zero exit status 1.
DEBUG ddcci_plasmoid_backend.__main__: Detected 1 working monitor bus, 1 non-working bus.
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: /home/sandorex/.local/bin/ddcci_plasmoid_backend --debug-log /home/sandorex/log 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-0
   DRM connector:           card0-HDMI-A-1
   EDID synopsis:
      Mfg id:               DEL - Dell Inc.
      Model:                DELL U2414H
...
      Manufacture year:     2016,  Week: 46
   VCP version:         2.1

Display 2
   I2C bus:  /dev/i2c-1
   DRM connector:           card0-DVI-D-1
   EDID synopsis:
      Mfg id:               AUS - UNK
      Model:                VA249
...
      Manufacture year:     2019,  Week: 53
   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 0 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: Execute command: `ddcutil getvcp --bus 1 --brief 10`
DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 1 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 1 --brief 10: No monitor detected on bus /dev/i2c-1
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 1 --brief 10: 

DEBUG ddcci_plasmoid_backend.ddcci: [code]   ddcutil getvcp --bus 0 --brief 10: 1
DEBUG ddcci_plasmoid_backend.ddcci: [stdout] ddcutil getvcp --bus 0 --brief 10: No monitor detected on bus /dev/i2c-0
DEBUG ddcci_plasmoid_backend.ddcci: [stderr] ddcutil getvcp --bus 0 --brief 10: 

DEBUG ddcci_plasmoid_backend.__main__: Command 'ddcutil getvcp --bus 0 --brief 10' returned non-zero exit status 1.
DEBUG ddcci_plasmoid_backend.__main__: Detected 1 working monitor bus, 1 non-working bus.

At this point i suspect this is just the monitor not responding sometimes, my suggestion is to ignore this error in code like 5 times then write an error

I also get the same error in the applet popup like before but this time both monitors are listed

davidhi7 commented 12 months ago

There are multiple things wrong in the backend and the widget itself causing this, I'll look into this hopefully next weekend.