[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

REMDN - Removable Device Notification


sudo sh /etc/netstart wi0 every time I reinserted my PCMCIA card became
boring. I was told there was no way to get userland notifications of new
device attachment, so I wrote a pseudo-device driver:

     Removable hardware attachment and detachment is noted by the kernel.  A
     pseudo-device, /dev/remdn, allows a user process to receive notifications
     of these events by doing read(2) on this device.

     The process reading from /dev/remdn receives a single line every time a
     hardware device is attached to the system or detached from the system.
     Each line consists of a character indicating the type of event: '+' for
     attachment or '-' for detachment followed by the device name, and then a
     new line character.

A patch against 3.2 is available. I would appreciate if I could get
input from people knowing the bsd kernel regarding correctness of my
approach and usefulness of this whole idea.

The code and the man page are under BSD license, you are welcome to use
it. Knowing how to use patch, add an option to your kernel config, and
use mknod /dev/remdn c 81 0 is a prerequisite. And remember, you will
NOT be running the OpenBSD system once you apply the patch, so don't bug
the OpenBSD developers.



Visit your host, monkey.org