[systemd-devel] Detecting inactive sessions

Bastien Nocera hadess at hadess.net
Wed Nov 12 14:36:16 PST 2014


On Tue, 2014-11-11 at 16:46 +0100, Lennart Poettering wrote:
> On Wed, 29.10.14 15:45, Bastien Nocera (hadess at hadess.net) wrote:
> 
> > For a very specific definition of inactive.
> > 
> > I'm looking at a way for the iio-sensor-proxy at:
> > https://github.com/hadess/iio-sensor-proxy
> > to suspend reading from accelerometers (or maybe to turn them off), when
> > all the sessions are locked and the screens turned off.
> > 
> > This would usually mean that I would enable reading from the sensor if
> > one session is "active" and stop reading if none are "active". Is this
> > correct? Is it up to the session manager (eg. gnome-session) to tell us
> > whether a session is active or not, or do I have this backwards?
> 
> logind knows when sessions are active and not.
> 
> Note that access control to such devices should really not be
> per-session, but per-user. Meaning that a user should get access to
> the device as long as he has at least one session active.
> 
> That said, I am not sure I really grok what iio-sensor-proxy is doing,
> and whether doing it involving both uinput and uevents is really such
> a great idea.
> 
> I am tempted to say that we should probably add support for the
> orientation sensors to logind, and abstract them away in logind so
> that only simple high-level rotation change events are sent
> out.

Which is already what the code in the iio-sensor-proxy tries to do.
iio-sensor-proxy's code means that we can have an accelerometer device
showing up in udev, with the orientation updated only when the
orientation of the device changes in a major way.

>  I am pretty sure that orientation is something pretty much all
> desktop environments really want to know about, and as logind is
> really a system service these days that only exists for the purpose of
> making writing of desktop environments easy I think adding the
> orientation stuff to logind wouldn't be too far off. And I figure we
> need it for the userspace console too in one way or
> another... Orientation is pretty much a property of a "seat" anyway,
> and I figure it should be exposed as one, too.

It's not a seat property. It's a property of the display itself. If you
connected a tablet to a TV and rotated the tablet, you're not rotating
the TV as well.

>  Also, we really should
> figure out a logic where the desktop subscribes to orientation changes
> and we only in that case even do the IIO access, rather than pushing
> the IIO events up the stack even when nobody is listening.

Which is what my original request was all about.

> I am willing to take a patch for this, but then again, as I own a Yoga
> I might look into this myself too one day.

I need to figure out how to make the IIO code not suck first though.

Cheers



More information about the systemd-devel mailing list