Hal 需要看到 Linux 设备的什么?
我正在尝试了解 Linux 内核上的设备驱动程序,为此我创建了三个模块:
- 总线类型
- 设备驱动程序
- 一个现在不执行任何操作的假设备,只是注册了
一切正常,我可以加载总线,创建设备的驱动程序和模块。一切都出现在 sysfs 上,包括设备和设备驱动程序之间的链接,表明它们已绑定。
当加载驱动程序和设备时,我可以使用 udevadm 监视器看到也引发了一些事件:
KERNEL[1275564332.144997] add /module/bustest_driver (module)
KERNEL[1275564332.145289] add /bus/bustest/drivers/bustest_example (drivers)
UDEV [1275564332.157428] add /module/bustest_driver (module)
UDEV [1275564332.157483] add /bus/bustest/drivers/bustest_example (drivers)
KERNEL[1275564337.656650] add /module/bustest_device (module)
KERNEL[1275564337.656817] add /devices/bustest_device (bustest)
UDEV [1275564337.658294] add /module/bustest_device (module)
UDEV [1275564337.664707] add /devices/bustest_device (bustest)
但是在一切之后,设备没有出现在 hal 上。还有什么需要设备才能被 hal 看到?
I'm trying to learn about device drivers on Linux Kernel, for that I've created three modules with:
- A bus type
- A device driver
- A fake device that does nothing now, only is registered
Everything works fine, I can load the bus, the driver and the module that creates the device. Everything appears on sysfs, including the link between the device and the device driver that indicates that they are binded.
And when the driver and device are loaded, I can see using udevadm monitor
that also some events are provoked:
KERNEL[1275564332.144997] add /module/bustest_driver (module)
KERNEL[1275564332.145289] add /bus/bustest/drivers/bustest_example (drivers)
UDEV [1275564332.157428] add /module/bustest_driver (module)
UDEV [1275564332.157483] add /bus/bustest/drivers/bustest_example (drivers)
KERNEL[1275564337.656650] add /module/bustest_device (module)
KERNEL[1275564337.656817] add /devices/bustest_device (bustest)
UDEV [1275564337.658294] add /module/bustest_device (module)
UDEV [1275564337.664707] add /devices/bustest_device (bustest)
But after everything, the device doesn't appear on hal. What else need a device to be seen by hal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
设备似乎一切正常,问题是 Hal 需要为每个子系统提供一个处理程序(处理程序列表可以在 hald/linux/device.c 中找到),显然 hal 没有不支持为这种情况发明的子系统
bustest
。如果总线使用名称“pseudo”而不是“bustest”注册,则 hal 使用一组为假设备定义的处理程序来初始化数据库条目、注册它并发送
DeviceAdded
事件。Everything seems to be ok with the device, the problem is that Hal needs a handler for each subsystem (the list of handlers can be found in
hald/linux/device.c
), and obviously, hal doesn't supportbustest
, the subsystem invented for this case.If the bus is registered with the name "pseudo" instead of "bustest", hal uses a set of handlers defined for fake devices to initialize the database entry, registers it and send a
DeviceAdded
event.