如何与我自己的内核模块中导出到SYSF的sysfs或驱动程序进行互动?
我正在尝试制作一个内核模块,该模块将多个设备曝光到单个字符设备。我成功编写了GPIO和CDEV部分,但我无法弄清楚W1_therm设备。
我在config.txt中使用带有DS18B20温度传感器的Raspberry Pi和DS18B20温度传感器和W1-GPIO-PULLUP驱动器,带有dtoverlay = W1-GPIO-PULLUP,GPIOPIN = 10
在Config.txt中。它检测到温度传感器,我可以通过/sys/bus/w1/设备/28-062194159C7D/温度
文件读取温度。但是,我想在内核模块中阅读它,并且我对如何与W1驱动程序进行互动。
我是否必须重写DS18B20驱动程序的驱动程序,还是可以以某种方式与已加载的驱动程序进行交互?还是可以从内核空间读取SYSFS文件?请有人可以指向正确的方向或提供示例代码?
I'm trying to make a kernel module that exposes multiple devices to a single character device. I successfully written the gpio and cdev portion but I can't figure out the w1_therm device.
I use a raspberry pi with a DS18B20 temperature sensor and the w1-gpio-pullup driver with dtoverlay=w1-gpio-pullup,gpiopin=10
in the config.txt. It detects the temperature sensor and I can read the temperature via the /sys/bus/w1/devices/28-062194159c7d/temperature
file. However I want to read it in my kernel module and I'm stuct on how do I interact with the w1 driver.
Do I have to rewrite the driver for the DS18B20 driver or can I somehow interact with the loaded driver? Or can I read the sysfs file from kernel space? Please can someone point me in the right direction or provide an example code?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论