Subject: Device insertion / removal notification
To: None <tech-kern@netbsd.org>
From: Michael Graff <explorer@flame.org>
List: tech-kern
Date: 08/05/2004 10:51:35
=2D----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Has anyone thought about a way to do this, probably with a userland daemon=
=20
(perhaps multiple, one per user or something) to act upon device insertion?
=46or instance, I have a "car GPS / mp3 player" and that means two devices:
Garmin StreetPilot 2610
External keypad to control xmms :)
However, the procedure to hot-plug these devices is currently:
int fd =3D -1;
while (fd < 0) {
fd =3D open();
if (fd < 0)
sleep(1);
}
or for usbhidaction, a shell script to restart it when it dies.
This really isn't optimal. :)
I was thinking of using kqueue, but the kevent structure doesn't have any w=
ay=20
to extend the structure to include additional fields beyond the int64_t dat=
a=20
field. I suppose I could stuff a pointer in there, but that seems like a=20
hack. I could add an external data pointer and length, but now the caller=
=20
would need to clean up the event's additional data.
Do I write yet another method to do this, or should I hack on kqueue to stu=
ff=20
this in?
=2D --Michael
=2D----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (NetBSD)
iD8DBQFBEnOql6Nz7kJWYWYRAoA/AJ411veVz0b9sgo/o+GH8aL2dQo3zQCfdXfY
3gqSrqLeLkI1/220kJOB93g=3D
=3DRRPH
=2D----END PGP SIGNATURE-----