Re: Question: How to power-manage UART-attached devices.

From: H. Peter Anvin
Date: Mon Apr 30 2012 - 18:52:15 EST


On 04/30/2012 03:22 PM, NeilBrown wrote:
>
> What I would really like is to integrate it closely with the state
> of the UART. i.e. if the /dev/ttyO1 device is open, then the GPS
> is "on". If not then it is "off". Similarly if /dev/tty/O0 is
> open, bluetooth is "on", else "off". However I cannot find any way
> to "plug in" to the tty or serial drivers to perform an arbitrary
> action on first-open or last-close. Is something like that
> possible? If not, is it a reasonable thing to ask? Any suggests
> about where to put such a hook?
>

I don't think that's the right interface. Just because the port is
currently open doesn't mean the device is active, nor vice versa. ALL
it means is that someone currently has an access handle to it.

Since a serial port models, well, a *port*, it is logical to think of
a (hypothetical) socket containing an RS-232 connector as well as a
power outlet. Given that, it would be logical to drive the "power
connector" using the same type of interface used for the other parts
of an RS-232 control, meaning either with termios flags or via a
dedicated control ioctl (TIOCPOWER?).

-hpa

--
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/