[systemd-devel] Detecting inactive sessions

Bastien Nocera hadess at hadess.net
Mon Nov 3 08:30:35 PST 2014


On Mon, 2014-11-03 at 17:28 +0100, David Herrmann wrote:
> Hi
> 
> On Wed, Oct 29, 2014 at 3:45 PM, 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?
> 
> For uhid (similar to uinput) you get an OPEN and CLOSE event whenever
> the first/last user opens/closes the device you created. I think we
> want something similar for uinput. That is, when a gnome session is
> inactive, they should just close the input devices that were created
> by iio-sensor-proxy (done automatically if you use the systemd-logind
> API to access devices). This way, iio-sensor-proxy knows whenever at
> least one session uses the data. This is also how most kernel-internal
> APIs work.

The session doesn't read from the uinput device. The iio-sensor-proxy
just sends out a kevent, which is caught by the accelerometer helper in
udev. The GNOME session catches the udev event and reads the changed
property.



More information about the systemd-devel mailing list