Running a script after a device's been plugged

Samuel Martín Moro faust64 at
Fri Jul 2 14:06:17 UTC 2010


In order to simplify our managing scripts, my project manager would like to
manage all devices (USB and serial) with the same name pattern (cuaa*,
cuad*, ... whatever).
He explained me he wants to keep cuaa0 and cuaa1, and then link each
/dev/da`n` to /dev/cuaa`n + 2`, ...

But, there is some things I'm not sure to understand:

1) I though that cuaa was used until FreeBSD7, then we had cuad, and since
FreeBSD8, it would be cuaU.
But one of our 7.2-RELEASE have both /dev/cuaU0 and dev/cuad0.
Did I miss something? What is cuaU doing here?
btw. it's my dev server, someone may have touched it. On the servers
installed from my generated CDs, no /dev/cuaU* at all...

2) We also provide serial DCF77 modules, and use them with ntpd, linking
them /dev/ttyd`n` to /dev/refclock-`n`
What is ttyd used for?
Can I assume I would use ttyd`n` only with my DCF modules, and so link them
to /dev/refclock-`n`, excluding them from my cuaa`n + x` mess?
Also, we would have to manage USB DCF77 modules soon; does anybody tried
them? How would them be named in /dev?

3) Last but not least, how to link a device once it's plugged in, and unlink
it once it's unplugged?
We're still providing 5.4 and 6.2 releases based versions. And I do not like
So I thought I could use /etc/devd.conf, with attach/detach directives, and
their actions calling a script that would create/delete the links.
Is there a cleaner way to do it? Would it be still usable in 8.x? (9.x?)

Thanks for your time and advices!

Samuel Martín Moro
{EPITECH.} tek4
CamTrace S.A.S
 (+033) 1 41 38 37 60
 1 Allée de la Venelle
 92150 Suresnes

More information about the freebsd-questions mailing list