[PATCH powerd] Inhibit suspend while audio device is open
pgf at laptop.org
Mon May 21 13:41:56 EDT 2012
> Audio playback and recording can be efficient enough not to trigger the CPU
> threshold, but we still don't want to suspend because it would interrupt the
> playback resp. recording.
> While there's a number of Activities (and probably Gnome applications as well)
> that don't close the audio device when they're done using audio, thus
> inhibiting suspend for longer than necessary, that's a problem on its own
> as it will also prevent other Activities from using the audio device.
> There are many other ways of Activities misbehaving and consuming a lot of
> resources. The increased battery drain by inhibiting suspend is easy enough
> for users to observe by watching the power LED.
> Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
> powerd | 14 ++++++--------
> 1 files changed, 6 insertions(+), 8 deletions(-)
thanks for doing all that testing!
i'm perfectly happy to enable this, if we think it fixes the problem
well enough, and/or we think the applications can be fixed to do the
right thing. (for some reasonable value of "we".)
in searching for a relevant ticket on d.l.o. just now, i found #6670,
which is quite relevant, if perhaps a bit dated. the issue with
Distance, in particular, isn't relevant because i believe Distance
actively suppresses idle-suspend when a measurement is in progress.
but it does raise the issue that the current check used by that patch is
an "instant in time" check, which really isn't optimal. an activity
counter would work (as is used for some other powerd measurements), or
better, a timestamp, as was proposed by cjb in the ticket.
> diff --git a/powerd b/powerd
> index c6d9487..09f9153 100755
> --- a/powerd
> +++ b/powerd
> @@ -1199,13 +1199,10 @@ cpu_or_network_busy()
> -# unused for now, because too many sound apps leave the
> -# device open: the TamTams, Record (after playing), Browse
> -# and Firefox (after playing)
> -# grep -q RUNNING /proc/asound/card0/pcm0?/sub0/status && trace audio busy
> + grep -q RUNNING /proc/asound/card0/pcm0?/sub0/status && trace audio busy
> # see if there's been activity during the recent idle period --
> @@ -1330,7 +1327,8 @@ general_inhibit()
> - general_inhibit || usb_inhibit || ttyusb_inhibit || cpu_or_network_busy
> + general_inhibit || usb_inhibit || ttyusb_inhibit || cpu_or_network_busy \
> + || audio_busy
> if [ -e $TPAD_RECAL ]
paul fox, pgf at laptop.org
More information about the Devel