GithubHelp home page GithubHelp logo

acpi_ec's Introduction

acpi_ec

acpi_ec is a simple kernel module which takes most of its code from ec_sys.c and provides a simple interface between the ACPI embedded controller and the userspace. Its main intent is to be used with NoteBook Fan Control but you can of course install it for another purpose. You can access to the EC simply by read/write to /dev/ec.

It comes with a DKMS config to automatically rebuild it with signing support and an install script which can be easily modified for another module. The script can generate new keys and enroll them for Secure Boot.

Installation

Debian

You can find .deb in the releases.

Other distributions

You should ensure that you have dkms and mokutil installed on your computer (mokutil is generally included if you have a distro which supports Secure Boot). You also need to install the kernel sources (linux-headers on Debian/Ubuntu or kernel-devel on RPM distros).

Debian

sudo apt install dkms build-essential linux-headers-$(uname -r)

Fedora

sudo dnf install kernel-devel dkms make

Then just launch:

sudo ./install.sh

Removing

If you want to finally remove the module:

sudo ./uninstall.sh

acpi_ec's People

Contributors

saidsay-so avatar dr4iv3rnope avatar gkaf89 avatar

Stargazers

Alex John avatar Tea avatar Marc Amorós avatar Ivon Huang avatar Francisco Oliveira avatar Laércio Gonçalves  avatar Daniel Schaefer avatar Snowy avatar  avatar Diego Gomes avatar Thomas van Gemert avatar  avatar Aakash avatar  avatar Pavel Dobiáš avatar 刘皓 avatar Kasefuchs avatar Tom Lavenziano avatar Bartek Wreczycki avatar Alphara avatar Filipe avatar Jakob Gürtler avatar Psy_0p avatar Frederick James Bunal avatar Fila avatar Tamás Südi avatar Rez avatar Bobby avatar  avatar Ai avatar  avatar whynot?& avatar  avatar  avatar Farid Zellipour avatar Michael Sayapin avatar Matija Nalis avatar  avatar Adam H. Meadvin avatar Francesco Minnocci avatar Timo Geier avatar  avatar GrabSomeChicken avatar Stefan Hirschmann avatar

Watchers

James Cloos avatar  avatar  avatar  avatar  avatar

acpi_ec's Issues

dkms Error during running make command

Hello.
When I run this script dkms error causes during on running make command. It said the struct called file_operations is not found.
So I've imported the kernel source it doesn't change the result.
May different kernel version make to fail?
Here is my operating system information.
Kernel: 5.8.0-43-generic OS: Ubuntu 20.04 LTS (Focal) Secure Boot State: Fully Enabled(mokutil violation-validated and standard mode on BIOS)

How to install on new kernel

Before I had kernel 5.14.16, currently I have kernel 5.14.17
Any fan controller doesn't work:

modprobe: FATAL: Module ec_sys not found in directory /lib/modules/5.14.17-301.fc35.x86_64
Could not load `ec_sys' kernel module

When I try to install acpi_ec on new kernel again:

sudo ./install.sh 
acpi_ec v1.0.2 is already installed

But in fact it installed only on kernel 5.14.16 ....

Module acpi_ec-v1.0.2 for kernel 5.14.16-301.fc35.x86_64 (x86_64).
Before uninstall, this module version was ACTIVE on this kernel.

acpi_ec.ko.xz:
 - Uninstallation
   - Deleting from: /lib/modules/5.14.16-301.fc35.x86_64/extra/
 - Original module
   - No original module was found for this module on this kernel.
   - Use the dkms install command to reinstall any previous module version.

depmod....
Module acpi_ec-v1.0.2 for kernel 5.14.16-301.fc35.x86_64 (x86_64).
This module version was INACTIVE for this kernel.
depmod....
Deleting module acpi_ec-v1.0.2 completely from the DKMS tree.
Uninstalled acpi_ec v1.0.2
[user@fedora acpi_ec]$ sudo ./install.sh 
WARNING: Secure Boot is not enabled!
Creating symlink /var/lib/dkms/acpi_ec/v1.0.2/source -> /usr/src/acpi_ec-v1.0.2

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=5.14.17-301.fc35.x86_64 -C /lib/modules/5.14.17-301.fc35.x86_64/build M=/var/lib/dkms/acpi_ec/v1.0.2/build/src modules...
cleaning build area...

acpi_ec.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.14.17-301.fc35.x86_64/extra/

depmod....

Unsigned module loading is restricted

acpi_ec is not working with kernel lockdown on archlinux.
Same issue was occurred last time when I tested it on Fedora Workstation 37.
There's no way to use nbfc-linux on a lockdown kernel without disabling the Secure Boot.
Here are the errors which I have gotten while loading the module.

$ sudo modprobe acpi_ec
modprobe: ERROR: could not insert 'acpi_ec': Operation not permitted

$ journalctl --follow
archlinux kernel: Lockdown: modprobe: unsigned module loading is restricted; see man kernel_lockdown.7

OS: Arch Linux x86_64
Kernel: 6.2.7-arch1-1
Secure Boot: Enabled
Lockdowm mode: Integrity

dkms incorrect syntax

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Generating a RSA private key
....++++
.........................................................................++++
writing new private key to '/root/mok.priv'
-----
The generated key is going to be imported into the secure keystore.
The following passphrase is only required once, during the following reboot.
Please press RETURN to go on.
input password: 
input password again: 

Please reboot your computer now to complete the enrollment of your new MOK.
This is going to look somewhat similar to https://sourceware.org/systemtap/wiki/SecureBoot
Error! Arguments <module> and <module-version> are not specified.
Usage: add <module>/<module-version> or
       add -m <module>/<module-version> or
       add -m <module> -v <module-version>
Error! Arguments <module> and <module-version> are not specified.
Usage: add <module>/<module-version> or
       add -m <module>/<module-version> or
       add -m <module> -v <module-version>
Error! Arguments <module> and <module-version> are not specified.
Usage: add <module>/<module-version> or
       add -m <module>/<module-version> or
       add -m <module> -v <module-version>

fedora 35, acpi_ec-1.0.2
Downloaded via git clone and there no such issue

cannot uninstall

Creating symlink /var/lib/dkms/acpi_ec/v1.0.2/source -> /usr/src/acpi_ec-v1.0.2

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j8 KERNELRELEASE=5.14.14-300.fc35.x86_64 -C /lib/modules/5.14.14-300.fc35.x86_64/build M=/var/lib/dkms/acpi_ec/v1.0.2/build/src modules...
cleaning build area...

acpi_ec.ko.xz:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.14.14-300.fc35.x86_64/extra/

depmod....
Job for systemd-modules-load.service failed because the control process exited with error code.
See "systemctl status systemd-modules-load.service" and "journalctl -xeu systemd-modules-load.service" for details.
[user@fedora acpi_ec]$ systemctl status systemd-modules-load.service
× systemd-modules-load.service - Load Kernel Modules
     Loaded: loaded (/usr/lib/systemd/system/systemd-modules-load.service; static)
     Active: failed (Result: exit-code) since Thu 2021-11-04 02:45:06 +03; 52s ago
       Docs: man:systemd-modules-load.service(8)
             man:modules-load.d(5)
    Process: 4512 ExecStart=/usr/lib/systemd/systemd-modules-load (code=exited, status=1/FAILURE)
   Main PID: 4512 (code=exited, status=1/FAILURE)
        CPU: 16ms

Nov 04 02:45:06 fedora systemd[1]: Starting Load Kernel Modules...
Nov 04 02:45:06 fedora systemd-modules-load[4512]: Failed to insert module 'acpi_ec': Key was rejected by service
Nov 04 02:45:06 fedora systemd-modules-load[4512]: Module 'msr' is built in
Nov 04 02:45:06 fedora systemd-modules-load[4512]: Failed to insert module 'ipmi_si': No such device
Nov 04 02:45:06 fedora systemd[1]: systemd-modules-load.service: Main process exited, code=exited, status=1/FAILURE
Nov 04 02:45:06 fedora systemd[1]: systemd-modules-load.service: Failed with result 'exit-code'.
Nov 04 02:45:06 fedora systemd[1]: Failed to start Load Kernel Modules.
[user@fedora acpi_ec]$ sudo ./uninstall.sh
sed: can't read /etc/modules-load.d/modules.conf: No such file or directory
[user@fedora acpi_ec]$ sudo ./install.sh 
acpi_ec vv1.0.2 is already installed

Linux kernel 6.5.0 causes problems

Sorry to bother you, my gcc version is too old. I closed this issue.

lec@leclerc:~/ISW/acpi_ec$ sudo ./install.sh 
Secure Boot not enabled on this system.
Creating symlink /var/lib/dkms/acpi_ec/v1.0.4/source -> /usr/src/acpi_ec-v1.0.4

Kernel preparation unnecessary for this kernel. Skipping...

Building module:
cleaning build area...
make -j16 KERNELRELEASE=6.5.0-14-generic -C /lib/modules/6.5.0-14-generic/build M=/var/lib/dkms/acpi_ec/v1.0.4/build/src modules...(bad exit status: 2)
ERROR (dkms apport): binary package for acpi_ec: v1.0.4 not found
Error! Bad return status for module build on kernel: 6.5.0-14-generic (x86_64)
Consult /var/lib/dkms/acpi_ec/v1.0.4/build/make.log for more information.

make.log:

lec@leclerc:~/ISW/acpi_ec$ cat /var/lib/dkms/acpi_ec/v1.0.4/build/make.log 
DKMS make.log for acpi_ec-v1.0.4 for kernel 6.5.0-14-generic (x86_64)
2024年 01月 16日 Tuesday 10:47:10 CST
make: Enter directory“/usr/src/linux-headers-6.5.0-14-generic”
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: x86_64-linux-gnu-gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
  You are using:           
  CC [M]  /var/lib/dkms/acpi_ec/v1.0.4/build/src/acpi_ec.o
/bin/sh: 1: gcc-12: not found
make[2]: *** [scripts/Makefile.build:251:/var/lib/dkms/acpi_ec/v1.0.4/build/src/acpi_ec.o] error 127
make[2]: *** Waiting for unfinished tasks....
make[1]: *** [/usr/src/linux-headers-6.5.0-14-generic/Makefile:2037:/var/lib/dkms/acpi_ec/v1.0.4/build/src] error 2
make: *** [Makefile:234:__sub-make] error 2
make: Leave directory“/usr/src/linux-headers-6.5.0-14-generic”

Unable to install nor uninstall, fedora 38

hi, so when i try to install this module running install.sh the response i get is that the module is already installed, so i run the uninstall scrip and tells me it has been uninstalled, but when i ran the install script again it tells me its already installed, my kernel version is 6.4.6-200 i leave the prompt if that helps.
Error! DKMS tree already contains: acpi_ec-v1.0.2 You cannot add the same module/version combo more than once

Module not loading with SecureBoot enabled, key rejected

I've installed the module, the script generated the key and asked for a password, I enrolled the key after rebooting but the module doesn't load. I tried to use modprobe and it returns an error saying the key has been rejected. The module works correctly with SecureBoot disabled. I'm using Fedora 40. Other self-signed kernel modules (eg the Nvidia driver kernel module) work fine on my system.

Seem to fail to install on Arch with Linux-Kernel 6.4.12-arch1-1

running install.sh gives me the following logs, although i am not quite sure what to make of them (i fully uninstalled the module beforehand)

neko@Arch ~/acpi_ec (master)> sudo ./install.sh
WARNING: Secure Boot is not enabled!
Creating symlink /var/lib/dkms/acpi_ec/v1.0.2/source -> /usr/src/acpi_ec-v1.0.2
Sign command: /usr/lib/modules/6.4.12-arch1-1/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Building module:
Cleaning build area...
make -j12 KERNELRELEASE=6.4.12-arch1-1 -C /usr/lib/modules/6.4.12-arch1-1/build M=/var/lib/dkms/acpi_ec/v1.0.2/build/src modules...(bad exit status: 2)
Error! Bad return status for module build on kernel: 6.4.12-arch1-1 (x86_64)
Consult /var/lib/dkms/acpi_ec/v1.0.2/build/make.log for more information.


neko@Arch ~/acpi_ec (master) [10]> cat /var/lib/dkms/acpi_ec/v1.0.2/build/make.log
DKMS make.log for acpi_ec-v1.0.2 for kernel 6.4.12-arch1-1 (x86_64)
Fr 1. Sep 18:29:26 CEST 2023
  CC [M]  /var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.o
In file included from ./include/linux/linkage.h:7,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:56,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/slab.h:15,
                 from ./include/linux/resource_ext.h:11,
                 from ./include/linux/acpi.h:13,
                 from /var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c:13:
/var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c: In function ‘acpi_ec_create_dev’:
./include/linux/export.h:27:22: error: passing argument 1 of ‘class_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   27 | #define THIS_MODULE (&__this_module)
      |                     ~^~~~~~~~~~~~~~~
      |                      |
      |                      struct module *
/var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c:115:39: note: in expansion of macro ‘THIS_MODULE’
  115 |   if (IS_ERR(dev_class = class_create(THIS_MODULE, "chardev"))) {
      |                                       ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
                 from ./include/linux/acpi.h:14:
./include/linux/device/class.h:230:54: note: expected ‘const char *’ but argument is of type ‘struct module *’
  230 | struct class * __must_check class_create(const char *name);
      |                                          ~~~~~~~~~~~~^~~~
/var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c:115:26: error: too many arguments to function ‘class_create’
  115 |   if (IS_ERR(dev_class = class_create(THIS_MODULE, "chardev"))) {
      |                          ^~~~~~~~~~~~
./include/linux/device/class.h:230:29: note: declared here
  230 | struct class * __must_check class_create(const char *name);
      |                             ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:252: /var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.o] Error 1
make: *** [Makefile:2032: /var/lib/dkms/acpi_ec/v1.0.2/build/src] Error 2

Since its throwing Secure Boot at me, do i need to enable that? What about the other errors mentioned in the logs?

Fatal error running install.sh

$ sudo bash install.sh
fatal: not a git repository (or any of the parent directories): .git

MSI Creator Z16P // Kali Linux

Error during ./install.sh - Make logs

See below for make logs:

DKMS make.log for acpi_ec-v1.0.2 for kernel 6.4.3-hardened1-1-hardened (x86_64)
Wed Jul 19 17:46:46 BST 2023
  CC [M]  /var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.o
In file included from ./include/linux/linkage.h:7,
                 from ./include/linux/preempt.h:10,
                 from ./include/linux/spinlock.h:56,
                 from ./include/linux/mmzone.h:8,
                 from ./include/linux/gfp.h:7,
                 from ./include/linux/slab.h:15,
                 from ./include/linux/resource_ext.h:11,
                 from ./include/linux/acpi.h:13,
                 from /var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c:13:
/var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c: In function 'acpi_ec_create_dev':
./include/linux/export.h:27:22: error: passing argument 1 of 'class_create' from incompatible pointer type [-Werror=incompatible-pointer-types]
   27 | #define THIS_MODULE (&__this_module)
      |                     ~^~~~~~~~~~~~~~~
      |                      |
      |                      struct module *
/var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c:115:39: note: in expansion of macro 'THIS_MODULE'
  115 |   if (IS_ERR(dev_class = class_create(THIS_MODULE, "chardev"))) {
      |                                       ^~~~~~~~~~~
In file included from ./include/linux/device.h:31,
                 from ./include/linux/acpi.h:14:
./include/linux/device/class.h:230:54: note: expected 'const char *' but argument is of type 'struct module *'
  230 | struct class * __must_check class_create(const char *name);
      |                                          ~~~~~~~~~~~~^~~~
/var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.c:115:26: error: too many arguments to function 'class_create'
  115 |   if (IS_ERR(dev_class = class_create(THIS_MODULE, "chardev"))) {
      |                          ^~~~~~~~~~~~
./include/linux/device/class.h:230:29: note: declared here
  230 | struct class * __must_check class_create(const char *name);
      |                             ^~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:252: /var/lib/dkms/acpi_ec/v1.0.2/build/src/acpi_ec.o] Error 1
make: *** [Makefile:2026: /var/lib/dkms/acpi_ec/v1.0.2/build/src] Error 2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.