I had some fun with your idea
Actually, I have a confession to make. I was incredibly lazy when posing the original question, because I could have discovered the answer myself. See, I'm not starting from scratch. Being part of the
systemd
diaspora, I'm porting an application to FreeBSD. I wasn't aware when I asked the question that this application uses those same
ioctl
s, but they're in a different include file on That Other System. I could have simply guessed that this might be the case, done this on FreeBSD:
Code:
grep -lR SETLED /usr/include 2> /dev/null
and saved you all this trouble. My apologies.
Anyway, this application runs on a dedicated box with a dedicated monitor with a screen blanking interval of 60 seconds. The two or three times a week that the box needs my attention, it flashes the LEDs in one pattern or another. It also wakes up the screen, and keeps it awake. Further exploration of this topic yields the following FreeBSD-specific info:
- As on Linux, you don't need to be root to flash the LEDs.
- As on Linux, you can simply use /dev/tty.
- Unlike on Linux, as soon as you use an <Alt>Fn key to move to a different virtual console, the artificial values of the LEDs disappear, even if you come back to the original virtual terminal. On Linux, they also disappear, but they reappear if you come back to the original virtual terminal. I consider the Linux way a little better, but it doesn't make much difference in my situation.
- Unlike on Linux, flashing the LEDs does not wake up the screen and reset the screen blanking timeout. I can work around that on FreeBSD by using system(3) calls in the C code to do
vidcontrol -t off
(and then turn it back on again right away).
The application, by the way, is a security layer for my house's POTS line, written half in C and half in LISP. We get no unwanted telephone ringing around here. People on our "A" list are handled as with a regular phone, including gathering messages (and flashing the LEDs and waking up the screen) if we're not here. Other people (once they pass the Turing test so we know they're not robocallers) are allowed to leave a message (which flashes the LEDs and wakes up the screen), but the phone doesn't physically ring. Robocallers aren't even allowed to leave a message. And known obnoxious numbers are handled by not even picking up the line. From the other end, it seems like our phone is ringing and ringing.
Hardware is from Digium, the provider of record for those who use Asterisk. I use their drivers (the dahdi package), and tiny chunks of Asterisk code for handling low-level stuff like DTMF tone recognition.
My phone is mine. I get to tame it any way I want.