~ubuntu-branches/ubuntu/maverick/alsa-lib/maverick-proposed

« back to all changes in this revision

Viewing changes to debian/patches/Fix-modem-on-hook.patch

  • Committer: Bazaar Package Importer
  • Author(s): Daniel T Chen
  • Date: 2010-02-01 19:42:40 UTC
  • Revision ID: james.westby@ubuntu.com-20100201194240-cgu5cvte3q2l251c
Tags: 1.0.22-0ubuntu2
* debian/patches/:
  + Fix-modem-on-hook.patch (2e4843)
  + Fix-stream-state-updates.patch (63acb8)
  + Fix-str-lit-no-format.patch

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
5
@@ -423,6 +423,7 @@
 
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 @@
 
18
 }
 
19
 
 
20
 /**
 
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
 
25
+ */
 
26
+int snd_ctl_elem_value_compare(snd_ctl_elem_value_t *left, const snd_ctl_elem_value_t *right)
 
27
+{
 
28
+       assert(left && right);
 
29
+       return memcmp(left, right, sizeof(*left));
 
30
+}
 
31
+
 
32
+/**
 
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
 
40
@@ -192,7 +192,17 @@
 
41
                                return err;
 
42
                        }
 
43
                }
 
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
 
53
+                * recording active.
 
54
+                */
 
55
+               if (elem->preserve && snd_ctl_elem_value_compare(elem->val, elem->old)) {
 
56
                        err = snd_ctl_elem_write(h->ctl, elem->old);
 
57
                        if (err < 0) {
 
58
                                SNDERR("Cannot restore ctl elem");