acer-predator-turbo-and-rgb-keyboard-linux-module icon indicating copy to clipboard operation
acer-predator-turbo-and-rgb-keyboard-linux-module copied to clipboard

Acer Nitro AN515-57 Not working.

Open Aeres-u99 opened this issue 2 years ago • 20 comments

>>> file /sys/bus/wmi/devices/7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56/                                                             /sys/bus/wmi/devices/7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56/: directory


>>>> sudo dmidecode | grep "Product Name" -B 2 -A 4                                                                
System Information
	Manufacturer: Acer
	Product Name: Nitro AN515-57
	Version: V1.05
	Serial Number: NHQD9SI00113018B3A3400
	UUID: 52d78e4a-a6ee-eb11-80e1-088fc30da84e
	Wake-up Type: Power Switch
--
Base Board Information
	Manufacturer: TGL
	Product Name: Scala_TLS
	Version: V1.05
	Serial Number: NBQCE11003130B0E313400
	Asset Tag: Type2 - Board Asset Tag
	Features:

DSDT: dsdt.aml.tar.gz

  • [x] file /sys/bus/wmi/devices/7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56/
  • [x] /dev/acer-gkbbl-0 and /dev/acer-gkbbl-static-0 exists

Installation occurs fine but none of it works. I am guessing that AN515-55 should be very much similar to AN515-57 but I can be wrong, and also I noticed nothing weird in dmesg output.

Installation Log:

sudo ./install.sh                                                                                                           ─╯
make -C /lib/modules/5.14.11-arch1-1/build M=/home/akuma/NewSoftwares/acer-helios-300-rgb-keyboard-linux-module modules
make[1]: Entering directory '/usr/lib/modules/5.14.11-arch1-1/build'
make[1]: Leaving directory '/usr/lib/modules/5.14.11-arch1-1/build'
[ 1123.862500] RIP: 0033:0x7f452d6f918d
[ 1123.862506] Code: b4 0c 00 0f 05 eb a9 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d b3 6c 0c 00 f7 d8 64 89 01 48
[ 1123.862510] RSP: 002b:00007ffcece11df8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[ 1123.862517] RAX: ffffffffffffffda RBX: 000055fd22b1f7c0 RCX: 00007f452d6f918d
[ 1123.862520] RDX: 0000000000000000 RSI: 000055fd2268a270 RDI: 0000000000000003
[ 1123.862522] RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f452d7c4380
[ 1123.862525] R10: 0000000000000003 R11: 0000000000000246 R12: 000055fd2268a270
[ 1123.862528] R13: 0000000000000000 R14: 000055fd22b1f760 R15: 0000000000000000
[ 1123.862534] kobject_add_internal failed for acer-gkbbl with -EEXIST, don't try to register things with the same name in the same directory.
[ 1123.872408] input: Acer WMI hotkeys as /devices/virtual/input/input38
[*] Done

Let me know if any other debugging data is required, really glad that this exists and would also like to know how to proceed with debugging and adding support for this one, if possible.

Aeres-u99 avatar Oct 13 '21 13:10 Aeres-u99

If your keyboard support dynamic coloring mode and is a 4-zone RGB keyboard, please try older version of the repo. I think the error is caused by this commit: https://github.com/JafarAkhondali/acer-predator-turbo-and-rgb-keyboard-linux-module/commit/30804d316fbe416961fb61157f7462423e027f0d

Try using older commit. I haven't yet had time to fix this error. For me, it happens only If I re-install the repo, and works fine on first installation.

I would be nice if you could find the problem here.

The thing is I've added two char devices in /dev/. One works for dynamic effects, and the other one works for static coloring effects.

This error first appeared after adding the second char device. Perhaps I missed something here

I usually need to reboot if I try to reinstall the tool

JafarAkhondali avatar Oct 13 '21 14:10 JafarAkhondali

Aha! I see, will test it out in sometime and let you know. Thanks a lot for the quick reply

Aeres-u99 avatar Oct 13 '21 14:10 Aeres-u99

Well I tried

git checkout 09e0657af5ffc1ba8eedfb9c4e94f8b48cf27321
git fetch 
sudo ./install.sh

After that I tried to use sudo python3 face_rgb script but no luck, I tried rebooting and then checking as well but still no luck. I can confirm that my machine is very identical to AN515-55 and keyboard has 4 zone Lights as well. Any idea on how I can debug this more? or some blog/links that I should refer to.

Regarding the second character device, I will have to see how the communication happens and the style as well (is it block communication or streaming communication?) I have legit no clue about it, but I can certainly acquire some info on that.

Aeres-u99 avatar Oct 13 '21 14:10 Aeres-u99

I have no idea why this doesn't work for you. Tbh, I never thought it would work for Nitro series.

So here is how it works:

this function creates the char block https://github.com/JafarAkhondali/acer-predator-turbo-and-rgb-keyboard-linux-module/blob/c0f99438d7f684d12b03ff811705ca80f7ecf51a/src/facer.c#L1960

and this line https://github.com/JafarAkhondali/acer-predator-turbo-and-rgb-keyboard-linux-module/blob/c0f99438d7f684d12b03ff811705ca80f7ecf51a/src/facer.c#L1937 copies data from char device and sends it to a WMI method.

if WMI method ID differs for you, you have to find it yourself by de-compiling PredatorSense app ( I think it's NitroSense for your series) and check the WMI methods using WMIExplorer software in Windows.

This has been same for many series according to the user reports (Triton, Predator and Nitro). I'm sure you can find the problem if you put enough time. It would be nice if you could find the bug & help fixing it

JafarAkhondali avatar Oct 14 '21 12:10 JafarAkhondali

Cool, Please keep the issue open. I will mostly tag you in case I need any help. For the exploration I will have to install windows right?

Aeres-u99 avatar Oct 14 '21 18:10 Aeres-u99

Yes, you'll need Windows. Virtualbox didn't show required WMI methods.

image

JafarAkhondali avatar Oct 14 '21 21:10 JafarAkhondali

I see, well I am preparing a windows USB so hopefully that should allow me to delve deep into this. I will update once I have any progress on this. Thanks once again for the guidance

Aeres-u99 avatar Oct 14 '21 21:10 Aeres-u99

Okay, SO I noticed this weird thing

[akuma@TsuyoiKaida acer-predator-turbo-and-rgb-keyboard-linux-module]$ sudo ./install.sh 
make -C /lib/modules/5.14.12-arch1-1/build M=/home/akuma/NewSoftwares/acer-predator-turbo-and-rgb-keyboard-linux-module modules
make[1]: Entering directory '/usr/lib/modules/5.14.12-arch1-1/build'
make[1]: Leaving directory '/usr/lib/modules/5.14.12-arch1-1/build'
rmmod: ERROR: Module acer_wmi is not currently loaded
insmod: ERROR: could not insert module src/facer.ko: Invalid module format
[ 3777.425511] audit: type=1104 audit(1634565799.950:173): pid=11765 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.335652] audit: type=1101 audit(1634565811.860:174): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.336690] audit: type=1110 audit(1634565811.860:175): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.341006] audit: type=1105 audit(1634565811.863:176): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.380879] audit: type=1106 audit(1634565811.903:177): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.380888] audit: type=1104 audit(1634565811.903:178): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3825.696057] audit: type=1101 audit(1634565848.220:179): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3825.697173] audit: type=1110 audit(1634565848.220:180): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3825.700633] audit: type=1105 audit(1634565848.223:181): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3826.718279] facer: version magic '5.14.11-arch1-1 SMP preempt mod_unload ' should be '5.14.12-arch1-1 SMP preempt mod_unload '
[*] Done
[akuma@TsuyoiKaida acer-predator-turbo-and-rgb-keyboard-linux-module]$ sudo ./refresh.sh 
rmmod: ERROR: Module facer is not currently loaded
make -C /lib/modules/5.14.12-arch1-1/build M=/home/akuma/NewSoftwares/acer-predator-turbo-and-rgb-keyboard-linux-module modules
make[1]: Entering directory '/usr/lib/modules/5.14.12-arch1-1/build'
make[1]: Leaving directory '/usr/lib/modules/5.14.12-arch1-1/build'
insmod: ERROR: could not insert module src/facer.ko: Invalid module format
[ 1990.356345] audit: type=1106 audit(1634564012.874:160): pid=8879 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 1990.356423] audit: type=1104 audit(1634564012.874:161): pid=8879 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3669.859090] audit: type=1100 audit(1634565692.383:162): pid=11497 uid=1000 auid=1000 ses=2 msg='op=PAM:authentication grantors=pam_faillock,pam_permit,pam_faillock acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
[ 3669.860609] audit: type=1101 audit(1634565692.383:163): pid=11497 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
[ 3669.861236] audit: type=1110 audit(1634565692.383:164): pid=11497 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
[ 3669.863741] audit: type=1105 audit(1634565692.386:165): pid=11497 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
[ 3673.751103] audit: type=1106 audit(1634565696.273:166): pid=11497 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
[ 3673.751224] audit: type=1104 audit(1634565696.273:167): pid=11497 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/0 res=success'
[ 3776.363028] audit: type=1100 audit(1634565798.886:168): pid=11765 uid=1000 auid=1000 ses=2 msg='op=PAM:authentication grantors=pam_faillock,pam_permit,pam_faillock acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3776.364832] audit: type=1101 audit(1634565798.890:169): pid=11765 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3776.365912] audit: type=1110 audit(1634565798.890:170): pid=11765 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3776.369247] audit: type=1105 audit(1634565798.893:171): pid=11765 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3777.415847] facer: version magic '5.14.11-arch1-1 SMP preempt mod_unload ' should be '5.14.12-arch1-1 SMP preempt mod_unload '
[ 3777.425466] audit: type=1106 audit(1634565799.950:172): pid=11765 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3777.425511] audit: type=1104 audit(1634565799.950:173): pid=11765 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.335652] audit: type=1101 audit(1634565811.860:174): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.336690] audit: type=1110 audit(1634565811.860:175): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.341006] audit: type=1105 audit(1634565811.863:176): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.380879] audit: type=1106 audit(1634565811.903:177): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3789.380888] audit: type=1104 audit(1634565811.903:178): pid=12099 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3825.696057] audit: type=1101 audit(1634565848.220:179): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3825.697173] audit: type=1110 audit(1634565848.220:180): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3825.700633] audit: type=1105 audit(1634565848.223:181): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3826.718279] facer: version magic '5.14.11-arch1-1 SMP preempt mod_unload ' should be '5.14.12-arch1-1 SMP preempt mod_unload '
[ 3826.726582] audit: type=1106 audit(1634565849.250:182): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3826.726594] audit: type=1104 audit(1634565849.250:183): pid=12131 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3830.550644] audit: type=1101 audit(1634565853.073:184): pid=12466 uid=1000 auid=1000 ses=2 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="akuma" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3830.551525] audit: type=1110 audit(1634565853.076:185): pid=12466 uid=1000 auid=1000 ses=2 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3830.555145] audit: type=1105 audit(1634565853.080:186): pid=12466 uid=1000 auid=1000 ses=2 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/2 res=success'
[ 3831.613194] facer: version magic '5.14.11-arch1-1 SMP preempt mod_unload ' should be '5.14.12-arch1-1 SMP preempt mod_unload '
[akuma@TsuyoiKaida acer-predator-turbo-and-rgb-keyboard-linux-module]$ 

Its weird that refresh is unable to find the module. What if I do have the proper uuid but its not working because there is something wrong with installation? is there some sure way to verify if the module is properly loaded or not?

Sadly I donot have windows installed on this machine, and its such a core to have it installed too I tried from windows PE and the keyboard started blinking in green, weirdly. Perhaps it might work, I will perform the export as well today.

Aeres-u99 avatar Oct 18 '21 14:10 Aeres-u99

Try installing this repo in Ubuntu live from a flash usb. The error is clearly "facer: version magic '5.14.11-arch1-1 SMP preempt mod_unload ' should be '5.14.12-arch1-1 SMP preempt mod_unload '" Yet I'm not sure how to fix it

JafarAkhondali avatar Oct 18 '21 14:10 JafarAkhondali

I fixed it, it seemed to be something wrong with the checkout I had used. I am running out of ideas here tbh, since I cannot install windows on my machine and inside vm Nitrosense refuses to work even though I change the BIOS names and versions, I am not sure why its not working when it should be working like a charm. AN515-55 and AN515-57 are very similar model (the only changes happen in hardware, i5 / i7)

Aeres-u99 avatar Oct 20 '21 08:10 Aeres-u99

if you fixed it can you send me the final file as i am not a techie and cant understand whats going on

Rishav8989 avatar May 12 '22 01:05 Rishav8989

@Rishav8989 Not really, since I have linux already installed I couldn't really do anything. Do you have windows installed atm? or have you moved to linux as well?

Aeres-u99 avatar May 12 '22 02:05 Aeres-u99

i use both frequently it works fine on windows but it stuck to that red light

Rishav8989 avatar May 12 '22 02:05 Rishav8989

Perfect @Rishav8989 I feel you might be able to assist me and @JafarAkhondali by providing us the data we need, basically you need to install a program and give us the code. I can create the pr for this. Do you happen to have telegram?

Aeres-u99 avatar May 12 '22 02:05 Aeres-u99

yes search Rishav sengar

Rishav8989 avatar May 12 '22 02:05 Rishav8989

umm, couldn't find you. Can you drop a hi to @keitachikawa ?

Aeres-u99 avatar May 12 '22 03:05 Aeres-u99

@Aeres-u99 Search me: @ deallocate

JafarAkhondali avatar May 12 '22 20:05 JafarAkhondali

Hey, have dropped you a message as well. @JafarAkhondali

Aeres-u99 avatar May 13 '22 02:05 Aeres-u99

Have anyone tried out WMI Explorer and checking against NitroSense on the AN515-57 yet?

madsl avatar Sep 15 '22 13:09 madsl

Well, yes. I tried and successfully failed at doing it. This will need a little bit more efforts and I have been occupied since last 2 months. Will try to check this weekend and update

Aeres-u99 avatar Sep 15 '22 13:09 Aeres-u99

Well, yes. I tried and successfully failed at doing it. This will need a little bit more efforts and I have been occupied since last 2 months. Will try to check this weekend and update

i have a suggestion, "what if you get nitrosense well installed on windows first... then copy it into a disk then install that copied file into your linux system using wine?"

If it works, please let me know...

i haven't tried anything yet i am not using Linux because i am still learning and gathering info about it because i can't take any risk right now with my machine...

ghost avatar Sep 22 '22 06:09 ghost

Did anyone fixed this? plz help me... I cann't use on my Acer Nitro 5 AN515-57

n0xgg04 avatar Sep 30 '22 18:09 n0xgg04

Hi all, I've just got a Acer Nitro 5 AN515-57, working in dual boot (Ubunutu 22.04 and Windows). I too have the

>>> file /sys/bus/wmi/devices/7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56/  
/sys/bus/wmi/devices/7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56/: directory

And the install of this tool works fine (After disabling secure boot), but no lights change when I run e.g. ./facer_rgb.py -m 1 -s 4 -b 100 -cR 255 -cG 0 -cB 255. It's definitely a 4 zone keyboard and I can change the zones in WIndows using the NitroSense app. The zone colors can persist if I reboot into Linux, which is in interesting.

I'm not sure from the above where everyone is up to with this, but I could try and figure out some WMI things from Windows to help, if I get some guidance on what I'm looking for and where. I'm not that familiar with windows, but I have installed WMIExplorer. I could see the method names, but couldn't see any numeric ids or addresses from that interface.

I guess those are in the NitroSense app, which needs decompiling? EDIT: I plan to read through this which looks relevant: https://wiki.ubuntu.com/Kernel/Reference/WMI

hornc avatar Oct 05 '22 23:10 hornc

UPDATE: So it seems to work now on my AN515-57.. without any code changes. I read through some the other issues and saw reports that sometimes some functions worked, and went to do some testing, after a single simple command ./facer_rgb.py -b40 , everything worked in a way that it didn't on my first attempt where I copy pasted some of the full facer_rgb.py examples from README.md.

Here's what I did to get ./facer_rgb.py working. Probably not all necessary, but this is the state + steps in case it is hard to reproduce:

  • On a previous session (previous day) I had used NitroSense to set the kb zones to a static colour pattern Current session:
  • Booted into Windows (from GRUB menu), used Windows without explicitly running NitroSense or changing kb
  • Rebooted into Ubuntu
  • Ran the ./install.sh script as root for one time install (the second time I've run it on this machine) - no errors
  • Checked dmesg
  • Tried a simple ./facer_rgb.py -b40 -- this sent the keyboard into a rainbow cycle
  • after that, all the other examples appeared to work. The first time I tried, they didn't...

I don't know what they key part of this was, the simple brightness change command first ./facer_rgb.py -b40 , or something to do with using NitroSense in WIndows first; the "reset the registers" of https://github.com/JafarAkhondali/acer-predator-turbo-and-rgb-keyboard-linux-module/issues/65#issuecomment-1249299362 🤷🏽

hornc avatar Oct 07 '22 08:10 hornc

@hornc When me and jafar, we were working on this together in a group, I was able to find out that some of the registers donot change in values. Currently I donot have those in my current linux partition, but you can take a look at this sample code to get an idea.

from pathlib import Path

payload_SIZE = 16
CHARACTER_DEVICE = "/dev/acer-gkbbl-0"

payload_SIZE_STATIC_MODE = 4
CHARACTER_DEVICE_STATIC = "/dev/acer-gkbbl-static-0"

CONFIG_DIRECTORY = str(Path.home()) + "/.config/predator/saved profiles"
path = Path(CONFIG_DIRECTORY)
path.mkdir(parents=True, exist_ok=True)
payload = [0]*16
payload[0] = 0x2
payload[1] = 0x6
payload[2] = 0x64
payload[3] = 0xFF
payload[4] = 0x1
payload[5] = 0x0F
payload[6] = 0xFF
payload[7] = 0xFF


with open(CHARACTER_DEVICE, 'wb') as cd:
        print(f"Writing Payload: {payload}")
        cd.write(bytes(payload))

I was using these to manually change the registers values as I had checked in wmi explorer. Lately the work has been keeping me occupied, giving little to no time to look into it. If you can, try to see all the registers from WMI explorer and see how they are getting modified. I had also noticed that the those registers which correspond to colors are not getting modified, which seems very abrupt. Their is definitely a need to probe into the code more, which I shall as soon as possible. Also, -b40 is only for the brightness change, which by default works with fn+f9-fn+10 as well, and it gave you random cycle probably because last time you had booted into windows you had configured those values. I am guessing there is a specific register that nitrosense is modifying before changing anything that facilitates the entire thing

Aeres-u99 avatar Oct 07 '22 08:10 Aeres-u99

Thanks for the response and the code example @Aeres-u99 . I have confirmed booting straight into Linux doesn't let me change colours from red, or set any other modes other than static, but I can change the brightness using ./facer_rgb.py -b40 . It must have been something from the Windows boot that enabled the other modes, as you suggest. I'll see what I can dig up from the Windows side in terms of registers. It looks like this will work eventually, once we find the correct init register.

hornc avatar Oct 11 '22 05:10 hornc

Exactly, I presume that there is another register that is being and windows is setting up some of them to some default value, without which it might not work.

It could also be that the character device that we are using is not properly sending the values, but that should have given us an errorneous output instead of no outputs

Aeres-u99 avatar Oct 11 '22 06:10 Aeres-u99

From WMI Explorer:

[WMI, dynamic: ToInstance, provider("WmiProv"), Locale("MS\\0x409"), Description("Class used to Gaming Function, Version 2.81"), guid("{7A4DDFE7-5B5D-40B4-8595-4408E0CC7F56}")]
class AcerGamingFunction
{
	[key, read] string InstanceName;
	[read] boolean Active;
	[WmiMethodId(1), Implemented, read, write, Description("Set Acer Gaming Profile Configuration.")] void SetGamingProfile([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(2), Implemented, read, write, Description("Set Acer Gaming LED Behavior.")] void SetGamingLED([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(3), Implemented, read, write, Description("Get Acer Gaming Profile Configuration.")] void GetGamingProfile([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(4), Implemented, read, write, Description("Get Acer Gaming LED Behavior.")] void GetGamingLED([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(5), Implemented, read, write, Description("Get Acer Gaming System Information.")] void GetGamingSysInfo([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(6), Implemented, read, write, Description("Set Acer Gaming RGB Keyboard Setting.")] void SetGamingRgbKb([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(7), Implemented, read, write, Description("Get Acer Gaming RGB Keyboard Setting.")] void GetGamingRgbKb([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(8), Implemented, read, write, Description("Set Acer Gaming Profile Setting.")] void SetGamingProfileSetting([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(9), Implemented, read, write, Description("Get Acer Gaming Profile Setting.")] void GetGamingProfileSetting([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(10), Implemented, read, write, Description("Set Acer Gaming LED Group Behavior.")] void SetGamingLEDBehavior([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(11), Implemented, read, write, Description("Get Acer Gaming LED Group Behavior.")] void GetGamingLEDBehavior([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(12), Implemented, read, write, Description("Set Acer Gaming LED Group Color.")] void SetGamingLEDColor([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(13), Implemented, read, write, Description("Get Acer Gaming LED Group Color.")] void GetGamingLEDColor([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(14), Implemented, read, write, Description("Set Acer Gaming Fan Group Behavior.")] void SetGamingFanBehavior([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(15), Implemented, read, write, Description("Get Acer Gaming Fan Group Behavior.")] void GetGamingFanBehavior([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(16), Implemented, read, write, Description("Set Acer Gaming Fan Group Speed.")] void SetGamingFanSpeed([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(17), Implemented, read, write, Description("Get Acer Gaming Fan Group Speed.")] void GetGamingFanSpeed([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(18), Implemented, read, write, Description("Set Acer Gaming Fan Table.")] void SetGamingFanTable([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(19), Implemented, read, write, Description("Get Acer Gaming Fan Table.")] void GetGamingFanTable([out] uint64 gmOutput);
	[WmiMethodId(20), Implemented, read, write, Description("Set Acer Gaming Keyboard Backlight Behavior.")] void SetGamingKBBacklight([in, MAX(16)] uint8 gmInput[], [out] uint32 gmOutput);
	[WmiMethodId(21), Implemented, read, write, Description("Get Acer Gaming Keyboard Backlight Behavior.")] void GetGamingKBBacklight([out] uint8 gmReturn, [out, MAX(15)] uint8 gmOutput[]);
	[WmiMethodId(22), Implemented, read, write, Description("Set Acer Gaming Miscellaneous Setting.")] void SetGamingMiscSetting([in] uint64 gmInput, [out] uint32 gmOutput);
	[WmiMethodId(23), Implemented, read, write, Description("Get Acer Gaming Miscellaneous Setting.")] void GetGamingMiscSetting([in] uint32 gmInput, [out] uint64 gmOutput);
	[WmiMethodId(24), Implemented, read, write, Description("Set CPU Overclocking Profile.")] void SetCPUOverclockingProfile([in] uint8 OCProfile, [in, MAX(512)] uint8 OCStructure[], [out] uint8 ReturnCode, [out, MAX(3)] uint8 Reserved[]);
	[WmiMethodId(25), Implemented, read, write, Description("Get CPU Overclocking Profile.")] void GetCPUOverclockingProfile([in, MAX(4)] uint8 Reserved[], [out] uint8 ReturnCode, [out] uint8 ReturnOCProfile, [out, MAX(512)] uint8 OCStructure[]);
};

I am looking at NitroSense.exe in dotPeek, although I'm still not certain where I should be looking. I'm trying to test whether it is some use of WMISetGamingLEDBehavior that is required.

  int result = (int) WMIFunction.WMISetGamingLEDBehavior((ulong) (8L | (this.Zone_Status[0] ? 1099511627776L : 0L) | (this.Zone_Status[1] ? 2199023255552L : 0L) | (this.Zone_Status[2] ? 4398046511104L : 0L) | (this.Zone_Status[3] ? 8796093022208L : 0L))).GetAwaiter().GetResult();

EDIT I'm now thinking the 'GamingLED' is the turbo button (with LED) on Predator laptops -- I don't see a Turbo button on the Nitro.

EDIT After more messing about, I'm becoming convinced there isn't anything I can do with the Python code and the character device directly. Something needs to be sent from within the C code to init the keyboard device.

On Windows startup, keyboard LEDs are solid red until login screen (which is what I get from booting into Linux), then it switches to a saved profile.

Checking task manager after logging in, NitroSense is not running, but PSSvc (Predator service), PSAgent, and PSAdminAgent are all running. They have the same 'N' icon as NitroSense.

hornc avatar Oct 28 '22 05:10 hornc