diff options
author | Tanu Kaskinen <tanuk@iki.fi> | 2017-03-15 20:02:48 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2017-03-17 21:57:42 +0200 |
commit | 2530eb8d1bb89ad6ffda6b18cc593bea31ec3287 (patch) | |
tree | 73d54664fb2344b836a9b852a67fb16b94accab7 | |
parent | e26a6752631d4db11b57a420b51abe36c1ef16f5 (diff) | |
download | pulseaudio-2530eb8d1bb89ad6ffda6b18cc593bea31ec3287.tar.gz |
bluetooth-policy: retain backwards compatibility
The auto_switch argument was added in PulseAudio 10.0. In that release
the argument type was boolean. The type was changed to integer in commit
3397127f00. This patch adds backwards compatibility so that old
configuration files won't break when upgrading PulseAudio to 11.0.
-rw-r--r-- | src/modules/bluetooth/module-bluetooth-policy.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c index 8d9cd0f3a..316b9a826 100644 --- a/src/modules/bluetooth/module-bluetooth-policy.c +++ b/src/modules/bluetooth/module-bluetooth-policy.c @@ -423,9 +423,22 @@ int pa__init(pa_module *m) { m->userdata = u = pa_xnew0(struct userdata, 1); u->auto_switch = 1; - if (pa_modargs_get_value_u32(ma, "auto_switch", &u->auto_switch) < 0) { - pa_log("Failed to parse auto_switch argument."); - goto fail; + + if (pa_modargs_get_value(ma, "auto_switch", NULL)) { + bool auto_switch_bool; + + /* auto_switch originally took a boolean value, let's keep + * compatibility with configuration files that still pass a boolean. */ + if (pa_modargs_get_value_boolean(ma, "auto_switch", &auto_switch_bool) >= 0) { + if (auto_switch_bool) + u->auto_switch = 1; + else + u->auto_switch = 0; + + } else if (pa_modargs_get_value_u32(ma, "auto_switch", &u->auto_switch) < 0) { + pa_log("Failed to parse auto_switch argument."); + goto fail; + } } u->enable_a2dp_source = true; |