1
#! /bin/sh /usr/share/dpatch/dpatch-run
2
## 06_pulseaudio-0.9.5-suspend.dpatch.dpatch by <ranma+debianbts@tdiedrich.de>
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Handle -ESTRPIPE correctly. Allows pulseaudio to survive suspend
6
## DP: operations on ALSA devices (e.g. s2disk).
10
diff -Naru pulseaudio-0.9.5-orig/src/modules/module-alsa-sink.c pulseaudio-0.9.5/src/modules/module-alsa-sink.c
11
--- pulseaudio-0.9.5-orig/src/modules/module-alsa-sink.c 2006-08-18 23:38:48.000000000 +0200
12
+++ pulseaudio-0.9.5/src/modules/module-alsa-sink.c 2007-01-13 21:01:07.000000000 +0100
17
+static int suspend_recovery(struct userdata *u) {
21
+ pa_log_info("*** ALSA-SUSPEND (playback) ***");
23
+ if ((ret = snd_pcm_prepare(u->pcm_handle)) < 0) {
24
+ pa_log("snd_pcm_prepare() failed: %s", snd_strerror(-ret));
27
+ pa_module_unload_request(u->module);
34
static void do_write(struct userdata *u) {
41
+ if (frames == -ESTRPIPE) {
42
+ if (suspend_recovery(u) < 0)
48
pa_log("snd_pcm_writei() failed: %s", snd_strerror(-frames));
52
if (xrun_recovery(u) < 0)
55
+ if (snd_pcm_state(u->pcm_handle) == SND_PCM_STATE_SUSPENDED)
56
+ if (suspend_recovery(u) < 0)