1
Index: alsa-lib-1.0.22/include/control.h
2
===================================================================
3
--- alsa-lib-1.0.22.orig/include/control.h 2010-02-01 19:41:03.000000000 -0500
4
+++ alsa-lib-1.0.22/include/control.h 2010-02-01 19:41:20.000000000 -0500
6
void snd_ctl_elem_value_free(snd_ctl_elem_value_t *obj);
7
void snd_ctl_elem_value_clear(snd_ctl_elem_value_t *obj);
8
void snd_ctl_elem_value_copy(snd_ctl_elem_value_t *dst, const snd_ctl_elem_value_t *src);
9
+int snd_ctl_elem_value_compare(snd_ctl_elem_value_t *left, const snd_ctl_elem_value_t *right);
10
void snd_ctl_elem_value_get_id(const snd_ctl_elem_value_t *obj, snd_ctl_elem_id_t *ptr);
11
unsigned int snd_ctl_elem_value_get_numid(const snd_ctl_elem_value_t *obj);
12
snd_ctl_elem_iface_t snd_ctl_elem_value_get_interface(const snd_ctl_elem_value_t *obj);
13
Index: alsa-lib-1.0.22/src/control/control.c
14
===================================================================
15
--- alsa-lib-1.0.22.orig/src/control/control.c 2010-02-01 19:41:03.000000000 -0500
16
+++ alsa-lib-1.0.22/src/control/control.c 2010-02-01 19:41:20.000000000 -0500
17
@@ -2249,6 +2249,18 @@
21
+ * \brief compare one #snd_ctl_elem_value_t to another
22
+ * \param dst pointer to destination
23
+ * \param src pointer to source
24
+ * \return 0 on match, less than or greater than otherwise, see memcmp
26
+int snd_ctl_elem_value_compare(snd_ctl_elem_value_t *left, const snd_ctl_elem_value_t *right)
28
+ assert(left && right);
29
+ return memcmp(left, right, sizeof(*left));
33
* \brief Get CTL element identifier of a CTL element id/value
34
* \param obj CTL element id/value
35
* \param ptr Pointer to returned CTL element identifier
36
Index: alsa-lib-1.0.22/src/control/setup.c
37
===================================================================
38
--- alsa-lib-1.0.22.orig/src/control/setup.c 2010-02-01 19:41:03.000000000 -0500
39
+++ alsa-lib-1.0.22/src/control/setup.c 2010-02-01 19:41:20.000000000 -0500
44
- if (elem->preserve) {
45
+ /* Only restore the old value if it differs from the requested
46
+ * value, because if it has changed restoring the old value
47
+ * overrides the change. Take for example, a voice modem with
48
+ * a .conf that sets preserve off-hook. Start playback (on-hook
49
+ * to off-hook), start record (off-hook to off-hook), stop
50
+ * playback (off-hook to restore on-hook), stop record (on-hook
51
+ * to restore off-hook), Clearly you don't want to leave the
52
+ * modem "on the phone" now that there isn't any playback or
55
+ if (elem->preserve && snd_ctl_elem_value_compare(elem->val, elem->old)) {
56
err = snd_ctl_elem_write(h->ctl, elem->old);
58
SNDERR("Cannot restore ctl elem");