[systemd-devel] Detecting inactive sessions

Lennart Poettering lennart at poettering.net
Tue Nov 11 07:46:28 PST 2014


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

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.

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list