LordAmit / Brightness

Using Brightness Controller, you can control brightness of both primary and external displays in Linux. Check it out!
Other
1.05k stars 84 forks source link

Crashes when /dev/i2c-* are not accessible for the user #235

Open steho opened 1 year ago

steho commented 1 year ago

Describe the bug Release v2.4 crashes when /dev/i2c-* are not accessible for the user

version v2.4

To Reproduce Steps to reproduce the behavior:

$ sudo modprobe i2c-dev
$ ls -l /dev/i2c-7
crw-rw---- 1 root i2c 89, 7 20. Jan 11:15 /dev/i2c-7
$ # user is not member in group i2c
$ brightness-controller 
Traceback (most recent call last):
  File "/usr/bin/brightness-controller", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.10/site-packages/brightness_controller_linux/init.py", line 903, in main
    WINDOW = MyApplication()
  File "/usr/lib/python3.10/site-packages/brightness_controller_linux/init.py", line 139, in __init__
    self.generate_dynamic_items()
  File "/usr/lib/python3.10/site-packages/brightness_controller_linux/init.py", line 267, in generate_dynamic_items
    self.generate_brightness_sources()
  File "/usr/lib/python3.10/site-packages/brightness_controller_linux/init.py", line 282, in generate_brightness_sources
    self.ui.secondary_combo.addItem(self.displayNames[i])
IndexError: list index out of range
$ sudo rmmod i2c-dev
$ brightness-controller 
No /dev/i2c devices exist.
ddcutil requires module i2c-dev.
error: Command '['ddcutil', 'detect']' returned non-zero exit status 1.
[]
False

Expected behavior Either an error message or just grayed out option to use ddc

Screenshots M.A.

Desktop (please complete the following information): Manjaro Linux

Additional context This issue seems to have been introduced with this issue and was already reported here