system_tray_extensions icon indicating copy to clipboard operation
system_tray_extensions copied to clipboard

Error selecting option in lightbar

Open richhh7g opened this issue 4 years ago • 17 comments

When I select an option in STE/LightBar the script breaks.


When starting the script I get this log:

$ bash start.sh SCRIPT_DIR=/home/anoun/.system_tray_extensions State file is NOT found: /home/anoun/.system_tray_extensions/modules/Core/../../state.json Traceback (most recent call last): File "/home/anoun/.system_tray_extensions/app.py", line 30, in main core._init_module(module_class, module_name) File "/home/anoun/.system_tray_extensions/modules/Core/main.py", line 234, in _init_module self.modules[module_name] = module_class(self.nodes[module_name]) File "/home/anoun/.system_tray_extensions/modules/Ite8291r3/main.py", line 41, in init self.ite = ite8291r3.get() File "/home/anoun/.system_tray_extensions/ste_env/lib/python3.9/site-packages/ite8291r3_ctl/ite8291r3.py", line 298, in get raise FileNotFoundError("no suitable device found") FileNotFoundError: no suitable device found None Error initializing module Ite8291r3 State file is NOT found: /home/anoun/.system_tray_extensions/modules/Core/../../state.json Traceback (most recent call last): File "/home/anoun/.system_tray_extensions/app.py", line 30, in main core._init_module(module_class, module_name) File "/home/anoun/.system_tray_extensions/modules/Core/main.py", line 234, in _init_module self.modules[module_name] = module_class(self.nodes[module_name]) File "/home/anoun/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 27, in init self.reload_state() File "/home/anoun/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 60, in reload_state self.apply_lightbar_animation() File "/home/anoun/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 94, in apply_lightbar_animation with open('/sys/class/leds/lightbar_animation::status/brightness', 'w') as f: FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/leds/lightbar_animation::status/brightness' None Error initializing module TuxedoKeyboard State file is NOT found: /home/anoun/.system_tray_extensions/modules/Core/../../state.json enter power_state_check_function Initialized DgpuPowerstateMonitor Exception in thread Thread-8: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() File "/usr/lib/python3.9/threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "/home/anoun/.system_tray_extensions/modules/DgpuPowerstateMonitor/main.py", line 57, in power_state_check_function with open('/sys/class/power_supply/BAT0/status', 'r', encoding='utf-8') as f: FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/power_supply/BAT0/status' Initialized BatteryPowerDrawMonitor Initialized UpdateManager

(standalone_app.py:54824): Gtk-WARNING **: 22:48:22.442: Theme parsing error: gtk-dark.css:5822:26: '-shadow' is not a valid color name

(standalone_app.py:54824): Gtk-WARNING **: 22:48:22.442: Theme parsing error: gtk-dark.css:5825:14: not a number

(standalone_app.py:54824): Gtk-WARNING **: 22:48:22.442: Theme parsing error: gtk-dark.css:5826:13: not a number

(standalone_app.py:54824): Gtk-WARNING **: 22:48:22.442: Theme parsing error: gtk-dark.css:5827:11: Expected alength Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.9/threading.py", line 973, in _bootstrap_inner self.run() File "/usr/lib/python3.9/threading.py", line 910, in run self._target(*self._args, **self._kwargs) File "/home/anoun/.system_tray_extensions/modules/BatteryPowerDrawMonitor/standalone_app.py", line 30, inshow_indicator with open('/sys/class/power_supply/BAT0/current_now', 'r', encoding='utf-8') as f: FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/power_supply/BAT0/current_now' UpdateManager fetch and status: ## main...origin/main


When I select a color in the lightbar, I get it:

^[[6;7~Traceback (most recent call last): File "/home/anoun/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 65, in self.lb_ac1 = QAction("Animation"); self.lb_ac1.triggered.connect(lambda: self.apply_lightbar_animation() ); self.lb.addAction(self.lb_ac1) File "/home/anoun/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 94, in apply_lightbar_animation with open('/sys/class/leds/lightbar_animation::status/brightness', 'w') as f: FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/leds/lightbar_animation::status/brightness' start.sh: line 6: 54778 Aborted (core dumped) python3 "$SCRIPT_DIR"/app.py

richhh7g avatar Dec 02 '21 01:12 richhh7g

For keyboard lights, if you have the proper device 048d:6004 or 048d:ce00 (you can check it with lsusb) then you have to enable writing permissions. Check the installation section in the readme.

For lightbar, you need the tuxedo-keyboard package so this script will be able to access /sys/class/leds/lightbar_animation::status/ and other files to control the lightbar. If you have installed the package also check the installation section to make sure that you have writing permissions.

If you can't solve the problem after trying the ways mentioned above then run lsusb and ls /sys/class/leds share the outputs here, so I can examine the problem better.

salihmarangoz avatar Dec 02 '21 02:12 salihmarangoz

Seems like i have the same error.

> lsusb | grep -e "048d:6004" -e "048d:ce00"
Bus 003 Device 004: ID 048d:6004 Integrated Technology Express, Inc.
> ls /sys/class/leds
input20::capslock  input20::kana     input20::scrolllock  input3::numlock     phy0-led
input20::compose   input20::numlock  input3::capslock     input3::scrolllock
> cat /etc/udev/rules.d/99-ste.rules
# RGB Keyboard
SUBSYSTEMS=="usb", ATTRS{idVendor}=="048d", ATTRS{idProduct}=="6004", MODE:="0666"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="048d", ATTRS{idProduct}=="ce00", MODE:="0666"

# Tuxedo Keyboard
SUBSYSTEM=="leds", ACTION=="add", RUN+="/bin/chgrp -R leds /sys%p", RUN+="/bin/chmod -R g=u /sys%p"
SUBSYSTEM=="leds", ACTION=="change", ENV{TRIGGER}!="none", RUN+="/bin/chgrp -R leds /sys%p", RUN+="/bin/chmod -R g=u /sys%p"

For Installation of tuxedo-keyboard I redid the steps here. Still I'm getting the following output on starting manually.

> bash start.sh
SCRIPT_DIR=/home/chrosey/.system_tray_extensions
State file is found: /home/chrosey/.system_tray_extensions/modules/Core/../../state.json
Reloading state: {'mode': 'custom', 'value': '/home/chrosey/.system_tray_extensions/rgb_kb_custom/Spaghetti.mp4', 'brightness': 0.5, 'toggle': True}
starting video_function
State file is found: /home/chrosey/.system_tray_extensions/modules/Core/../../state.json
State file saved: /home/chrosey/.system_tray_extensions/modules/Core/../../state.json
Initialized Ite8291r3
Loaded video with fps: 20.0
State file is found: /home/chrosey/.system_tray_extensions/modules/Core/../../state.json
Traceback (most recent call last):
  File "/home/chrosey/.system_tray_extensions/app.py", line 30, in main
    core._init_module(module_class, module_name)
  File "/home/chrosey/.system_tray_extensions/modules/Core/main.py", line 234, in _init_module
    self.modules[module_name] = module_class(self.nodes[module_name])
  File "/home/chrosey/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 27, in __init__
    self.reload_state()
  File "/home/chrosey/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 58, in reload_state
    self.apply_lightbar_animation()
  File "/home/chrosey/.system_tray_extensions/modules/TuxedoKeyboard/main.py", line 92, in apply_lightbar_animation
    with open('/sys/class/leds/lightbar_animation::status/brightness', 'w') as f:
FileNotFoundError: [Errno 2] Datei oder Verzeichnis nicht gefunden: '/sys/class/leds/lightbar_animation::status/brightness'
None
Error initializing module TuxedoKeyboard
State file is found: /home/chrosey/.system_tray_extensions/modules/Core/../../state.json
enter power_state_check_function
Initialized DgpuPowerstateMonitor
Initialized BatteryPowerDrawMonitor
Traceback (most recent call last):
  File "/home/chrosey/.system_tray_extensions/modules/BatteryPowerDrawMonitor/standalone_app.py", line 2, in <module>
    gi.require_version('Gtk', '3.0')
  File "/home/chrosey/.system_tray_extensions/ste_env/lib/python3.9/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace Gtk not available
Initialized UpdateManager
UpdateManager fetch and status: ## main...origin/main

maybe this helps.

chrosey avatar Dec 27 '21 13:12 chrosey

ls /sys/class/leds

Looks like lightbar is not recognized by tuxedo-keyboard so there is no entry there. You should be able to control lightbar without this project by following the Tuxedo webpage. Also, I should mention that lightbar is completely separated from ite devices so their controls are different. This is my output for ls /sys/class/leds:

input30::capslock    input33::capslock  input33::numlock     input3::numlock             lightbar_rgb:1:status  phy0-led
input30::numlock     input33::compose   input33::scrolllock  input3::scrolllock          lightbar_rgb:2:status
input30::scrolllock  input33::kana      input3::capslock     lightbar_animation::status  lightbar_rgb:3:status

Maybe I can add a check for it if the laptop is not supported or it needs proper tuxeod-keyboard installation. Which laptop do you have?

salihmarangoz avatar Dec 27 '21 15:12 salihmarangoz

My laptop is a TUXEDO Stellaris 15 Gen3

the instructions from Tuxedo did not work well with my laptop either. I cannot see how to control light of the lightbar there or in the Repository

chrosey avatar Dec 27 '21 17:12 chrosey

My laptop is a TUXEDO Stellaris 15 Gen3

the instructions from Tuxedo did not work well with my laptop either. I cannot see how to control light of the lightbar there or in the Repository

I have the same laptop too. Have you applied "Add as DKMS Module" and "Load the Module on boot" sections in the tuxedo-keyboard repository?

salihmarangoz avatar Dec 27 '21 19:12 salihmarangoz

i did a quick check if i did these steps:

> sudo make dkmsinstall
cp -R . /usr/src/tuxedo-keyboard-3.0.9
dkms install -m tuxedo-keyboard -v 3.0.9
Module tuxedo-keyboard/3.0.9 already installed on kernel 5.11.0-43-generic/x86_64
> cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
tuxedo_keyboard

Most likely I did not follow the instructions from repository, but from website instructions here

chrosey avatar Dec 28 '21 10:12 chrosey

Did you run 'sudo apt install git dkms build-essential linux-headers-$(uname -r)' ? It should be working after restart. Do you see lightbar entries when you run 'ls /sys/class/leds' ? If not then it would be better to contact Tuxedo or create an issue on tuxedo-keyboard project.

salihmarangoz avatar Dec 28 '21 11:12 salihmarangoz

most likely i did, check resulted in nothing to install

> sudo apt install git dkms build-essential linux-headers-$(uname -r)
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
git ist schon die neueste Version (1:2.25.1-1ubuntu3.2).
linux-headers-5.11.0-43-generic ist schon die neueste Version (5.11.0-43.47~20.04.2).
build-essential ist schon die neueste Version (12.8ubuntu1.1).
dkms ist schon die neueste Version (2.8.1-5ubuntu2).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 19 nicht aktualisiert.

whatever happened since the 20 restarts:

> ls /sys/class/leds
input20::capslock  input20::numlock     input3::numlock             lightbar_rgb:1:status  phy0-led
input20::compose   input20::scrolllock  input3::scrolllock          lightbar_rgb:2:status
input20::kana      input3::capslock     lightbar_animation::status  lightbar_rgb:3:status

Lightbar configuration did now work. But why? :D

chrosey avatar Dec 28 '21 12:12 chrosey

Weird... Maybe you did something needed and some things happened and tada :D

salihmarangoz avatar Dec 28 '21 14:12 salihmarangoz

FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/leds/lightbar_animation::status/brightness'
start.sh: line 18:  2435 Aborted                 python3 "$SCRIPT_DIR"/app.py

using XMG NEO 15 2021 (kde neon) same issue here, but adding a catch exception on this so the tray is not closed or making the "lightbar" gray if that file is not found would be nice option i personally don't care about the lightbar all other functionality is flawless

sirnicolas21 avatar Apr 22 '22 10:04 sirnicolas21

FileNotFoundError: [Errno 2] No such file or directory: '/sys/class/leds/lightbar_animation::status/brightness'
start.sh: line 18:  2435 Aborted                 python3 "$SCRIPT_DIR"/app.py

using XMG NEO 15 2021 (kde neon) same issue here, but adding a catch exception on this so the tray is not closed or making the "lightbar" gray if that file is not found would be nice option i personally don't care about the lightbar all other functionality is flawless

Does this problem cause the program to terminate? I am planning to rewrite this project and I will be careful about these problems next time. Thanks for your feedback!

salihmarangoz avatar Apr 22 '22 14:04 salihmarangoz

yes the tray icon goes away and i need to restart the program

sirnicolas21 avatar Apr 22 '22 16:04 sirnicolas21

yes the tray icon goes away and i need to restart the program

Ah, okay thanks. You can remove "TuxedoKeyboard" entry from modules/loading_order.list to disable it. On the other hand, if you install tuxedo-keyboard I think you can control the lightbar.

salihmarangoz avatar Apr 22 '22 16:04 salihmarangoz

yes the tray icon goes away and i need to restart the program

Ah, okay thanks. You can remove "TuxedoKeyboard" entry from modules/loading_order.list to disable it. On the other hand, if you install tuxedo-keyboard I think you can control the lightbar.

sudo modprobe tuxedo_keyboard
rm /home/sirnicolas21/.system_tray_extensions/app.log
cat /home/sirnicolas21/.system_tray_extensions/app.log
INFO:root:=== APP STARTED ===
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:Reloading state: {'mode': 'mono', 'value': [1.0, 1.0, 1.0], 'brightness': 0.5, 'toggle': True}
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:State file saved: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:Initialized Ite8291r3
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:None
INFO:root:Error initializing module TuxedoKeyboard
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:enter power_state_check_function
INFO:root:Initialized DgpuPowerstateMonitor
INFO:root:Initialized BatteryPowerDrawMonitor
DEBUG:git.cmd:Popen(['git', 'version'], cwd=/home/sirnicolas21, universal_newlines=False, shell=None, istream=None)
DEBUG:git.cmd:Popen(['git', 'version'], cwd=/home/sirnicolas21, universal_newlines=False, shell=None, istream=None)
INFO:root:Initialized UpdateManager
DEBUG:git.cmd:Popen(['git', 'fetch', '-v', 'origin'], cwd=/home/sirnicolas21/.system_tray_extensions, universal_newlines=True, shell=None, istream=None)
DEBUG:git.cmd:Popen(['git', 'status', '-sb'], cwd=/home/sirnicolas21/.system_tray_extensions, universal_newlines=False, shell=None, istream=None)
INFO:root:UpdateManager fetch and status: ## main...origin/main
 M start.sh

nothing changed, however now it can find the files

sirnicolas21 avatar Apr 22 '22 22:04 sirnicolas21

yes the tray icon goes away and i need to restart the program

Ah, okay thanks. You can remove "TuxedoKeyboard" entry from modules/loading_order.list to disable it. On the other hand, if you install tuxedo-keyboard I think you can control the lightbar.

sudo modprobe tuxedo_keyboard
rm /home/sirnicolas21/.system_tray_extensions/app.log
cat /home/sirnicolas21/.system_tray_extensions/app.log
INFO:root:=== APP STARTED ===
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:Reloading state: {'mode': 'mono', 'value': [1.0, 1.0, 1.0], 'brightness': 0.5, 'toggle': True}
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:State file saved: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:Initialized Ite8291r3
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:None
INFO:root:Error initializing module TuxedoKeyboard
INFO:root:State file is found: /home/sirnicolas21/.system_tray_extensions/modules/Core/../../state.json
INFO:root:enter power_state_check_function
INFO:root:Initialized DgpuPowerstateMonitor
INFO:root:Initialized BatteryPowerDrawMonitor
DEBUG:git.cmd:Popen(['git', 'version'], cwd=/home/sirnicolas21, universal_newlines=False, shell=None, istream=None)
DEBUG:git.cmd:Popen(['git', 'version'], cwd=/home/sirnicolas21, universal_newlines=False, shell=None, istream=None)
INFO:root:Initialized UpdateManager
DEBUG:git.cmd:Popen(['git', 'fetch', '-v', 'origin'], cwd=/home/sirnicolas21/.system_tray_extensions, universal_newlines=True, shell=None, istream=None)
DEBUG:git.cmd:Popen(['git', 'status', '-sb'], cwd=/home/sirnicolas21/.system_tray_extensions, universal_newlines=False, shell=None, istream=None)
INFO:root:UpdateManager fetch and status: ## main...origin/main
 M start.sh

nothing changed, however now it can find the files

I think the lightbar can be controlled now but there is a permission problem. Did you do the installation step including /etc/udev/rules.d/99-ste.rules?

salihmarangoz avatar Apr 23 '22 00:04 salihmarangoz

yes i have the rules, anyway i disabled tuxedo plugin from loading_order, not that it was harming anything you will need a modules checklist in settings of the new version :)

sirnicolas21 avatar Apr 23 '22 09:04 sirnicolas21

yes i have the rules, anyway i disabled tuxedo plugin from loading_order, not that it was harming anything you will need a modules checklist in settings of the new version :)

Yeah, actually in the new version it will be automatic. Also, I will create another project for GPU stuff. I wasn't able to set the scale of the project :)

salihmarangoz avatar Apr 23 '22 11:04 salihmarangoz

Disabled TuxedoKeyboard / Lightbar plugin by default with 3f9b5dcb1a1561b907044143b771058b44afff16

salihmarangoz avatar May 29 '23 18:05 salihmarangoz