JafarAkhondali / acer-predator-turbo-and-rgb-keyboard-linux-module

Linux kernel module to support Turbo mode and RGB Keyboard for Acer Predator notebook series
GNU General Public License v3.0
358 stars 66 forks source link

Kernel 6.10 is not compatible with facer.c #163

Closed xAlpharax closed 1 month ago

xAlpharax commented 1 month ago

Model: AN515-45 aka Acer Nitro 5 from 2021

Count of keyboard RGB zones: 4

Count of Cpu Fans: 1

Count of Gpu Fans: 1

RGB keyboard works? No

Turbo button turn on fans? No

Turbo button turn on LED? No

Turbo button activates overclock? No

alphara@deltarion ~/dev/acer-rgb> sudo make make -C /lib/modules/6.10.0_1/build M=/home/alphara/dev/acer-rgb modules make[1]: Entering directory '/usr/src/kernel-headers-6.10.0_1' CC [M] /home/alphara/dev/acer-rgb/src/facer.o /home/alphara/dev/acer-rgb/src/facer.c:1946:6: warning: no previous prototype for 'WMID_gaming_set_fan_mode' [-Wmissing-prototypes] 1946 | void WMID_gaming_set_fan_mode(u8 fan_mode) | ^~~~~~~~ /home/alphara/dev/acer-rgb/src/facer.c: In function 'update_bl_status': /home/alphara/dev/acer-rgb/src/facer.c:2340:22: error: 'struct backlight_properties' has no member named 'fb_blank' 2340 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) | ^ /home/alphara/dev/acer-rgb/src/facer.c: At top level: /home/alphara/dev/acer-rgb/src/facer.c:1921:20: warning: 'WMID_gaming_get_u64' defined but not used [-Wunused-function] 1921 | static acpi_status WMID_gaming_get_u64(u64 *value, u32 cap) | ^~~~~~~ make[3]: [scripts/Makefile.build:244: /home/alphara/dev/acer-rgb/src/facer.o] Error 1 make[2]: [/usr/src/kernel-headers-6.10.0_1/Makefile:1934: /home/alphara/dev/acer-rgb] Error 2 make[1]: [Makefile:240: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/kernel-headers-6.10.0_1' make: [Makefile:14: default] Error 2 alphara@deltarion ~/dev/acer-rgb>

As well:

alphara@deltarion ~/dev/acer-rgb> sudo ./install.sh make -C /lib/modules/6.10.0_1/build M=/home/alphara/dev/acer-rgb modules make[1]: Entering directory '/usr/src/kernel-headers-6.10.0_1' CC [M] /home/alphara/dev/acer-rgb/src/facer.o /home/alphara/dev/acer-rgb/src/facer.c:1946:6: warning: no previous prototype for 'WMID_gaming_set_fan_mode' [-Wmissing-prototypes] 1946 | void WMID_gaming_set_fan_mode(u8 fan_mode) | ^~~~~~~~ /home/alphara/dev/acer-rgb/src/facer.c: In function 'update_bl_status': /home/alphara/dev/acer-rgb/src/facer.c:2340:22: error: 'struct backlight_properties' has no member named 'fb_blank' 2340 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) | ^ /home/alphara/dev/acer-rgb/src/facer.c: At top level: /home/alphara/dev/acer-rgb/src/facer.c:1921:20: warning: 'WMID_gaming_get_u64' defined but not used [-Wunused-function] 1921 | static acpi_status WMID_gaming_get_u64(u64 *value, u32 cap) | ^~~~~~~ make[3]: [scripts/Makefile.build:244: /home/alphara/dev/acer-rgb/src/facer.o] Error 1 make[2]: [/usr/src/kernel-headers-6.10.0_1/Makefile:1934: /home/alphara/dev/acer-rgb] Error 2 make[1]: [Makefile:240: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/kernel-headers-6.10.0_1' make: [Makefile:14: default] Error 2 rmmod: ERROR: Module acer_wmi is not currently loaded insmod: ERROR: could not load module src/facer.ko: No such file or directory [ 10.239395] wlp5s0: associate with 24:a2:e1:ed:9a:02 (try 1/3) [ 10.258186] wlp5s0: RX AssocResp from 24:a2:e1:ed:9a:02 (capab=0x1411 status=0 aid=22) [ 10.272542] wlp5s0: associated [ 10.322478] wlp5s0: Limiting TX power to 20 (20 - 0) dBm as advertised by 24:a2:e1:ed:9a:02 [ 55.831231] nvidia_uvm: module uses symbols nvUvmInterfaceDisableAccessCntr from proprietary module nvidia, inheriting taint. [ 55.933519] nvidia-uvm: Loaded the UVM driver, major device number 509. [ 55.969243] warning: `slstatus' uses wireless extensions which will stop working for Wi-Fi 7 hardware; use nl80211 [ 55.997487] Bluetooth: RFCOMM TTY layer initialized [ 55.997499] Bluetooth: RFCOMM socket layer initialized [ 55.997502] Bluetooth: RFCOMM ver 1.11 [*] Done alphara@deltarion ~/dev/acer-rgb>

I would like to resolve this issue if someone can help me figure out what needs to be done and maybe then patch it.

xAlpharax commented 1 month ago

apparently acer-wmi seems to not be included in the kernel?

xAlpharax commented 1 month ago

well, apparently wmi is enabled:

alphara@deltarion ~> lsmod | grep wmi

wmi_bmof 12288 0

wmi 28672 2 video,wmi_bmof

alphara@deltarion ~>

xAlpharax commented 1 month ago

modprob'ed acer-wmi

alphara@deltarion ~/dev/acer-rgb> sudo ./install.sh Password: make -C /lib/modules/6.10.0_1/build M=/home/alphara/dev/acer-rgb modules make[1]: Entering directory '/usr/src/kernel-headers-6.10.0_1' CC [M] /home/alphara/dev/acer-rgb/src/facer.o /home/alphara/dev/acer-rgb/src/facer.c:1946:6: warning: no previous prototype for 'WMID_gaming_set_fan_mode' [-Wmissing-prototypes] 1946 | void WMID_gaming_set_fan_mode(u8 fan_mode) | ^~~~~~~~ /home/alphara/dev/acer-rgb/src/facer.c: In function 'update_bl_status': /home/alphara/dev/acer-rgb/src/facer.c:2340:22: error: 'struct backlight_properties' has no member named 'fb_blank' 2340 | if (bd->props.fb_blank != FB_BLANK_UNBLANK) | ^ /home/alphara/dev/acer-rgb/src/facer.c: At top level: /home/alphara/dev/acer-rgb/src/facer.c:1921:20: warning: 'WMID_gaming_get_u64' defined but not used [-Wunused-function] 1921 | static acpi_status WMID_gaming_get_u64(u64 *value, u32 cap) | ^~~~~~~ make[3]: [scripts/Makefile.build:244: /home/alphara/dev/acer-rgb/src/facer.o] Error 1 make[2]: [/usr/src/kernel-headers-6.10.0_1/Makefile:1934: /home/alphara/dev/acer-rgb] Error 2 make[1]: [Makefile:240: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/kernel-headers-6.10.0_1' make: [Makefile:14: default] Error 2 insmod: ERROR: could not insert module src/facer.ko: Invalid module format [ 467.160252] acer_wmi: Acer Laptop ACPI-WMI Extras [ 467.160281] acer_wmi: Function bitmap for Communication Button: 0x801 [ 467.165960] input: Acer WMI hotkeys as /devices/virtual/input/input21 [ 468.031609] acer_wmi: Acer Laptop WMI Extras unloaded [ 468.075672] facer: version magic '6.6.40_1 SMP preempt mod_unload ' should be '6.10.0_1 SMP preempt mod_unload ' [ 514.434555] acer_wmi: Acer Laptop ACPI-WMI Extras [ 514.434590] acer_wmi: Function bitmap for Communication Button: 0x801 [ 514.440526] input: Acer WMI hotkeys as /devices/virtual/input/input22 [ 515.302670] acer_wmi: Acer Laptop WMI Extras unloaded [ 515.324349] facer: version magic '6.6.40_1 SMP preempt mod_unload ' should be '6.10.0_1 SMP preempt mod_unload ' [*] Done alphara@deltarion ~/dev/acer-rgb>

giltwist commented 1 month ago

Confirming issue. As per #113, I uninstalled and reinstalled, but had the same errors listed above on a AN16-41

xAlpharax commented 1 month ago

error: 'struct backlight_properties' has no member named 'fb_blank' is the culprit. fb_blank apparently has been removed in 6.10

xAlpharax commented 1 month ago

Update: A quick fix might be to just remove the part that is mentioned to be erroring out.

JafarAkhondali commented 1 month ago

We do really need someone to rebase the code to match with the latest kernel changes, If I had access to the laptop I would do it but I don't, which makes testing so hard.

xAlpharax commented 1 month ago

We do really need someone to rebase the code to match with the latest kernel changes, If I had access to the laptop I would do it but I don't, which makes testing so hard.

I could look through it given the change log of deprecated tools and file a PR. Can you tell me, as the owner, is fb_blank really needed in the script or what do you know about its purpose?

JafarAkhondali commented 1 month ago

@xAlpharax I don't think so, but I assume safest option is to use the updated version: https://github.com/torvalds/linux/blob/0c3836482481200ead7b416ca80c68a29cfdaabd/drivers/platform/x86/acer-wmi.c#L1658 maybe simply copy-paste the "update_bl_status" function?

xAlpharax commented 1 month ago

@xAlpharax I don't think so, but I assume safest option is to use the updated version: https://github.com/torvalds/linux/blob/0c3836482481200ead7b416ca80c68a29cfdaabd/drivers/platform/x86/acer-wmi.c#L1658 maybe simply copy-paste the "update_bl_status" function?

figuring how i would use the BIT(3), whatever it may be, it says it s directly given by the power button.

i can try these hot fixes with the 6.10 kernel booted and maybe come back to you.

xAlpharax commented 1 month ago

@JafarAkhondali i got everything working right by just commenting these out:

static int update_bl_status(struct backlight_device *bd)
{
    int intensity = bd->props.brightness;

    /*if (bd->props.power != FB_BLANK_UNBLANK)*/
        /*intensity = 0;*/
    /*if (bd->props.fb_blank != FB_BLANK_UNBLANK)*/
        /*intensity = 0;*/

    set_u32(intensity, ACER_CAP_BRIGHTNESS);

    return 0;
}

So this works... Now, I need to understand why these were important in the first place or whether or not we could just remove this code. What do you think?

JafarAkhondali commented 1 month ago

Nice @xAlpharax Can't you change this line:

int intensity = bd->props.brightness;

to:

int intensity = backlight_get_brightness(bd);

so that it matches the latest version in kernel? Here are the changes to this function, it looks the same more shorter: https://github.com/torvalds/linux/commit/441ffc52d640733adddcce7f9e50996ea59731f3

xAlpharax commented 1 month ago

Nice @xAlpharax Can't you change this line:

int intensity = bd->props.brightness;

to:

int intensity = backlight_get_brightness(bd);

so that it matches the latest version in kernel? Here are the changes to this function, it looks the same more shorter: https://github.com/torvalds/linux/commit/441ffc52d640733adddcce7f9e50996ea59731f3

Nice! I see now. Let me test and I'll come back to you.

xAlpharax commented 1 month ago

@JafarAkhondali I did some extensive testing with the new changes and submitted this PR above. Check it and if you have any objections/edits you would wish to make feel free to co-auth.