Plippo / asus-wmi-screenpad

Variation of the asus-wmi kernel module with screenpad brightness support
Other
166 stars 23 forks source link

Lost Keyboardlight #44

Open Knoxi-Code opened 1 year ago

Knoxi-Code commented 1 year ago

Hey i have lost my keybordlight too :(

and icant build and install the module to the current kernel:

sudo dkms build -m asus-wmi -v 1.0 Building module: cleaning build area... make -j8 KERNELRELEASE=6.0.0-2parrot1-amd64 -C /lib/modules/6.0.0-2parrot1-amd64/build M=/var/lib/dkms/asus-wmi/1.0/build...(bad exit status: 2) Error! Bad return status for module build on kernel: 6.0.0-2parrot1-amd64 (x86_64) Consult /var/lib/dkms/asus-wmi/1.0/build/make.log for more information.

What can i do ?

Knoxi-Code commented 1 year ago

Error Log: DKMS make.log for asus-wmi-1.0 for kernel 6.0.0-2parrot1-amd64 (x86_64) Mo 9. Jan 14:36:08 CET 2023 make: Verzeichnis „/usr/src/linux-headers-6.0.0-2parrot1-amd64“ wird betreten CC [M] /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.o CC [M] /var/lib/dkms/asus-wmi/1.0/build/asus-nb-wmi.o /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c: In function ‘asus_wmi_input_init’: /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c:542:61: error: ‘ASUS_WMI_DEVID_LID_FLIP_ROG’ undeclared (first use in this function); did you mean ‘ASUS_WMI_DEVID_LID_FLIP’? 542 | result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | ASUS_WMI_DEVID_LID_FLIP /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c:542:61: note: each undeclared identifier is reported only once for each function it appears in /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c: In function ‘lid_flip_rog_tablet_mode_get_state’: /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c:592:53: error: ‘ASUS_WMI_DEVID_LID_FLIP_ROG’ undeclared (first use in this function); did you mean ‘ASUS_WMI_DEVID_LID_FLIP’? 592 | result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ | ASUS_WMI_DEVID_LID_FLIP make[1]: *** [/usr/src/linux-headers-6.0.0-2parrot1-common/scripts/Makefile.build:254: /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.o] Fehler 1 make: *** [/usr/src/linux-headers-6.0.0-2parrot1-common/Makefile:1876: /var/lib/dkms/asus-wmi/1.0/build] Fehler 2 make: Verzeichnis „/usr/src/linux-headers-6.0.0-2parrot1-amd64“ wird verlassen

Plippo commented 1 year ago

Have you tried cleaning up running the script from scratch to download and patch the correct version for your current kernel, as suggested in the Removing or reinstalling section in the readme? It looks like the version of the patched module's code no longer matches your kernel version and needs a re-download and re-patching.

PTFOPlayer commented 1 year ago

If you are on a distro with kernel 6.1 chances are it won't work for you at all, in my case it did and after reverting to kernel 6.0 it worked again (asus zenbook UX434fl)

ajnavarro commented 1 year ago

First of all, thanks for your amazing work.

I'm experiencing the same error. Using popOS with kernel 6.0.12-76060006-generic. Removing and installing again is not fixing the problem. Before that with kernel 5.x, it was working perfectly.

PTFOPlayer commented 1 year ago

Removing and installing again is not fixing the problem. Before that with kernel 5.x, it was working perfectly.

Did you ran the prepare-for-current-kernel.sh sript before using DKMS? I had same issue on kernel 6.0.15 on manjaro but i ran that script while reinstalling and it fixed it

Knoxi-Code commented 1 year ago

Hey i fix the problem with the kebordlighting, when you ovverride the modul with:

cd /lib/modules/YOURKERNELVERSION/kernel/drivers/platform/x86
sudo mv  asus-nb-wmi.ko asus-nb-wmi.ko_bak
sudo mv asus-wmi.ko asus-wmi.ko_bak
sudo ln -s ../../../../extra/asus-nb-wmi.ko ./
sudo ln -s ../../../../extra/asus-wmi.ko ./
sudo depmod -a

And your Keybord dosent work, you must delete, the asus-nb, asus-wmi:

rm /lib/modules/YOURKERNELVERSION/kernel/drivers/platform/x86/asus-nb-wmi.ko
rm /lib/modules/YOURKERNELVERSION/kernel/drivers/platform/x86/asus-wmi.ko

and yout keybord lighting after a reboot again.

Knoxi-Code commented 1 year ago

@Plippo
pls add this under deinstallation :)

rm /lib/modules/YOURKERNELVERSION/kernel/drivers/platform/x86/asus-nb-wmi.ko
rm /lib/modules/YOURKERNELVERSION/kernel/drivers/platform/x86/asus-wmi.ko
ajnavarro commented 1 year ago

@PTFOPlayer yep, I ran the script. Here is the output:

➜  sudo sh prepare-for-current-kernel.sh
Using: patch6.0
--2023-01-23 12:05:09--  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/platform/x86/asus-wmi.c?h=linux-6.0.y
Resolving git.kernel.org (git.kernel.org)... 139.178.84.217, 2604:1380:4601:e00::1
Connecting to git.kernel.org (git.kernel.org)|139.178.84.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 100794 (98K) [text/plain]
Saving to: ‘asus-wmi.c’

asus-wmi.c                                      100%[======================================================================================================>]  98,43K   185KB/s    in 0,5s    

2023-01-23 12:05:11 (185 KB/s) - ‘asus-wmi.c’ saved [100794/100794]

--2023-01-23 12:05:11--  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/platform/x86/asus-wmi.h?h=linux-6.0.y
Resolving git.kernel.org (git.kernel.org)... 139.178.84.217, 2604:1380:4641:c500::1
Connecting to git.kernel.org (git.kernel.org)|139.178.84.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2366 (2,3K) [text/plain]
Saving to: ‘asus-wmi.h’

asus-wmi.h                                      100%[======================================================================================================>]   2,31K  --.-KB/s    in 0s      

2023-01-23 12:05:11 (2,96 GB/s) - ‘asus-wmi.h’ saved [2366/2366]

--2023-01-23 12:05:11--  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/platform/x86/asus-nb-wmi.c?h=linux-6.0.y
Resolving git.kernel.org (git.kernel.org)... 139.178.84.217, 2604:1380:4641:c500::1
Connecting to git.kernel.org (git.kernel.org)|139.178.84.217|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17530 (17K) [text/plain]
Saving to: ‘asus-nb-wmi.c’

asus-nb-wmi.c                                   100%[======================================================================================================>]  17,12K   103KB/s    in 0,2s    

2023-01-23 12:05:12 (103 KB/s) - ‘asus-nb-wmi.c’ saved [17530/17530]

patching file asus-nb-wmi.c
Hunk #1 succeeded at 556 (offset 11 lines).
Hunk #2 succeeded at 566 (offset 11 lines).
Hunk #3 succeeded at 580 (offset 11 lines).
patching file asus-wmi.c
Hunk #2 succeeded at 210 (offset 1 line).
Hunk #3 succeeded at 1075 (offset 32 lines).
Hunk #4 succeeded at 1151 (offset 32 lines).
Hunk #5 succeeded at 1236 (offset 32 lines).

Error when building:

sudo dkms build -m asus-wmi -v 1.0

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=6.0.12-76060006-generic -C /lib/modules/6.0.12-76060006-generic/build M=/var/lib/dkms/asus-wmi/1.0/build...(bad exit status: 2)
ERROR (dkms apport): binary package for asus-wmi: 1.0 not found
Error! Bad return status for module build on kernel: 6.0.12-76060006-generic (x86_64)
Consult /var/lib/dkms/asus-wmi/1.0/build/make.log for more information.

make.log content:

  cat /var/lib/dkms/asus-wmi/1.0/build/make.log
DKMS make.log for asus-wmi-1.0 for kernel 6.0.12-76060006-generic (x86_64)
lun 23 ene 2023 12:09:21 CET
make: Entering directory '/usr/src/linux-headers-6.0.12-76060006-generic'
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-11 (Ubuntu 11.2.0-19ubuntu1) 11.2.0
  You are using:           gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
  CC [M]  /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.o
  CC [M]  /var/lib/dkms/asus-wmi/1.0/build/asus-nb-wmi.o
/var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c: In function ‘asus_wmi_input_init’:
/var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c:542:61: error: ‘ASUS_WMI_DEVID_LID_FLIP_ROG’ undeclared (first use in this function); did you mean ‘ASUS_WMI_DEVID_LID_FLIP’?
  542 |                 result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG);
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                             ASUS_WMI_DEVID_LID_FLIP
/var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c:542:61: note: each undeclared identifier is reported only once for each function it appears in
/var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c: In function ‘lid_flip_rog_tablet_mode_get_state’:
/var/lib/dkms/asus-wmi/1.0/build/asus-wmi.c:592:53: error: ‘ASUS_WMI_DEVID_LID_FLIP_ROG’ undeclared (first use in this function); did you mean ‘ASUS_WMI_DEVID_LID_FLIP’?
  592 |         result = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_LID_FLIP_ROG);
      |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                     ASUS_WMI_DEVID_LID_FLIP
make[1]: *** [scripts/Makefile.build:249: /var/lib/dkms/asus-wmi/1.0/build/asus-wmi.o] Error 1
make: *** [Makefile:1852: /var/lib/dkms/asus-wmi/1.0/build] Error 2
make: Leaving directory '/usr/src/linux-headers-6.0.12-76060006-generic'
PTFOPlayer commented 1 year ago

@ajnavarro did you add it to dkms?

PTFOPlayer commented 1 year ago

I am trying to create an installer for this module to avoid events such as when something does not work for someone, it would also facilitate reinstallation if necessary, so if my PR is accepted, everything will work correctly after reinstallation, but without guarantee

PTFOPlayer commented 1 year ago

And did you remove it from dkms before reinstalling?

ajnavarro commented 1 year ago

Hi @PTFOPlayer , Thanks for your help.

Yes, I removed it first to try to reinstall it. These are all the steps I did:

~ ➜  sudo dkms remove -m asus-wmi -v 1.0 --all
Deleting module asus-wmi-1.0 completely from the DKMS tree.
~ ➜  sudo rm -r /usr/src/asus-wmi-1.0
~ ➜  sudo mkdir /usr/src/asus-wmi-1.0
~ ➜  cd /usr/src/asus-wmi-1.0
/usr/src/asus-wmi-1.0🔒 ➜  sudo wget 'https://github.com/Plippo/asus-wmi-screenpad/archive/master.zip'
--2023-01-24 10:15:37--  https://github.com/Plippo/asus-wmi-screenpad/archive/master.zip
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/Plippo/asus-wmi-screenpad/zip/refs/heads/master [following]
--2023-01-24 10:15:37--  https://codeload.github.com/Plippo/asus-wmi-screenpad/zip/refs/heads/master
Resolving codeload.github.com (codeload.github.com)... 140.82.121.9
Connecting to codeload.github.com (codeload.github.com)|140.82.121.9|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/zip]
Saving to: ‘master.zip’

master.zip                                          [ <=>                                                                                                   ]  36,92K  --.-KB/s    in 0,1s    

2023-01-24 10:15:38 (373 KB/s) - ‘master.zip’ saved [37807]

/usr/src/asus-wmi-1.0🔒 ➜  sudo unzip master.zip
Archive:  master.zip
0a6fa492c2ddb121c186fc353d04093d02c46f6e
   creating: asus-wmi-screenpad-master/
  inflating: asus-wmi-screenpad-master/LICENSE  
  inflating: asus-wmi-screenpad-master/Makefile  
  inflating: asus-wmi-screenpad-master/README.md  
  inflating: asus-wmi-screenpad-master/asus-nb-wmi.c  
  inflating: asus-wmi-screenpad-master/asus-wmi.c  
  inflating: asus-wmi-screenpad-master/asus-wmi.h  
  inflating: asus-wmi-screenpad-master/dkms.conf  
   creating: asus-wmi-screenpad-master/inc/
  inflating: asus-wmi-screenpad-master/inc/asus-wmi.h  
  inflating: asus-wmi-screenpad-master/patch  
  inflating: asus-wmi-screenpad-master/patch5.8  
  inflating: asus-wmi-screenpad-master/patch6.0  
  inflating: asus-wmi-screenpad-master/prepare-for-current-kernel.sh  
/usr/src/asus-wmi-1.0🔒 ➜  sudo mv asus-wmi-screenpad-master/* .
/usr/src/asus-wmi-1.0🔒 via C v11.3.0-gcc ➜  sudo rmdir asus-wmi-screenpad-master
/usr/src/asus-wmi-1.0🔒 via C v11.3.0-gcc ➜  sudo rm master.zip
/usr/src/asus-wmi-1.0🔒 via C v11.3.0-gcc ➜  sudo sh prepare-for-current-kernel.sh
Using: patch6.0
--2023-01-24 10:15:59--  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/platform/x86/asus-wmi.c?h=linux-6.0.y
Resolving git.kernel.org (git.kernel.org)... 145.40.68.75, 2604:1380:4601:e00::1
Connecting to git.kernel.org (git.kernel.org)|145.40.68.75|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 100794 (98K) [text/plain]
Saving to: ‘asus-wmi.c’

asus-wmi.c                                      100%[======================================================================================================>]  98,43K   638KB/s    in 0,2s    

2023-01-24 10:15:59 (638 KB/s) - ‘asus-wmi.c’ saved [100794/100794]

--2023-01-24 10:15:59--  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/platform/x86/asus-wmi.h?h=linux-6.0.y
Resolving git.kernel.org (git.kernel.org)... 145.40.68.75, 2604:1380:4601:e00::1
Connecting to git.kernel.org (git.kernel.org)|145.40.68.75|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2366 (2,3K) [text/plain]
Saving to: ‘asus-wmi.h’

asus-wmi.h                                      100%[======================================================================================================>]   2,31K  --.-KB/s    in 0s      

2023-01-24 10:16:00 (1,16 GB/s) - ‘asus-wmi.h’ saved [2366/2366]

--2023-01-24 10:16:00--  https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/plain/drivers/platform/x86/asus-nb-wmi.c?h=linux-6.0.y
Resolving git.kernel.org (git.kernel.org)... 145.40.68.75, 2604:1380:4601:e00::1
Connecting to git.kernel.org (git.kernel.org)|145.40.68.75|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 17530 (17K) [text/plain]
Saving to: ‘asus-nb-wmi.c’

asus-nb-wmi.c                                   100%[======================================================================================================>]  17,12K  --.-KB/s    in 0,05s   

2023-01-24 10:16:00 (331 KB/s) - ‘asus-nb-wmi.c’ saved [17530/17530]

patching file asus-nb-wmi.c
Hunk #1 succeeded at 556 (offset 11 lines).
Hunk #2 succeeded at 566 (offset 11 lines).
Hunk #3 succeeded at 580 (offset 11 lines).
patching file asus-wmi.c
Hunk #2 succeeded at 210 (offset 1 line).
Hunk #3 succeeded at 1075 (offset 32 lines).
Hunk #4 succeeded at 1151 (offset 32 lines).
Hunk #5 succeeded at 1236 (offset 32 lines).
/usr/src/asus-wmi-1.0🔒 via C v11.3.0-gcc ➜  sudo dkms add -m asus-wmi -v 1.0
Creating symlink /var/lib/dkms/asus-wmi/1.0/source -> /usr/src/asus-wmi-1.0
/usr/src/asus-wmi-1.0🔒 via C v11.3.0-gcc ➜  sudo dkms build -m asus-wmi -v 1.0

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=6.0.12-76060006-generic -C /lib/modules/6.0.12-76060006-generic/build M=/var/lib/dkms/asus-wmi/1.0/build...(bad exit status: 2)
ERROR (dkms apport): binary package for asus-wmi: 1.0 not found
Error! Bad return status for module build on kernel: 6.0.12-76060006-generic (x86_64)
Consult /var/lib/dkms/asus-wmi/1.0/build/make.log for more information.
/usr/src/asus-wmi-1.0🔒 via C v11.3.0-gcc ✗ 
PTFOPlayer commented 1 year ago

Check if you have linux headers installed

ajnavarro commented 1 year ago
~ took 2s ➜  sudo apt install linux-headers-6.0.12-76060006
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
linux-headers-6.0.12-76060006 is already the newest version (6.0.12-76060006.202212290932~1673966427~22.04~e15d5b5).
0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.

~ ➜  sudo apt install linux-headers-6.0.12-76060006-generic 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
linux-headers-6.0.12-76060006-generic is already the newest version (6.0.12-76060006.202212290932~1673966427~22.04~e15d5b5).
0 upgraded, 0 newly installed, 0 to remove and 23 not upgraded.
PTFOPlayer commented 1 year ago

at this point i don't know what i can suggest more maybe try upgrading all packages and again reinstalling, but i don't know if it will help

omnilevo commented 1 year ago

Having the same issue as ajnavarro after upgrading to same kernel.

maxthedon commented 10 months ago

I had the same error with kernel 5.15.0-91-generic in Kubuntu 22.04. Build failed saying the same 'ASUS_WMI_DEVID_LID_FLIP_ROG’ undeclared. But in my case, second screen brightness control was not working. I read the code and it looked like it is related to tablet mode of some sort, and i don't need it. So after running prepare-for-current-kernel.sh , I edited the "/usr/src/asus-wmi-1.0/asus-wmi.c" file, to comment out the switch statement that was causing the error. Then the build succeeded and everything is working fine. Temporary fix.

It was line 419 to 432 in my case :

FROM:

switch (asus->driver->quirks->tablet_switch_mode) { case asus_wmi_no_tablet_switch: break; case asus_wmi_kbd_dock_devid: asus->tablet_switch_inverted = true; asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_KBD_DOCK, NOTIFY_KBD_DOCK_CHANGE); break; case asus_wmi_lid_flip_devid: asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP, NOTIFY_LID_FLIP); break; case asus_wmi_lid_flip_rog_devid: asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP_ROG, NOTIFY_LID_FLIP_ROG); break; }

TO:

/*switch (asus->driver->quirks->tablet_switch_mode) { case asus_wmi_no_tablet_switch: break; case asus_wmi_kbd_dock_devid: asus->tablet_switch_inverted = true; asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_KBD_DOCK, NOTIFY_KBD_DOCK_CHANGE); break; case asus_wmi_lid_flip_devid: asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP, NOTIFY_LID_FLIP); break; case asus_wmi_lid_flip_rog_devid: asus_wmi_tablet_sw_init(asus, ASUS_WMI_DEVID_LID_FLIP_ROG, NOTIFY_LID_FLIP_ROG); break; }*/