Re: How to generate hotplug events in drivers?

From: Greg KH
Date: Fri Aug 13 2004 - 02:07:59 EST


On Thu, Aug 12, 2004 at 09:52:00PM -0400, Stephen Glow wrote:
>
> I'm in the process of porting a device driver from the 2.4 kernel to the
> 2.6 kernel. In the older version of the drivers I was using the devfs
> system to create the device files. I've decided to rip this out and
> move everything to udev since this seems to be the preferred method now.
>
> The problem I'm having with this port is that I can't get the udev
> system to create a device file when I install the module. As far as I
> can tell, no hotplug events are being generated when I insmod the device
> driver. In other respects the driver seems to be loading correctly;
> I'm able to request the PCI regions, enable, and start the PCI device,
> and allocate a dynamic device major number. I can also see an entry
> create in the /sys/bus/pci/drivers directory.

udev needs to see a file called "dev" in the proper structure show up in
the sysfs tree in either /sys/class/* or /sys/block/*. So, you need to
either use the misc char device interface, the block interface, some
other char interface that already has sysfs support, or add your own.
If you need to add your own, I suggest looking into the class_simple
interface, as that's a lot easier to work with to start out with.

Hope this helps,

greg k-h
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/