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

Automatic update script, and 6.12 fixes #184

Merged
merged 14 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ If this worked or didn't work for you, kindly make a new issue, and attach the f
- [x] GUI(wxPython with tray icon): ([x211321](https://github.com/x211321/RGB-Config-Acer-gkbbl-0))
- [x] GUI(PyQt): ([0xb4dc0d3x](https://github.com/0xb4dc0d3x/Acer-RGB-Keyboard-Linux-Module-GUI))
- [x] CLI(Bash): ([Zeaksblog/acer-rgb-menu](https://github.com/Zeaksblog/acer-rgb-menu))
- [ ] Add DKMS or an Event to recompile module after kernel upgrades #113
- [x] Add DKMS or an Event to recompile module after kernel upgrades #113
- [ ] Custom Fans speed
- [ ] Implement RGB Dynamic effects (per key RGB)
- [ ] Implement RGB Static coloring (per key RGB)
Expand Down
10 changes: 8 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,16 @@ fi
rm /dev/acer-gkbbl-0 /dev/acer-gkbbl-static-0 -f

# compile the kernel module
make

if [ "$(cat /proc/version | grep clang)" != "" ]; then
#For kernels compiled with clang
make CC=clang LD=ld.lld
else
#For normal kernels
make
fi
# remove previous acer_wmi module
rmmod acer_wmi
rmmod facer

# install required modules
modprobe wmi
Expand Down
28 changes: 27 additions & 1 deletion install_service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,39 @@ Restart=no
RemainAfterExit=yes
User=root
WorkingDirectory=$target_dir
ExecStart=/bin/bash ./install.sh
ExecStart=/bin/bash $target_dir/service.sh

[Install]
WantedBy=multi-user.target
EOF
chown -R root:root $target_dir

KERNELVERSION=$(uname -r)

cat << EOF > service.sh
KERNELVERSION="$KERNELVERSION"
cd $target_dir

rm /dev/acer-gkbbl-0 /dev/acer-gkbbl-static-0 -f

if [ "\$(uname -r)" != "\$KERNELVERSION" ]; then
make clean
source install.sh
sed -i "s/^KERNELVERSION.*/KERNELVERSION=\"\$(uname -r)\"/" service.sh
else
rmmod acer_wmi
rmmod facer
modprobe wmi
modprobe sparse-keymap
modprobe video
insmod src/facer.ko
fi
EOF

#locking down service file for security
chown -R root:root $target_dir
chmod 744 $target_dir/service.sh

systemctl daemon-reload
systemctl start $service
systemctl enable $service
Expand Down
17 changes: 17 additions & 0 deletions service.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
KERNELVERSION="6.11.3-arch1-1"
cd /opt/turbo-fan

rm /dev/acer-gkbbl-0 /dev/acer-gkbbl-static-0 -f

if [ "$(uname -r)" != "$KERNELVERSION" ]; then
make clean
source install.sh
sed -i "s/^KERNELVERSION.*/KERNELVERSION=\"$(uname -r)\"/" service.sh
else
rmmod acer_wmi
rmmod facer
modprobe wmi
modprobe sparse-keymap
modprobe video
insmod src/facer.ko
fi
16 changes: 1 addition & 15 deletions src/facer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2953,39 +2953,25 @@ static void acer_rfkill_exit(void)
}
}

static void acer_wmi_notify(u32 value, void *context)
static void acer_wmi_notify(union acpi_object *obj, void *context)
{
struct acpi_buffer response = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj;
struct event_return_value return_value;
acpi_status status;
u16 device_state;
const struct key_entry *key;
u32 scancode;

status = wmi_get_event_data(value, &response);
if (status != AE_OK) {
pr_warn("bad event status 0x%x\n", status);
return;
}

obj = (union acpi_object *)response.pointer;

if (!obj)
return;
if (obj->type != ACPI_TYPE_BUFFER) {
pr_warn("Unknown response received %d\n", obj->type);
kfree(obj);
return;
}
if (obj->buffer.length != 8) {
pr_warn("Unknown buffer length %d\n", obj->buffer.length);
kfree(obj);
return;
}

return_value = *((struct event_return_value *)obj->buffer.pointer);
kfree(obj);

switch (return_value.function) {
case WMID_HOTKEY_EVENT:
Expand Down