Files not found -err.h, hwmon.h and hwmon-sysfs.h

I am using the torizon vscode plugin with a verdin imx8mplus on dahlia.

I am trying to interface a fan controller over i2c - emc2301/3/5 and get errors in vscode for the following.

#include <linux/err.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>

I have selected the 64bit arm option (aarch64-linux-gnu). What are the locations for these files as they are not found in the kernel provided?

Greetings @SJ_BHD,

I’m not sure if I understand, could you clarify the exact issue or error you are getting here?

Also by the looks of it you are trying to use Linux kernel headers. You would need to install the kernel headers into your container/build environment to have access to these during compilation. Debian has some kernel headers available in their package feeds, though you probably won’t find the exact same kernel version as you are using.

By the way, what exactly are you doing that requires these headers? Typically these headers are for device driver development or other similar low-level kernel work.

Best Regards,

I am trying to install the emc2305 fan controller driver.
Refer linux/emc2305.c at master · torvalds/linux · GitHub

Oh so this is a standard Linux driver then. In that case you can try looking at this article: Building External Kernel Modules With Torizon | Toradex Developer Center

As the article states you basically have 2 options. Either you can try and compile this driver as an out of tree module. Though this can be a little finicky when trying to compile code that originally came from the Linux kernel source. Or, you can just request that we enable this driver in our kernel by default going forward. In which case it would always be there in our future software releases.

Do you have an idea of which way you’d want to go?

Best Regards,

Thanks for informing regarding these options. Can we have an option to include these files by default in a future software release? Perhaps it can be a option to select from the easy installer?

Can we have an option to include these files by default in a future software release?

I can put the request to our team for consideration.

Perhaps it can be a option to select from the easy installer?

That’s not how this works. This driver needs to be built against our kernel and added to our OS at build time. It’s not a simple matter of flipping a switch.

Now back to the main topic. I did more research on this “emc2305” driver. It appears we might have a problem. This driver was only introduced into the Linux kernel starting with Linux version 6.1. The latest version of the Linux kernel we support for the Verdin i.MX8M Plus is based on Linux version 5.15. So unfortunately I can’t request our team to add this driver by default since it’s not present in our version of the Linux kernel.

Therefore your only real option is to try and back port the driver as an out of tree kernel module. However, there is a chance this might not work as expected since this driver was designed for a newer version of the Linux kernel than what our OS uses.

Best Regards,

Hello @SJ_BHD ,
Do you have any updates on this topic?

Best regards,