mirror of
https://github.com/archlinuxarm/PKGBUILDs.git
synced 2024-11-08 22:45:43 +00:00
87 lines
3.1 KiB
Diff
87 lines
3.1 KiB
Diff
|
From 8a7423fb4b4ca9e2825251d734217df8d982ea32 Mon Sep 17 00:00:00 2001
|
||
|
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
|
||
|
Date: Fri, 26 Feb 2016 20:29:24 +0100
|
||
|
Subject: [PATCH 2/2] Revert "module-alsa-card: Report available ports before
|
||
|
unavailable ones"
|
||
|
|
||
|
This reverts commit 91313e60a81e96ce976f24c522656c57b4ab94ca.
|
||
|
---
|
||
|
src/modules/alsa/module-alsa-card.c | 31 ++++++-------------------------
|
||
|
1 file changed, 6 insertions(+), 25 deletions(-)
|
||
|
|
||
|
diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c
|
||
|
index 286cfc9..a88a83f 100644
|
||
|
--- a/src/modules/alsa/module-alsa-card.c
|
||
|
+++ b/src/modules/alsa/module-alsa-card.c
|
||
|
@@ -306,7 +306,7 @@ static void init_profile(struct userdata *u) {
|
||
|
am->source = pa_alsa_source_new(u->module, u->modargs, __FILE__, u->card, am);
|
||
|
}
|
||
|
|
||
|
-static pa_available_t calc_port_state(pa_device_port *p, struct userdata *u) {
|
||
|
+static void report_port_state(pa_device_port *p, struct userdata *u) {
|
||
|
void *state;
|
||
|
pa_alsa_jack *jack;
|
||
|
pa_available_t pa = PA_AVAILABLE_UNKNOWN;
|
||
|
@@ -350,13 +350,9 @@ static pa_available_t calc_port_state(pa_device_port *p, struct userdata *u) {
|
||
|
pa = cpa;
|
||
|
}
|
||
|
}
|
||
|
- return pa;
|
||
|
-}
|
||
|
|
||
|
-struct temp_port_avail {
|
||
|
- pa_device_port *port;
|
||
|
- pa_available_t avail;
|
||
|
-};
|
||
|
+ pa_device_port_set_available(p, pa);
|
||
|
+}
|
||
|
|
||
|
static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
|
||
|
struct userdata *u = snd_mixer_elem_get_callback_private(melem);
|
||
|
@@ -365,7 +361,7 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
|
||
|
bool plugged_in;
|
||
|
void *state;
|
||
|
pa_alsa_jack *jack;
|
||
|
- struct temp_port_avail *tp, *tports;
|
||
|
+ pa_device_port *port;
|
||
|
|
||
|
pa_assert(u);
|
||
|
|
||
|
@@ -382,8 +378,6 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
|
||
|
|
||
|
pa_log_debug("Jack '%s' is now %s", pa_strnull(snd_hctl_elem_get_name(elem)), plugged_in ? "plugged in" : "unplugged");
|
||
|
|
||
|
- tports = tp = pa_xnew0(struct temp_port_avail, pa_hashmap_size(u->jacks)+1);
|
||
|
-
|
||
|
PA_HASHMAP_FOREACH(jack, u->jacks, state)
|
||
|
if (jack->melem == melem) {
|
||
|
pa_alsa_jack_set_plugged_in(jack, plugged_in);
|
||
|
@@ -396,22 +390,9 @@ static int report_jack_state(snd_mixer_elem_t *melem, unsigned int mask) {
|
||
|
|
||
|
/* When not using UCM, we have to do the jack state -> port
|
||
|
* availability mapping ourselves. */
|
||
|
- pa_assert_se(tp->port = jack->path->port);
|
||
|
- tp->avail = calc_port_state(tp->port, u);
|
||
|
- tp++;
|
||
|
+ pa_assert_se(port = jack->path->port);
|
||
|
+ report_port_state(port, u);
|
||
|
}
|
||
|
-
|
||
|
- /* Report available ports before unavailable ones: in case port 1 becomes available when port 2 becomes unavailable,
|
||
|
- this prevents an unnecessary switch port 1 -> port 3 -> port 2 */
|
||
|
-
|
||
|
- for (tp = tports; tp->port; tp++)
|
||
|
- if (tp->avail != PA_AVAILABLE_NO)
|
||
|
- pa_device_port_set_available(tp->port, tp->avail);
|
||
|
- for (tp = tports; tp->port; tp++)
|
||
|
- if (tp->avail == PA_AVAILABLE_NO)
|
||
|
- pa_device_port_set_available(tp->port, tp->avail);
|
||
|
-
|
||
|
- pa_xfree(tports);
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
--
|
||
|
2.7.1
|
||
|
|