Want to have thinkpad_acpi kernel module in hassos - how to proceed?

I use hassos on a Thinkpad X240 laptop. It works flawlessly, but I want to adjust the charge start and stop thresholds of the battery. Unfortunately, this must be done on every boot. So I built my own hassos image and extracted the thinkpad_acpi.ko and its dependency ledtrig_audio.ko from the kernel build directory, installed them with insmod manually and they worked as expected.

Now, I want to have these modules also for newer versions of the OS without building them manually each time. I see two ways to achieve this but I’m not sure if either will be accepted by the maintainers:

  • add the modules to the nuc (for 5.13) or generic_x86_64 (for 6.x) configs
  • add a new device that uses the same configs but adds the two modules

What is the recommended way?

Hi, did you succeed, how? I have a similar question

Yes, I did. The driver was added to the operating system of Home Assistant and is available in all newer releases. Please see Enhancement: add thinkpad_acpi module by herrfrei · Pull Request #1388 · home-assistant/operating-system · GitHub how the integration was done.

Yes, I see my driver i need is also there’s it’s config_video_dev … But if I do “modprove video dev” I don’t see it loaded… How do you activate it then?

If I remember correctly the driver is loaded automatically by the kernel. Nothing to do here!

I think you should read on in Video4Linux documentation how to load the driver you need (config_video_dev enables only the V4L2 API, used by cameras, analog TV, video grabbers, radio devices and by some input devices.).

yes, indeed, it should load auto… i need to enable “videodev” only, its a depency for the /dev/video loopback device i’m creating

but whats strange… on a regular alpine system, i see the “videodev.ko” file…

But on my hassos, i dont see it… so i have no idea how i i can load it :frowning:

If you look into the buildroot project and search for config_video_dev, you will find three occurences (Search · config_video_dev · GitHub). May be your board is not configured for it (then you need to activate the module like I did for thinkpad_acpi) or doesn’t support it at all.

What I would do:

  1. download or check out the source code of the os from GitHub - home-assistant/operating-system: Home Assistant Operating System (same version as running on your board)
  2. Add a config_video_dev=m line to the config of your board.
  3. Build the os and copy the resulting videodev.ko file to your board.
  4. Try to load it by hand with full path to the .ko file (don’t remember if modprobe supports loading with full path - if not, use insmod)
  5. Check if the driver is loades with lsmod.
  6. If everything is working, make a pull request with your changes.

hmm, thats new to me, i runn HassOS on an esxi system… not sure how i can build the os? can i do that on a windows system ? insmod is indeed usefull to point to a .ko file, so no depmod is needed

maybe i need to add some extra config file here as descibed here : 

### Kernel-Module

The kernel module folder `/etc/modules-load.d` is persistent and you can add your configuration files there. See [Systemd modules load](https://www.freedesktop.org/software/systemd/man/modules-load.d.html). You can add the modules configuration files in `/etc/modprobe.d` that is also persistent.

I have no idea if the driver is available on esxi. Sorry, but I think I can’t help you with that!

ok, np, gonna google a bit , how i can build a new hassos, maybe to extract the videodev.ko from there

thnx for helping!

but this file :

isnt that somekind of generic file for all systems?

i created a PR a long time ago to include these below, because i use an USBCAN adapter…

# Can Bus support
CONFIG_CAN=m
CONFIG_CAN_RAW=m
CONFIG_CAN_VCAN=m
CONFIG_CAN_SLCAN=m
CONFIG_CAN_DEV=m
CONFIG_CAN_GS_USB=m
CONFIG_CAN_PEAK_USB=m

after PR was submitted, it worked for me

so i dont know why

CONFIG_VIDEO_DEV=m

doesnt work , its in same file

If have no idea why the driver is missing, really. My suggestion: open a ticket and describe your problem (including hardware information). Hope this helps!

ok, will do, thnx! :slight_smile:

Succes!!

I build a new HassOS and enabled the kernel modules before the build, that generated me the .ko file I wanted … copy pasted that file afterwards on my live HassOS system, I did insmod with that file, and it loaded successful :+)

Thnx for helping me!!

Could you explain a bit more how you did this please? I want to do the same for ntfs3

Hmm, was a long time ago, but I think I followed there instructions to compile hassos with a modified file…