summaryrefslogtreecommitdiffstats
path: root/meta/recipes-multimedia/pulseaudio/pulseaudio-0.9.15/alsaerror.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-multimedia/pulseaudio/pulseaudio-0.9.15/alsaerror.patch')
-rw-r--r--meta/recipes-multimedia/pulseaudio/pulseaudio-0.9.15/alsaerror.patch527
1 files changed, 0 insertions, 527 deletions
diff --git a/meta/recipes-multimedia/pulseaudio/pulseaudio-0.9.15/alsaerror.patch b/meta/recipes-multimedia/pulseaudio/pulseaudio-0.9.15/alsaerror.patch
deleted file mode 100644
index 0f09d2e646..0000000000
--- a/meta/recipes-multimedia/pulseaudio/pulseaudio-0.9.15/alsaerror.patch
+++ /dev/null
@@ -1,527 +0,0 @@
1From: Lennart Poettering <lennart@poettering.net>
2Date: Sun, 19 Apr 2009 17:22:51 +0000 (+0200)
3Subject: alsa: properly convert return values of snd_strerror() to utf8
4X-Git-Url: http://git.0pointer.de/?p=pulseaudio.git;a=commitdiff_plain;h=98a25c506e692ab091b4af7e1b37e8432fc08e8f
5
6alsa: properly convert return values of snd_strerror() to utf8
7---
8
9Upstream-Status: Backport
10
11diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c
12index 2fbcd7b..41e8b47 100644
13--- a/src/modules/alsa/alsa-sink.c
14+++ b/src/modules/alsa/alsa-sink.c
15@@ -281,7 +281,7 @@ static int try_recover(struct userdata *u, const char *call, int err) {
16 pa_assert(call);
17 pa_assert(err < 0);
18
19- pa_log_debug("%s: %s", call, snd_strerror(err));
20+ pa_log_debug("%s: %s", call, pa_alsa_strerror(err));
21
22 pa_assert(err != -EAGAIN);
23
24@@ -289,7 +289,7 @@ static int try_recover(struct userdata *u, const char *call, int err) {
25 pa_log_debug("%s: Buffer underrun!", call);
26
27 if ((err = snd_pcm_recover(u->pcm_handle, err, 1)) < 0) {
28- pa_log("%s: %s", call, snd_strerror(err));
29+ pa_log("%s: %s", call, pa_alsa_strerror(err));
30 return -1;
31 }
32
33@@ -636,12 +636,12 @@ static void update_smoother(struct userdata *u) {
34 /* Let's update the time smoother */
35
36 if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, &delay, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
37- pa_log_warn("Failed to query DSP status data: %s", snd_strerror(err));
38+ pa_log_warn("Failed to query DSP status data: %s", pa_alsa_strerror(err));
39 return;
40 }
41
42 if (PA_UNLIKELY((err = snd_pcm_status(u->pcm_handle, status)) < 0))
43- pa_log_warn("Failed to get timestamp: %s", snd_strerror(err));
44+ pa_log_warn("Failed to get timestamp: %s", pa_alsa_strerror(err));
45 else {
46 snd_htimestamp_t htstamp = { 0, 0 };
47 snd_pcm_status_get_htstamp(status, &htstamp);
48@@ -764,7 +764,7 @@ static int update_sw_params(struct userdata *u) {
49 pa_log_debug("setting avail_min=%lu", (unsigned long) avail_min);
50
51 if ((err = pa_alsa_set_sw_params(u->pcm_handle, avail_min)) < 0) {
52- pa_log("Failed to set software parameters: %s", snd_strerror(err));
53+ pa_log("Failed to set software parameters: %s", pa_alsa_strerror(err));
54 return err;
55 }
56
57@@ -792,7 +792,7 @@ static int unsuspend(struct userdata *u) {
58 SND_PCM_NO_AUTO_RESAMPLE|
59 SND_PCM_NO_AUTO_CHANNELS|
60 SND_PCM_NO_AUTO_FORMAT)) < 0) {
61- pa_log("Error opening PCM device %s: %s", u->device_name, snd_strerror(err));
62+ pa_log("Error opening PCM device %s: %s", u->device_name, pa_alsa_strerror(err));
63 goto fail;
64 }
65
66@@ -803,7 +803,7 @@ static int unsuspend(struct userdata *u) {
67 d = u->use_tsched;
68
69 if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &nfrags, &period_size, u->hwbuf_size / u->frame_size, &b, &d, TRUE)) < 0) {
70- pa_log("Failed to set hardware parameters: %s", snd_strerror(err));
71+ pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err));
72 goto fail;
73 }
74
75@@ -1030,7 +1030,7 @@ static void sink_get_volume_cb(pa_sink *s) {
76 return;
77
78 fail:
79- pa_log_error("Unable to read volume: %s", snd_strerror(err));
80+ pa_log_error("Unable to read volume: %s", pa_alsa_strerror(err));
81 }
82
83 static void sink_set_volume_cb(pa_sink *s) {
84@@ -1141,7 +1141,7 @@ static void sink_set_volume_cb(pa_sink *s) {
85 return;
86
87 fail:
88- pa_log_error("Unable to set volume: %s", snd_strerror(err));
89+ pa_log_error("Unable to set volume: %s", pa_alsa_strerror(err));
90 }
91
92 static void sink_get_mute_cb(pa_sink *s) {
93@@ -1152,7 +1152,7 @@ static void sink_get_mute_cb(pa_sink *s) {
94 pa_assert(u->mixer_elem);
95
96 if ((err = snd_mixer_selem_get_playback_switch(u->mixer_elem, 0, &sw)) < 0) {
97- pa_log_error("Unable to get switch: %s", snd_strerror(err));
98+ pa_log_error("Unable to get switch: %s", pa_alsa_strerror(err));
99 return;
100 }
101
102@@ -1167,7 +1167,7 @@ static void sink_set_mute_cb(pa_sink *s) {
103 pa_assert(u->mixer_elem);
104
105 if ((err = snd_mixer_selem_set_playback_switch_all(u->mixer_elem, !s->muted)) < 0) {
106- pa_log_error("Unable to set switch: %s", snd_strerror(err));
107+ pa_log_error("Unable to set switch: %s", pa_alsa_strerror(err));
108 return;
109 }
110 }
111@@ -1206,7 +1206,7 @@ static int process_rewind(struct userdata *u) {
112 pa_log_debug("Requested to rewind %lu bytes.", (unsigned long) rewind_nbytes);
113
114 if (PA_UNLIKELY((unused = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) {
115- pa_log("snd_pcm_avail() failed: %s", snd_strerror((int) unused));
116+ pa_log("snd_pcm_avail() failed: %s", pa_alsa_strerror((int) unused));
117 return -1;
118 }
119
120@@ -1228,7 +1228,7 @@ static int process_rewind(struct userdata *u) {
121 in_frames = (snd_pcm_sframes_t) (rewind_nbytes / u->frame_size);
122 pa_log_debug("before: %lu", (unsigned long) in_frames);
123 if ((out_frames = snd_pcm_rewind(u->pcm_handle, (snd_pcm_uframes_t) in_frames)) < 0) {
124- pa_log("snd_pcm_rewind() failed: %s", snd_strerror((int) out_frames));
125+ pa_log("snd_pcm_rewind() failed: %s", pa_alsa_strerror((int) out_frames));
126 return -1;
127 }
128 pa_log_debug("after: %lu", (unsigned long) out_frames);
129@@ -1359,7 +1359,7 @@ static void thread_func(void *userdata) {
130 pollfd = pa_rtpoll_item_get_pollfd(u->alsa_rtpoll_item, &n);
131
132 if ((err = snd_pcm_poll_descriptors_revents(u->pcm_handle, pollfd, n, &revents)) < 0) {
133- pa_log("snd_pcm_poll_descriptors_revents() failed: %s", snd_strerror(err));
134+ pa_log("snd_pcm_poll_descriptors_revents() failed: %s", pa_alsa_strerror(err));
135 goto fail;
136 }
137
138diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c
139index c59fc75..843f70b 100644
140--- a/src/modules/alsa/alsa-source.c
141+++ b/src/modules/alsa/alsa-source.c
142@@ -278,7 +278,7 @@ static int try_recover(struct userdata *u, const char *call, int err) {
143 pa_assert(call);
144 pa_assert(err < 0);
145
146- pa_log_debug("%s: %s", call, snd_strerror(err));
147+ pa_log_debug("%s: %s", call, pa_alsa_strerror(err));
148
149 pa_assert(err != -EAGAIN);
150
151@@ -286,7 +286,7 @@ static int try_recover(struct userdata *u, const char *call, int err) {
152 pa_log_debug("%s: Buffer overrun!", call);
153
154 if ((err = snd_pcm_recover(u->pcm_handle, err, 1)) < 0) {
155- pa_log("%s: %s", call, snd_strerror(err));
156+ pa_log("%s: %s", call, pa_alsa_strerror(err));
157 return -1;
158 }
159
160@@ -606,12 +606,12 @@ static void update_smoother(struct userdata *u) {
161 /* Let's update the time smoother */
162
163 if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, &delay, u->hwbuf_size, &u->source->sample_spec)) < 0)) {
164- pa_log_warn("Failed to get delay: %s", snd_strerror(err));
165+ pa_log_warn("Failed to get delay: %s", pa_alsa_strerror(err));
166 return;
167 }
168
169 if (PA_UNLIKELY((err = snd_pcm_status(u->pcm_handle, status)) < 0))
170- pa_log_warn("Failed to get timestamp: %s", snd_strerror(err));
171+ pa_log_warn("Failed to get timestamp: %s", pa_alsa_strerror(err));
172 else {
173 snd_htimestamp_t htstamp = { 0, 0 };
174 snd_pcm_status_get_htstamp(status, &htstamp);
175@@ -721,7 +721,7 @@ static int update_sw_params(struct userdata *u) {
176 pa_log_debug("setting avail_min=%lu", (unsigned long) avail_min);
177
178 if ((err = pa_alsa_set_sw_params(u->pcm_handle, avail_min)) < 0) {
179- pa_log("Failed to set software parameters: %s", snd_strerror(err));
180+ pa_log("Failed to set software parameters: %s", pa_alsa_strerror(err));
181 return err;
182 }
183
184@@ -747,7 +747,7 @@ static int unsuspend(struct userdata *u) {
185 SND_PCM_NO_AUTO_RESAMPLE|
186 SND_PCM_NO_AUTO_CHANNELS|
187 SND_PCM_NO_AUTO_FORMAT)) < 0) {
188- pa_log("Error opening PCM device %s: %s", u->device_name, snd_strerror(err));
189+ pa_log("Error opening PCM device %s: %s", u->device_name, pa_alsa_strerror(err));
190 goto fail;
191 }
192
193@@ -758,7 +758,7 @@ static int unsuspend(struct userdata *u) {
194 d = u->use_tsched;
195
196 if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &nfrags, &period_size, u->hwbuf_size / u->frame_size, &b, &d, TRUE)) < 0) {
197- pa_log("Failed to set hardware parameters: %s", snd_strerror(err));
198+ pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err));
199 goto fail;
200 }
201
202@@ -988,7 +988,7 @@ static void source_get_volume_cb(pa_source *s) {
203 return;
204
205 fail:
206- pa_log_error("Unable to read volume: %s", snd_strerror(err));
207+ pa_log_error("Unable to read volume: %s", pa_alsa_strerror(err));
208 }
209
210 static void source_set_volume_cb(pa_source *s) {
211@@ -1100,7 +1100,7 @@ static void source_set_volume_cb(pa_source *s) {
212 return;
213
214 fail:
215- pa_log_error("Unable to set volume: %s", snd_strerror(err));
216+ pa_log_error("Unable to set volume: %s", pa_alsa_strerror(err));
217 }
218
219 static void source_get_mute_cb(pa_source *s) {
220@@ -1111,7 +1111,7 @@ static void source_get_mute_cb(pa_source *s) {
221 pa_assert(u->mixer_elem);
222
223 if ((err = snd_mixer_selem_get_capture_switch(u->mixer_elem, 0, &sw)) < 0) {
224- pa_log_error("Unable to get switch: %s", snd_strerror(err));
225+ pa_log_error("Unable to get switch: %s", pa_alsa_strerror(err));
226 return;
227 }
228
229@@ -1126,7 +1126,7 @@ static void source_set_mute_cb(pa_source *s) {
230 pa_assert(u->mixer_elem);
231
232 if ((err = snd_mixer_selem_set_capture_switch_all(u->mixer_elem, !s->muted)) < 0) {
233- pa_log_error("Unable to set switch: %s", snd_strerror(err));
234+ pa_log_error("Unable to set switch: %s", pa_alsa_strerror(err));
235 return;
236 }
237 }
238@@ -1218,7 +1218,7 @@ static void thread_func(void *userdata) {
239 pollfd = pa_rtpoll_item_get_pollfd(u->alsa_rtpoll_item, &n);
240
241 if ((err = snd_pcm_poll_descriptors_revents(u->pcm_handle, pollfd, n, &revents)) < 0) {
242- pa_log("snd_pcm_poll_descriptors_revents() failed: %s", snd_strerror(err));
243+ pa_log("snd_pcm_poll_descriptors_revents() failed: %s", pa_alsa_strerror(err));
244 goto fail;
245 }
246
247diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c
248index d2dc6e8..ddc3c77 100644
249--- a/src/modules/alsa/alsa-util.c
250+++ b/src/modules/alsa/alsa-util.c
251@@ -33,6 +33,7 @@
252 #include <pulse/timeval.h>
253 #include <pulse/util.h>
254 #include <pulse/i18n.h>
255+#include <pulse/utf8.h>
256
257 #include <pulsecore/log.h>
258 #include <pulsecore/macro.h>
259@@ -40,6 +41,7 @@
260 #include <pulsecore/atomic.h>
261 #include <pulsecore/core-error.h>
262 #include <pulsecore/once.h>
263+#include <pulsecore/thread.h>
264
265 #include "alsa-util.h"
266
267@@ -106,7 +108,7 @@ static void io_cb(pa_mainloop_api*a, pa_io_event* e, int fd, pa_io_event_flags_t
268 pa_assert(i != fdl->num_fds);
269
270 if ((err = snd_mixer_poll_descriptors_revents(fdl->mixer, fdl->work_fds, fdl->num_fds, &revents)) < 0) {
271- pa_log_error("Unable to get poll revent: %s", snd_strerror(err));
272+ pa_log_error("Unable to get poll revent: %s", pa_alsa_strerror(err));
273 return;
274 }
275
276@@ -129,7 +131,7 @@ static void defer_cb(pa_mainloop_api*a, pa_defer_event* e, void *userdata) {
277 a->defer_enable(fdl->defer, 0);
278
279 if ((n = snd_mixer_poll_descriptors_count(fdl->mixer)) < 0) {
280- pa_log("snd_mixer_poll_descriptors_count() failed: %s", snd_strerror(n));
281+ pa_log("snd_mixer_poll_descriptors_count() failed: %s", pa_alsa_strerror(n));
282 return;
283 }
284 num_fds = (unsigned) n;
285@@ -146,7 +148,7 @@ static void defer_cb(pa_mainloop_api*a, pa_defer_event* e, void *userdata) {
286 memset(fdl->work_fds, 0, sizeof(struct pollfd) * num_fds);
287
288 if ((err = snd_mixer_poll_descriptors(fdl->mixer, fdl->work_fds, num_fds)) < 0) {
289- pa_log_error("Unable to get poll descriptors: %s", snd_strerror(err));
290+ pa_log_error("Unable to get poll descriptors: %s", pa_alsa_strerror(err));
291 return;
292 }
293
294@@ -482,42 +484,42 @@ int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min) {
295 snd_pcm_sw_params_alloca(&swparams);
296
297 if ((err = snd_pcm_sw_params_current(pcm, swparams) < 0)) {
298- pa_log_warn("Unable to determine current swparams: %s\n", snd_strerror(err));
299+ pa_log_warn("Unable to determine current swparams: %s\n", pa_alsa_strerror(err));
300 return err;
301 }
302
303 if ((err = snd_pcm_sw_params_set_period_event(pcm, swparams, 0)) < 0) {
304- pa_log_warn("Unable to disable period event: %s\n", snd_strerror(err));
305+ pa_log_warn("Unable to disable period event: %s\n", pa_alsa_strerror(err));
306 return err;
307 }
308
309 if ((err = snd_pcm_sw_params_set_tstamp_mode(pcm, swparams, SND_PCM_TSTAMP_ENABLE)) < 0) {
310- pa_log_warn("Unable to enable time stamping: %s\n", snd_strerror(err));
311+ pa_log_warn("Unable to enable time stamping: %s\n", pa_alsa_strerror(err));
312 return err;
313 }
314
315 if ((err = snd_pcm_sw_params_get_boundary(swparams, &boundary)) < 0) {
316- pa_log_warn("Unable to get boundary: %s\n", snd_strerror(err));
317+ pa_log_warn("Unable to get boundary: %s\n", pa_alsa_strerror(err));
318 return err;
319 }
320
321 if ((err = snd_pcm_sw_params_set_stop_threshold(pcm, swparams, boundary)) < 0) {
322- pa_log_warn("Unable to set stop threshold: %s\n", snd_strerror(err));
323+ pa_log_warn("Unable to set stop threshold: %s\n", pa_alsa_strerror(err));
324 return err;
325 }
326
327 if ((err = snd_pcm_sw_params_set_start_threshold(pcm, swparams, (snd_pcm_uframes_t) -1)) < 0) {
328- pa_log_warn("Unable to set start threshold: %s\n", snd_strerror(err));
329+ pa_log_warn("Unable to set start threshold: %s\n", pa_alsa_strerror(err));
330 return err;
331 }
332
333 if ((err = snd_pcm_sw_params_set_avail_min(pcm, swparams, avail_min)) < 0) {
334- pa_log_error("snd_pcm_sw_params_set_avail_min() failed: %s", snd_strerror(err));
335+ pa_log_error("snd_pcm_sw_params_set_avail_min() failed: %s", pa_alsa_strerror(err));
336 return err;
337 }
338
339 if ((err = snd_pcm_sw_params(pcm, swparams)) < 0) {
340- pa_log_warn("Unable to set sw params: %s\n", snd_strerror(err));
341+ pa_log_warn("Unable to set sw params: %s\n", pa_alsa_strerror(err));
342 return err;
343 }
344
345@@ -854,7 +856,7 @@ snd_pcm_t *pa_alsa_open_by_device_string(
346 SND_PCM_NO_AUTO_RESAMPLE|
347 SND_PCM_NO_AUTO_CHANNELS|
348 (reformat ? 0 : SND_PCM_NO_AUTO_FORMAT))) < 0) {
349- pa_log_info("Error opening PCM device %s: %s", d, snd_strerror(err));
350+ pa_log_info("Error opening PCM device %s: %s", d, pa_alsa_strerror(err));
351 goto fail;
352 }
353
354@@ -882,7 +884,7 @@ snd_pcm_t *pa_alsa_open_by_device_string(
355 continue;
356 }
357
358- pa_log_info("Failed to set hardware parameters on %s: %s", d, snd_strerror(err));
359+ pa_log_info("Failed to set hardware parameters on %s: %s", d, pa_alsa_strerror(err));
360 snd_pcm_close(pcm_handle);
361
362 goto fail;
363@@ -1000,17 +1002,17 @@ int pa_alsa_prepare_mixer(snd_mixer_t *mixer, const char *dev) {
364 pa_assert(dev);
365
366 if ((err = snd_mixer_attach(mixer, dev)) < 0) {
367- pa_log_info("Unable to attach to mixer %s: %s", dev, snd_strerror(err));
368+ pa_log_info("Unable to attach to mixer %s: %s", dev, pa_alsa_strerror(err));
369 return -1;
370 }
371
372 if ((err = snd_mixer_selem_register(mixer, NULL, NULL)) < 0) {
373- pa_log_warn("Unable to register mixer: %s", snd_strerror(err));
374+ pa_log_warn("Unable to register mixer: %s", pa_alsa_strerror(err));
375 return -1;
376 }
377
378 if ((err = snd_mixer_load(mixer)) < 0) {
379- pa_log_warn("Unable to load mixer: %s", snd_strerror(err));
380+ pa_log_warn("Unable to load mixer: %s", pa_alsa_strerror(err));
381 return -1;
382 }
383
384@@ -1136,7 +1138,7 @@ int pa_alsa_find_mixer_and_elem(
385 }
386
387 if ((err = snd_mixer_open(&m, 0)) < 0) {
388- pa_log("Error opening mixer: %s", snd_strerror(err));
389+ pa_log("Error opening mixer: %s", pa_alsa_strerror(err));
390 return -1;
391 }
392
393@@ -1338,7 +1340,7 @@ void pa_alsa_dump(pa_log_level_t level, snd_pcm_t *pcm) {
394 pa_assert_se(snd_output_buffer_open(&out) == 0);
395
396 if ((err = snd_pcm_dump(pcm, out)) < 0)
397- pa_logl(level, "snd_pcm_dump(): %s", snd_strerror(err));
398+ pa_logl(level, "snd_pcm_dump(): %s", pa_alsa_strerror(err));
399 else {
400 char *s = NULL;
401 snd_output_buffer_string(out, &s);
402@@ -1362,7 +1364,7 @@ void pa_alsa_dump_status(snd_pcm_t *pcm) {
403 pa_assert_se(snd_pcm_status(pcm, status) == 0);
404
405 if ((err = snd_pcm_status_dump(status, out)) < 0)
406- pa_log_debug("snd_pcm_dump(): %s", snd_strerror(err));
407+ pa_log_debug("snd_pcm_dump(): %s", pa_alsa_strerror(err));
408 else {
409 char *s = NULL;
410 snd_output_buffer_string(out, &s);
411@@ -1524,7 +1526,7 @@ void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm, snd_m
412 snd_pcm_info_alloca(&info);
413
414 if ((err = snd_pcm_hw_params_current(pcm, hwparams)) < 0)
415- pa_log_warn("Error fetching hardware parameter info: %s", snd_strerror(err));
416+ pa_log_warn("Error fetching hardware parameter info: %s", pa_alsa_strerror(err));
417 else {
418
419 if ((bits = snd_pcm_hw_params_get_sbits(hwparams)) >= 0)
420@@ -1535,7 +1537,7 @@ void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm, snd_m
421 pa_proplist_sets(p, "alsa.mixer_element", snd_mixer_selem_get_name(elem));
422
423 if ((err = snd_pcm_info(pcm, info)) < 0)
424- pa_log_warn("Error fetching PCM info: %s", snd_strerror(err));
425+ pa_log_warn("Error fetching PCM info: %s", pa_alsa_strerror(err));
426 else
427 pa_alsa_init_proplist_pcm_info(c, p, info);
428 }
429@@ -1568,14 +1570,14 @@ int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) {
430
431 case SND_PCM_STATE_XRUN:
432 if ((err = snd_pcm_recover(pcm, -EPIPE, 1)) != 0) {
433- pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and XRUN: %s", snd_strerror(err));
434+ pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and XRUN: %s", pa_alsa_strerror(err));
435 return -1;
436 }
437 break;
438
439 case SND_PCM_STATE_SUSPENDED:
440 if ((err = snd_pcm_recover(pcm, -ESTRPIPE, 1)) != 0) {
441- pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and SUSPENDED: %s", snd_strerror(err));
442+ pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP and SUSPENDED: %s", pa_alsa_strerror(err));
443 return -1;
444 }
445 break;
446@@ -1585,7 +1587,7 @@ int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents) {
447 snd_pcm_drop(pcm);
448
449 if ((err = snd_pcm_prepare(pcm)) < 0) {
450- pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP with snd_pcm_prepare(): %s", snd_strerror(err));
451+ pa_log_warn("Could not recover from POLLERR|POLLNVAL|POLLHUP with snd_pcm_prepare(): %s", pa_alsa_strerror(err));
452 return -1;
453 }
454 break;
455@@ -1602,7 +1604,7 @@ pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll) {
456 pa_assert(pcm);
457
458 if ((n = snd_pcm_poll_descriptors_count(pcm)) < 0) {
459- pa_log("snd_pcm_poll_descriptors_count() failed: %s", snd_strerror(n));
460+ pa_log("snd_pcm_poll_descriptors_count() failed: %s", pa_alsa_strerror(n));
461 return NULL;
462 }
463
464@@ -1610,7 +1612,7 @@ pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll) {
465 pollfd = pa_rtpoll_item_get_pollfd(item, NULL);
466
467 if ((err = snd_pcm_poll_descriptors(pcm, pollfd, (unsigned) n)) < 0) {
468- pa_log("snd_pcm_poll_descriptors() failed: %s", snd_strerror(err));
469+ pa_log("snd_pcm_poll_descriptors() failed: %s", pa_alsa_strerror(err));
470 pa_rtpoll_item_free(item);
471 return NULL;
472 }
473@@ -1819,3 +1821,30 @@ pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm) {
474
475 return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM;
476 }
477+
478+PA_STATIC_TLS_DECLARE(cstrerror, pa_xfree);
479+
480+const char* pa_alsa_strerror(int errnum) {
481+ const char *original = NULL;
482+ char *translated, *t;
483+ char errbuf[128];
484+
485+ if ((t = PA_STATIC_TLS_GET(cstrerror)))
486+ pa_xfree(t);
487+
488+ original = snd_strerror(errnum);
489+
490+ if (!original) {
491+ pa_snprintf(errbuf, sizeof(errbuf), "Unknown error %i", errnum);
492+ original = errbuf;
493+ }
494+
495+ if (!(translated = pa_locale_to_utf8(original))) {
496+ pa_log_warn("Unable to convert error string to locale, filtering.");
497+ translated = pa_utf8_filter(original);
498+ }
499+
500+ PA_STATIC_TLS_SET(cstrerror, translated);
501+
502+ return translated;
503+}
504diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h
505index c8acc7c..77ac8a7 100644
506--- a/src/modules/alsa/alsa-util.h
507+++ b/src/modules/alsa/alsa-util.h
508@@ -146,4 +146,6 @@ pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm);
509
510 pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm);
511
512+const char* pa_alsa_strerror(int errnum);
513+
514 #endif
515diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
516index fdc952d..51d466e 100644
517--- a/src/modules/alsa/module-alsa-card.c
518+++ b/src/modules/alsa/module-alsa-card.c
519@@ -304,7 +304,7 @@ int pa__init(pa_module *m) {
520 u->modargs = ma;
521
522 if ((alsa_card_index = snd_card_get_index(u->device_id)) < 0) {
523- pa_log("Card '%s' doesn't exist: %s", u->device_id, snd_strerror(alsa_card_index));
524+ pa_log("Card '%s' doesn't exist: %s", u->device_id, pa_alsa_strerror(alsa_card_index));
525 goto fail;
526 }
527