Your message dated Wed, 09 Jan 2008 15:56:38 +0100
with message-id <[EMAIL PROTECTED]>
and subject line [Pkg-xfce-devel] Bug#268901: xfce4-mixer: should close mixer 
device
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: xfce4-mixer
Version: 4.0.6-1
Severity: minor
Tags: patch

Hi,
it'd be nice if the plugin would close the mixer device between
reads/writes, since this allows the sound module to be unloaded during
suspend/resume on laptops. Attached patch does this for oss.
Cheers,
 -- Guido


-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.9-rc1-albook12
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8

Versions of packages xfce4-mixer depends on:
ii  libatk1.0-0               1.6.1-3        The ATK accessibility toolkit
hi  libc6                     2.3.2.ds1-16   GNU C Library: Shared libraries an
ii  libglib2.0-0              2.4.6-2        The GLib library of C routines
ii  libgtk2.0-0               2.4.9-1        The GTK+ graphical user interface 
ii  libice6                   4.3.0.dfsg.1-6 Inter-Client Exchange library
ii  libpango1.0-0             1.4.1-2        Layout and rendering of internatio
ii  libsm6                    4.3.0.dfsg.1-6 X Window System Session Management
ii  libstartup-notification0  0.7-1          library for program launch feedbac
ii  libx11-6                  4.3.0.dfsg.1-6 X Window System protocol client li
ii  libxext6                  4.3.0.dfsg.1-6 X Window System miscellaneous exte
ii  libxfce4util-1            4.0.6-1        Utility functions library for Xfce
ii  libxfcegui4-1             4.0.6-1        Basic GUI C functions for Xfce4
ii  libxml2                   2.6.11-3       GNOME XML library
ii  xfce4-panel               4.0.6-1        The Xfce4 desktop environment pane
hi  xlibs                     4.3.0.dfsg.1-4 X Window System client libraries m
ii  zlib1g                    1:1.2.1.1-7    compression library - runtime

-- no debconf information
diff -ubw --exclude='*.orig' --exclude='*.o' --exclude='*.ko' --exclude='*.cmd' 
--exclude='*.o' --exclude=CVS/ --exclude=.svn --exclude=debian/ -Naur 
tmp/xfce4-mixer-4.0.6/panel-plugin/vc_oss.c 
xfce4-mixer-4.0.6/panel-plugin/vc_oss.c
--- tmp/xfce4-mixer-4.0.6/panel-plugin/vc_oss.c 2004-07-08 21:12:42.000000000 
+0200
+++ xfce4-mixer-4.0.6/panel-plugin/vc_oss.c     2004-08-29 20:13:41.889940616 
+0200
@@ -86,12 +86,34 @@
 
 static char *label[SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_LABELS;
 
+static int 
+vc_open_device()
+{
+       mixer_handle = open(dev_name, O_RDWR, 0);
+       if(mixer_handle == -1) {
+           perror("Unable to open mixer device");
+           return 0;
+       }
+       return 1;
+}
+
+static void 
+vc_close_device()
+{
+       if (mixer_handle != -1) {
+               close (mixer_handle);
+               mixer_handle = -1;
+       } else {
+           perror("trying to close closed mixer device.");
+       }
+}
+
 static void
 find_master(void)
 {
        int i;
        
-       g_return_if_fail(mixer_handle != -1);
+       g_return_if_fail(vc_open_device());
 
        devmask = 0;
        master_i = -1;
@@ -114,6 +136,7 @@
                                master_i = i;
                }
        }
+       vc_close_device();
 }
 
 static void
@@ -125,7 +148,6 @@
        }
 
        g_strlcpy(dev_name, name, sizeof(dev_name) - 1);
-       mixer_handle = open(dev_name, O_RDWR, 0);
 }
 
 static int
@@ -168,7 +190,6 @@
        return -1;
 }
 
-
 /*
  * Sets volume in percent
  */
@@ -179,7 +200,7 @@
        int level;
        int i;
 
-       g_return_if_fail(mixer_handle != -1);
+       g_return_if_fail(vc_open_device());
 
        if (!which) {
                i = master_i;
@@ -193,6 +214,7 @@
 
        if (ioctl(mixer_handle, MIXER_WRITE(i), &level) < 0)
                perror("oss: Unable to set volume");
+       vc_close_device();
 }
 
 #define LEFT(lvl)      ((lvl) & 0x7f)
@@ -207,7 +229,7 @@
        int level;
        int i;
 
-       g_return_val_if_fail(mixer_handle != -1, 0);
+       g_return_val_if_fail(vc_open_device(),0);
 
        if (!which) {
                i = master_i;
@@ -223,7 +245,7 @@
                perror("oss: Unable to get volume");
                return(0);
        }
-
+       vc_close_device();
        return((((LEFT(level) + RIGHT(level)) >> 1) * 100) / MAX_AMP);
 }
 
@@ -257,14 +279,6 @@
        /* unsupported */
 }
 
-static void vc_close_device()
-{
-       master_i = -1;
-       if (mixer_handle != -1) {
-               close (mixer_handle);
-               mixer_handle = -1;
-       }
-}
 
 #define SUPPORT_LINK /* TODO: automake() this */
 #ifdef SUPPORT_LINK
@@ -305,7 +319,6 @@
 
 }
 
-
 static GList *vc_get_device_list()
 {
        GList *l;

--- End Message ---
--- Begin Message ---
On Wed, Jan 09, 2008 at 02:22:29PM +0000, Guido Guenther wrote:
> > Do you think the patch is still needed? I don't think it'll apply to 4.4
> > anyway, so it'll need a refresh.
> No you can drop it, but maybe we should more seriously deprecate the oss
> version.

oss version is still needed on non linux archs, for example. But the next
(4.6) version may be completely different, so we'll see...
-- 
Yves-Alexis


--- End Message ---
_______________________________________________
Pkg-xfce-devel mailing list
Pkg-xfce-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/mailman/listinfo/pkg-xfce-devel

Reply via email to