views:

57

answers:

1

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?

A: 

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 support bustest, 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.

Jaime Soriano