Bug 85987

Summary: X bell is not re-enabled after pulseaudio exits / x11-beel is unloaded (XkbSetAutoResetControls)
Product: PulseAudio Reporter: Daniel Hahler <freedesktop-bugs>
Component: modulesAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Daniel Hahler 2014-11-07 04:32:24 UTC
The following code is used in src/modules/x11/module-x11-bell.c to disable the audible bell:

 > XkbChangeEnabledControls(pa_x11_wrapper_get_display(u->x11_wrapper), XkbUseCoreKbd, XkbAudibleBellMask, 0);

..after the following code, which is meant to re-enable/reset it after the X client quits:

 > auto_ctrls = auto_values = XkbAudibleBellMask;
 > XkbSetAutoResetControls(pa_x11_wrapper_get_display(u->x11_wrapper), XkbAudibleBellMask, &auto_ctrls, &auto_values);


But this either has a bug somewhere or just does not work as expected.

I am not sure where / how the (wrapped) X client is supposed to get closed. 


TEST CASE:
1. Add "autospawn=no" to ~/.pulse/client.conf
2. Kill pulseaudio: pulseaudio -k
3. Start a new X session, and/or make sure that the audible bell is enabled, e.g. "xset b 100". You can use printf '\a' in a terminal to trigger it.
4. Start pulseaudio and load the x11-bell module:
   > pactl load-module module-x11-bell sample=bell.ogg
   > pactl upload-sample /usr/share/sounds/gnome/default/alerts/glass.ogg bell.ogg

5. The bell should either get routed through PA now (if you have a "bell" sample uploaded), fallback to the speaker or you will hear nothing (Bug 58930).
6. Unload the module again:
   > pactl unload-module module-x11-bell

EXPECTED:
Now the default X bell should be enabled again.

ACTUAL RESULT:
Nothing happens on a bell event now: pulseaudio is stopped and the previous state has not been restored.


A workaround is to (unconditionally) enable the X bell again when the x11-bell module gets unloaded, but then it might get enabled, although it wasn't before:

    XkbChangeEnabledControls(pa_x11_wrapper_get_display(u->x11_wrapper), XkbUseCoreKbd, XkbAudibleBellMask, XkbAudibleBellMask);
Comment 1 GitLab Migration User 2018-07-30 09:54:19 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/111.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.