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

[BUG] Python scripts no longer work #287

Open
anasbouzid opened this issue Dec 4, 2024 · 5 comments
Open

[BUG] Python scripts no longer work #287

anasbouzid opened this issue Dec 4, 2024 · 5 comments

Comments

@anasbouzid
Copy link

Problem Description
After this commit, I'm getting the following error message when executing the Python GUI legion_gui.py then trying to set or read a profile:

Traceback (most recent call last):
  File "~/LenovoLegionLinux/python/legion_linux/legion_linux/legion_gui.py", line 869, in on_read_fan_curve_from_hw
    self.model.read_fancurve_from_hw()
  File "~/LenovoLegionLinux/python/legion_linux/legion_linux/../legion_linux/legion.py", line 1486, in read_fancurve_from_hw
    self.fan_curve = self.fancurve_io.read_fan_curve()
  File "~/LenovoLegionLinux/python/legion_linux/legion_linux/../legion_linux/legion.py", line 960, in read_fan_curve
    fan1_speed = self.get_fan_1_speed_rpm(point_id)
  File "~/LenovoLegionLinux/python/legion_linux/legion_linux/../legion_linux/legion.py", line 868, in get_fan_1_speed_rpm
    return round(self.get_fan_1_speed_pwm(point_id)/255.0*self.get_fan_1_max_rpm(), ndigits=2)
  File "~/LenovoLegionLinux/python/legion_linux/legion_linux/../legion_linux/legion.py", line 795, in get_fan_1_max_rpm
    return int(self._read_file(file_path))
  File "~/LenovoLegionLinux/python/legion_linux/legion_linux/../legion_linux/legion.py", line 774, in _read_file
    with open(file_path, "r", encoding=DEFAULT_ENCODING) as filepointer:
FileNotFoundError: [Errno 2] No such file or directory: '/sys/module/legion_laptop/drivers/platform:legion/PNP0C09:00/hwmon/hwmon4/fan1_max'

This is the list of all files inside /sys/module/legion_laptop/drivers/platform:legion/PNP0C09:00/hwmon/hwmon4/:

~ ls /sys/module/legion_laptop/drivers/platform:legion/PNP0C09:00/hwmon/hwmon4/
auto_points_size             pwm1_auto_point5_temp_hyst   pwm2_auto_point6_pwm
device                       pwm1_auto_point6_accel       pwm2_auto_point6_temp
fan1_input                   pwm1_auto_point6_decel       pwm2_auto_point6_temp_hyst
fan1_label                   pwm1_auto_point6_pwm         pwm2_auto_point7_pwm
fan1_target                  pwm1_auto_point6_temp        pwm2_auto_point7_temp
fan2_input                   pwm1_auto_point6_temp_hyst   pwm2_auto_point7_temp_hyst
fan2_label                   pwm1_auto_point7_accel       pwm2_auto_point8_pwm
fan2_target                  pwm1_auto_point7_decel       pwm2_auto_point8_temp
minifancurve                 pwm1_auto_point7_pwm         pwm2_auto_point8_temp_hyst
name                         pwm1_auto_point7_temp        pwm2_auto_point9_pwm
power                        pwm1_auto_point7_temp_hyst   pwm2_auto_point9_temp
pwm1_auto_point10_accel      pwm1_auto_point8_accel       pwm2_auto_point9_temp_hyst
pwm1_auto_point10_decel      pwm1_auto_point8_decel       pwm3_auto_point10_temp
pwm1_auto_point10_pwm        pwm1_auto_point8_pwm         pwm3_auto_point10_temp_hyst
pwm1_auto_point10_temp       pwm1_auto_point8_temp        pwm3_auto_point1_temp
pwm1_auto_point10_temp_hyst  pwm1_auto_point8_temp_hyst   pwm3_auto_point1_temp_hyst
pwm1_auto_point1_accel       pwm1_auto_point9_accel       pwm3_auto_point2_temp
pwm1_auto_point1_decel       pwm1_auto_point9_decel       pwm3_auto_point2_temp_hyst
pwm1_auto_point1_pwm         pwm1_auto_point9_pwm         pwm3_auto_point3_temp
pwm1_auto_point1_temp        pwm1_auto_point9_temp        pwm3_auto_point3_temp_hyst
pwm1_auto_point1_temp_hyst   pwm1_auto_point9_temp_hyst   pwm3_auto_point4_temp
pwm1_auto_point2_accel       pwm1_mode                    pwm3_auto_point4_temp_hyst
pwm1_auto_point2_decel       pwm2_auto_point10_pwm        pwm3_auto_point5_temp
pwm1_auto_point2_pwm         pwm2_auto_point10_temp       pwm3_auto_point5_temp_hyst
pwm1_auto_point2_temp        pwm2_auto_point10_temp_hyst  pwm3_auto_point6_temp
pwm1_auto_point2_temp_hyst   pwm2_auto_point1_pwm         pwm3_auto_point6_temp_hyst
pwm1_auto_point3_accel       pwm2_auto_point1_temp        pwm3_auto_point7_temp
pwm1_auto_point3_decel       pwm2_auto_point1_temp_hyst   pwm3_auto_point7_temp_hyst
pwm1_auto_point3_pwm         pwm2_auto_point2_pwm         pwm3_auto_point8_temp
pwm1_auto_point3_temp        pwm2_auto_point2_temp        pwm3_auto_point8_temp_hyst
pwm1_auto_point3_temp_hyst   pwm2_auto_point2_temp_hyst   pwm3_auto_point9_temp
pwm1_auto_point4_accel       pwm2_auto_point3_pwm         pwm3_auto_point9_temp_hyst
pwm1_auto_point4_decel       pwm2_auto_point3_temp        subsystem
pwm1_auto_point4_pwm         pwm2_auto_point3_temp_hyst   temp1_input
pwm1_auto_point4_temp        pwm2_auto_point4_pwm         temp1_label
pwm1_auto_point4_temp_hyst   pwm2_auto_point4_temp        temp2_input
pwm1_auto_point5_accel       pwm2_auto_point4_temp_hyst   temp2_label
pwm1_auto_point5_decel       pwm2_auto_point5_pwm         temp3_input
pwm1_auto_point5_pwm         pwm2_auto_point5_temp        temp3_label
pwm1_auto_point5_temp        pwm2_auto_point5_temp_hyst   uevent

Model and Debug Info

Installation type: via package manager,
Distribution: KDE neon 5.27, ubuntu 22.04
Model name: 16ACH6H
CPU model: AMD Ryzen 7 5800H
GPU model: NVIDIA RTX 3700

Output of sudo dmidecode -t system:

# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.3.0 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
        Manufacturer: LENOVO
        Product Name: 82JQ
        Version: Legion 5 Pro 16ACH6H
        Serial Number: ***
        UUID: ***
        Wake-up Type: Power Switch
        SKU Number: LENOVO_MT_82JQ_BU_idea_FM_Legion 5 Pro 16ACH6H
        Family: Legion 5 Pro 16ACH6H

Handle 0x0021, DMI type 12, 5 bytes
System Configuration Options
        Option 1: String1 for Type12 Equipment Manufacturer
        Option 2: String2 for Type12 Equipment Manufacturer
        Option 3: String3 for Type12 Equipment Manufacturer
        Option 4: String4 for Type12 Equipment Manufacturer

Handle 0x0031, DMI type 32, 20 bytes
System Boot Information
        Status: No errors detected

Output of sudo dmidecode -t bios:

# dmidecode 3.3
Getting SMBIOS data from sysfs.
SMBIOS 3.3.0 present.

Handle 0x0000, DMI type 0, 26 bytes
BIOS Information
        Vendor: LENOVO
        Version: GKCN59WW
        Release Date: 11/21/2022
        Address: 0xE0000
        Runtime Size: 128 kB
        ROM Size: 16 MB
        Characteristics:
                PCI is supported
                BIOS is upgradeable
                BIOS shadowing is allowed
                Boot from CD is supported
                Selectable boot is supported
                EDD is supported
                Japanese floppy for NEC 9800 1.2 MB is supported (int 13h)
                Japanese floppy for Toshiba 1.2 MB is supported (int 13h)
                5.25"/360 kB floppy services are supported (int 13h)
                5.25"/1.2 MB floppy services are supported (int 13h)
                3.5"/720 kB floppy services are supported (int 13h)
                3.5"/2.88 MB floppy services are supported (int 13h)
                8042 keyboard services are supported (int 9h)
                CGA/mono video services are supported (int 10h)
                ACPI is supported
                USB legacy is supported
                BIOS boot specification is supported
                Targeted content distribution is supported
                UEFI is supported
        BIOS Revision: 1.59
        Firmware Revision: 1.59

Handle 0x0022, DMI type 13, 22 bytes
BIOS Language Information
        Language Description Format: Long
        Installable Languages: 4
                en|US|iso8859-1
                fr|FR|iso8859-1
                ja|JP|unicode
                zh|TW|unicode
        Currently Installed Language: en|US|iso8859-1

Output of sudo cat /sys/kernel/debug/legion/fancurve:

EC Chip ID: 8227
EC Chip Version: 2a4
legion_laptop features: fancurve powermode platformprofile platformprofilenotify minifancurve
legion_laptop ec_readonly: 0
ACPI CFG error: 0
ACPI CFG: 2081289482
temperature access method: 1
CPU temperature error: 0
CPU temperature: 53
CPU temperature EC error: 0
CPU temperature EC: 53
CPU temperature ACPI error: 0
CPU temperature ACPI: 53
CPU temperature WMI error: 0
CPU temperature WMI: 0
CPU temperature WMI2 error: 0
CPU temperature WMI2: 53
CPU temperature WMI3 error: 0
CPU temperature WMI3: 0
GPU temperature error: 0
GPU temperature: 43
GPU temperature EC error: 0
GPU temperature EC: 43
GPU temperature ACPI error: 0
GPU temperature ACPI: 43
GPU temperature WMI error: 0
GPU temperature WMI: 0
GPU temperature WMI2 error: 0
GPU temperature WMI2: 43
GPU temperature WMI3 error: 0
GPU temperature WMI3: 0
fan speed access method: 1
1 fanspeed error: 0
1 fanspeed: 0
1 fanspeed EC error: 0
1 fanspeed EC: 0
1 fanspeed ACPI error: 0
1 fanspeed ACPI: 0
1 fanspeed WMI error: 0
1 fanspeed WMI: 0
1 fanspeed WMI2 error: 0
1 fanspeed WMI2: 0
1 fanspeed WMI3 error: 0
1 fanspeed WMI3: 0
2 fanspeed error: 0
2 fanspeed: 0
2 fanspeed EC error: 0
2 fanspeed EC: 0
2 fanspeed ACPI error: 0
2 fanspeed ACPI: 0
2 fanspeed WMI error: 0
2 fanspeed WMI: 0
2 fanspeed WMI2 error: 0
2 fanspeed WMI2: 0
2 fanspeed WMI3 error: 0
2 fanspeed WMI3: 0
powermode access method: 3
powermode error: 0
powermode: 1
powermode EC error: 0
powermode EC: 18
powermode ACPI error: -5
powermode ACPI: 0
powermode WMI error: 0
powermode WMI: 1
has custom powermode: 1
ACPI rapidcharge error: 0
ACPI rapidcharge: 0
WMI backlight 2 state: 0
WMI backlight 3 state: 0
WMI light IO port: 0
WMI light Y logo/lid: 0
EC minifancurve feature enabled: 1
EC minifancurve on cool: false
EC lockfancontroller error: 0
EC lockfancontroller: false
fanfullspeed error: 0
fanfullspeed: 0
fanfullspeed EC error: 0
fanfullspeed EC: 0
EC fan curve current point id: 0
EC fan curve points size: 8
Current fan curve in hardware:
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
0        0       2       2       0       127     0       47      0       48
1100     1100    2       2       127     127     47      52      48      52
1500     1500    2       2       127     127     52      58      52      56
2100     2100    2       2       127     127     58      66      56      127
2300     2300    2       2       127     127     66      70      127     127
2600     2600    2       2       127     127     70      75      127     127
2800     2800    2       2       127     127     75      80      127     127
3500     3500    2       2       127     127     80      127     127     127
=====================
Current fan curve in hardware (WMI; might be empty)
rpm1|rpm2|acceleration|deceleration|cpu_min_temp|cpu_max_temp|gpu_min_temp|gpu_max_temp|ic_min_temp|ic_max_temp
=====================
@johnfanv2
Copy link
Owner

Sorry, we updated the kernel and the GUI at the same time but did not make the GUI compatible with lower level version kernels. We need to make a breaking change to follow official kernel standard to eventually merge it into main line kerne. Please just update the kernel module.

Which package from which source did you use to install it? It should be correct in the package sources. If you installed a dkms package for the kernel module please also try to update this.

@anasbouzid
Copy link
Author

I was using v0.0.15, then I upgraded to v0.0.18 via the .deb file from this link (I followed the Debian repo link in the README page). I tried to install it via DKMS but no luck, no error when building but when I reboot, the module is not loaded.

@anasbouzid
Copy link
Author

I'm currently using an old commit, everything works perfectly. Thank you so much for your work.

@johnfanv2
Copy link
Owner

Hey, do you have problems with the newest version and fixed it by using an old commit? Or did you had problems with an old commit?

@anasbouzid
Copy link
Author

I had problems with the newest version and fixed it by using an old commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants