lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 1 May 2012 09:47:52 +1000
From:	NeilBrown <neilb@...e.de>
To:	"H. Peter Anvin" <hpa@...or.com>
Cc:	Alan Cox <alan@...rguk.ukuu.org.uk>, linux-serial@...r.kernel.org,
	linux-pm@...r.kernel.org, lkml <linux-kernel@...r.kernel.org>
Subject: Re: Question:  How to power-manage UART-attached devices.

On Mon, 30 Apr 2012 15:51:59 -0700 "H. Peter Anvin" <hpa@...or.com> wrote:

> 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

Hi Peter,

 I agree that in general there is not necessarily a 1-1 correspondence between
 "device file is open" and "device is powered", however I think that in a lot
 of real cases it is a very natural correspondence. 

 In my bluetooth case, there is nothing useful that the device can do if
 hciattach isn't running and listening to the device, so it may as well be
 off.
 For GPS it is less clear as the GPS could maintain state (current almanac
 and ephemeris) and could even periodically tune in to the satellites and
 update this state (though as mine cannot power on/off the antenna that
 second case might not be very useful).  This particular GPS device does not
 lose state when I toggle the 'on/off' line.  It just stops sending
 information (and maybe stops doing calculations, I don't know).  And that is
 exactly what I want to happen when the tty device is closed.

 I imagine this proposal as being like a virtual DTR line.  It may not always
 be appropriate to connect DTR to the power switch, but sometimes it is.

Thanks,
NeilBrown

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ