Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
i want to beep [solved]
View unanswered posts
View posts from last 24 hours

Goto page Previous  1, 2  
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Sep 23, 2016 11:24 am    Post subject: Reply with quote

oh so that's what a digital beep is? you play a media file ;)

btw i've been further testing. whether beep_mode is on or off seems to make no difference to beeps with pcspkr or snd-pcsp. i can beep with either of them loaded, but only when speaker-test is running. and i have tested with every single combination of pcspkr / snd-pcsp / snd-hda-intel beep_mode=0/1. the only combination i don't have a beep is when neither pcspkr or snd-pcsp are loaded.

why can i get beeps in other terminals, when speaker-test is running? those beeps even respect the beep control in alsamixer, immaterial of the volume level of speaker-test.
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey


Last edited by josephg on Fri Sep 23, 2016 11:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Sep 23, 2016 11:59 am    Post subject: Reply with quote

i just found a bug report from long ago piqued my curiosity, and i decided to test further.

if i suspend to disk, i get beeps for sometime, just after the system comes back. i couldn't replicate the same with suspend2ram as that bug report. but again this proves my system can beep, but something is hoilding it back.

am i the only one with this problem on gentoo?
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Fri Sep 23, 2016 4:35 pm    Post subject: Reply with quote

Well, the only other suggestion I have would be to try what this guy did:

https://forums.opensuse.org/showthread.php/427651-Problem-with-pc-internal-speaker-beep

namely, to unload manually the pcspkr module then reload it manually:

Code:
modprobe -r pcspkr
modprobe pcspkr


so that the pcspkr module is then definitely loaded after the snd_hda_intel module. If that works there are a couple of ways of automating the loading order.

Regarding the digital beep interface for the ALSA Intel HDA driver:

CONFIG_SND_HDA_INPUT_BEEP:

http://cateee.net/lkddb/web-lkddb/SND_HDA_INPUT_BEEP.html

Quote:
Say Y here to build a digital beep interface for HD-audio driver. This interface is used to generate digital beeps.


CONFIG_SND_HDA_INPUT_BEEP_MODE:

https://cateee.net/lkddb/web-lkddb/SND_HDA_INPUT_BEEP_MODE.html

Quote:
Set 0 to disable the digital beep interface for HD-audio by default. Set 1 to always enable the digital beep interface for HD-audio by default.


See the following Kernel bug report which explains in more detail how this works, and it also recommends the same work-around:

https://bugzilla.kernel.org/show_bug.cgi?id=13651
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Sep 23, 2016 9:12 pm    Post subject: Reply with quote

Fitzcarraldo wrote:
Well, the only other suggestion I have would be to try what this guy did:

https://forums.opensuse.org/showthread.php/427651-Problem-with-pc-internal-speaker-beep

namely, to unload manually the pcspkr module then reload it manually:

Code:
modprobe -r pcspkr
modprobe pcspkr


so that the pcspkr module is then definitely loaded after the snd_hda_intel module. If that works there are a couple of ways of automating the loading order.


Sorry it doesn't work. I have tried multiple times.

I have now also tried all permutations of these two drivers - snd-hda-intel and pcspkr. I only get beeps when both are loaded (order doesn't seem to make any difference), if speaker-test is running and for a brief interval later.

I can interchange pcspkr with snd-pcsp, with the same above results. Only in this case, snd-pcsp needs to be the second card, not the first. I can set that in /etc/modprobe.d/ to load later, if only I can get this working.

Fitzcarraldo wrote:
Regarding the digital beep interface for the ALSA Intel HDA driver:

CONFIG_SND_HDA_INPUT_BEEP:

http://cateee.net/lkddb/web-lkddb/SND_HDA_INPUT_BEEP.html

Quote:
Say Y here to build a digital beep interface for HD-audio driver. This interface is used to generate digital beeps.


CONFIG_SND_HDA_INPUT_BEEP_MODE:

https://cateee.net/lkddb/web-lkddb/SND_HDA_INPUT_BEEP_MODE.html

Quote:
Set 0 to disable the digital beep interface for HD-audio by default. Set 1 to always enable the digital beep interface for HD-audio by default.


See the following Kernel bug report which explains in more detail how this works, and it also recommends the same work-around:

https://bugzilla.kernel.org/show_bug.cgi?id=13651


In my case, SND_HDA_INPUT_BEEP doesn't seem to make any difference whether it is there or not in the kernel config, and registering digital beep or not. I have recompiled my kernel with and without for each combination.
I can only get beeps with either pcspkr or snd-pcsp loaded, when speaker-test runs and for a brief while later.
I can also get some beeps for a very brief time interval, after the laptop resumes from hibernation. I wrote a small shell script to continue beeping, to test this.

Thank you for continuing to help me. I can't think of anything else, short of shaking those kernel guys. I seem to see a lot of loud upset users banging their drums because their beeps were too loud and they couldn't(?) turn them off :/ It seems the devs have gone all out to remove the beep from wherever they could.
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Fri Sep 23, 2016 9:25 pm    Post subject: Reply with quote

Looks like your only option is to go for the digital beep method described in my earlier post:

https://forums.gentoo.org/viewtopic-p-7968726.html#7968726

Although I listed the procedure I used for my KDE installation, the link I gave in that post is for GNOME, as is the link that he gave in turn:

http://tjworld.net/wiki/Linux/Ubuntu/XandGnomeSystemBeepWithAudioFile

So the basic principle is the same whatever the DE.
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Sep 23, 2016 10:19 pm    Post subject: Reply with quote

ok i think that's what i'll do as you suggest. but i don't use any de :roll: just a wm called i3. hopefully, i may not need to pull in any of the kde or gnome dependencies. i actually have gnome masked, as i really don't want it.. it seems everything starts from there.
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Sep 23, 2016 10:27 pm    Post subject: Reply with quote

seems even simpler without a de! i'll let you know how it goes. i'm recompiling my kernel to add that digital beep registration automatic.
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Sep 23, 2016 11:38 pm    Post subject: Reply with quote

Fitzcarraldo wrote:
Looks like your only option is to go for the digital beep method described in my earlier post:

https://forums.gentoo.org/viewtopic-p-7968726.html#7968726

thank you Fitzcarraldo for your patience and persistence with me :) i hear the digital beep. this bell.oga sounds quite nice too, although i can't quite control it like the beep volume. but finally..

i have a beep!
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey


Last edited by josephg on Mon Sep 26, 2016 11:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
dantrell
l33t
l33t


Joined: 01 Jun 2007
Posts: 915
Location: Earth

PostPosted: Mon Sep 26, 2016 10:53 pm    Post subject: Reply with quote

josephg wrote:
i can't beep.. i want to beep! i've gone through [...], and done those things.. i still can't beep :(

This thread was entertaining from start to finish.

The whole time I was thinking, "someone get this man a beep".

josephg wrote:
i have a beep!

Glad to hear things worked out. :lol:
_________________
Dantrell B.
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Wed Sep 28, 2016 10:14 am    Post subject: Reply with quote

haha mi'lord we exist to serve.. ;) your entertainment is our pleasure!
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Thu Sep 29, 2016 3:56 am    Post subject: Reply with quote

I have written a couple of blog posts discussing in depth how to get beeps in a VT and in X Windows:

To beep, or not to beep, that is the question

Another look at beeps in Linux

As explained in the second of these, my Clevo W230SS laptop emulates a PC Speaker via its sound card (VIA VT1802S codec chip) and I am able to configure the kernel so the laptop's sound card emits a beep (I'll call it a 'pcbeep' to differentiate it) when a BEL character or Backspace occurs in a VT. This works irrespective of whether or not I have CONFIG_SND_HDA_INPUT_BEEP=Y and CONFIG_SND_HDA_INPUT_BEEP_MODE=1 or CONFIG_SND_HDA_INPUT_BEEP=N.

However, no pcbeep is emitted when a BEL character or Backspace occurs in X Windows, so I still need to use the XKB Event Daemon method with bell.oga (or other audio file) in order to get a beep in X Windows.

If someone uses X Windows all the time and needs a beep, I recommend they forget the kernel and just use the XKB Event Daemon method with an audio file. It's reliable (unless you use KDE's terminals, which have a bug!).
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Wed Oct 05, 2016 5:07 am    Post subject: Reply with quote

Fitzcarraldo, i think i have tried all sorts of permutations wrt pcspkr and snd-pcsp and i can't get either to emit an audible beep, as per my previous posts on this thread. is there some way i could debug to find out if anything might be happening or not behind the scenes?
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey


Last edited by josephg on Wed Oct 05, 2016 3:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Wed Oct 05, 2016 11:17 am    Post subject: Reply with quote

So you lost the beep?

run as root in terminal:
dmesg -w
... then do something that should result in beep. Does any new lines appear in terminal? (ctrl-c to terminate)

Also what does
run as root in terminal:
dmesg | grep pcsp
... print out?
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Wed Oct 05, 2016 3:26 pm    Post subject: Reply with quote

Zucca wrote:
So you lost the beep?

thank you Zucca, my tty doesn't beep. i can only simulate beep in x via digital beep. i was replying back to Fitzcarraldo who posted a few links to try get those modules to work.

my digital beeps are still working, but i can't control the volume via the beep controls. i would like/prefer to get speaker beep rather than digital beep loading an audio player each time to play a sound file. but i guess, this is better than nothing.

Zucca wrote:
run as root in terminal:
dmesg -w
... then do something that should result in beep. Does any new lines appear in terminal? (ctrl-c to terminate)

no new lines appear. the last few lines are:
Code:
[   28.927107] snd_hda_intel 0000:00:1b.0: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.
[  119.565553] [drm:intel_cpu_fifo_underrun_irq_handler [i915]] *ERROR* CPU pipe A FIFO underrun
[ 1263.814265] BTRFS warning (device sda7): block group 19443744768 has wrong amount of free space
[ 1263.814278] BTRFS warning (device sda7): failed to load free space cache for block group 19443744768, rebuilding it now


Zucca wrote:
Also what does
run as root in terminal:
dmesg | grep pcsp
... print out?

nothing, since i blacklisted both pcspkr and snd-pcsp. i manually modprobe either just before testing.

btw, i ran a script on tty2 to beep every two seconds. i am logged in to x on tty1. whenever my audio gets activated, i.e. when i play a video or audio file, i can hear tty2 beeping. it continues beeping for about 5-10 seconds after my audio/video stops playing in x.

this behaviour is the same, whether pcspkr or snd-pcsp is loaded. i also get a few beeps just after my laptop wakes up from hibernate.
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey


Last edited by josephg on Thu Oct 06, 2016 1:22 pm; edited 1 time in total
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Thu Oct 06, 2016 11:56 am    Post subject: Reply with quote

I think we can state with certainty that your laptop does not have a PC Speaker. However, if you are hearing a pcbeep via the sound card sometimes then your laptop appears to be emulating a PC Speaker via its soundcard. This is how most (all?) laptops do it. For example, my Clevo laptop uses the Intel HDA sound card to emulate a PC Speaker.

To rectify the following Intel HDA error message in your dmesg output:

Code:
snd_hda_intel 0000:00:1b.0: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.


see the following U&L Stack Exchange thread:

http://unix.stackexchange.com/questions/203792/bdl-pos-adj-set-irq-timing-workaround-for-hda-intel

...although I don't think that issue is the reason you cannot hear a pcbeep. Nevertheless, you should fix it, if for no other reason than to rule it out.


Please show us your current hardware and software details:

1. Who is the manufacturer of your laptop?

2. What is the precise model of your laptop?

3. What does the laptop's service manual show for the audio codec chip and circuit?

4. Post the current full output of the following commands:

Code:
# uname -a
# lspci -v
# lsmod
# aplay -l
# aplay -L
# cat /proc/asound/card0/codec#* | grep Codec
# cat /proc/asound/card1/codec#* | grep Codec
# cat /proc/asound/card2/codec#* | grep Codec


5. Disable power-saving mode for the sound card, to see if that has an impact.

https://wiki.gentoo.org/wiki/Power_management/Soundcard

If you built the Intel HDA driver into the kernel then you'll have to either rebuild the kernel or set a kernel quirk in grub.cfg. If you built the Intel HDA driver as a module then you can set an option in a file in the /etc/modprobe.d/ directory. You can also try via sysfs:

http://askubuntu.com/questions/97868/intel-hd-audio-codec-power-management

On my Clevo laptop the Intel HDA power management is not an impediment to playing pcbeeps:

Code:
fitzcarraldo@clevow230ss ~ $ cat /sys/module/snd_hda_intel/parameters/power_save_controller
Y
fitzcarraldo@clevow230ss ~ $ cat /sys/module/snd_hda_intel/parameters/power_save
0


...but perhaps it is in your case. I doubt it, but am slightly suspicious because you stated that pcbeeps cease a short while after music stops playing.

6. Check all the audio-related options in your kernel configuration. I chose to build ALSA and the Intel HDA driver into the kernel, but I show the relevant options in my kernel configuration file in case they are of any help:

Code:
fitzcarraldo@clevow230ss ~ $ uname -r
3.18.11-gentoo
fitzcarraldo@clevow230ss ~ $ grep SND /usr/src/linux/.config | grep -v ^#
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=y
CONFIG_SND_RAWMIDI=m
CONFIG_SND_JACK=y
CONFIG_SND_SEQUENCER=y
CONFIG_SND_SEQ_DUMMY=y
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_SND_HRTIMER=y
CONFIG_SND_SEQ_HRTIMER_DEFAULT=y
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_MAX_CARDS=32
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_VMASTER=y
CONFIG_SND_KCTL_JACK=y
CONFIG_SND_DMA_SGBUF=y
CONFIG_SND_RAWMIDI_SEQ=m
CONFIG_SND_DRIVERS=y
CONFIG_SND_PCSP=m
CONFIG_SND_VIRMIDI=m
CONFIG_SND_PCI=y
CONFIG_SND_HDA=y
CONFIG_SND_HDA_INTEL=y
CONFIG_SND_HDA_PREALLOC_SIZE=2048
CONFIG_SND_HDA_HWDEP=y
CONFIG_SND_HDA_RECONFIG=y
CONFIG_SND_HDA_INPUT_JACK=y
CONFIG_SND_HDA_PATCH_LOADER=y
CONFIG_SND_HDA_CODEC_VIA=y
CONFIG_SND_HDA_CODEC_HDMI=y
CONFIG_SND_HDA_I915=y
CONFIG_SND_HDA_GENERIC=y
CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0
CONFIG_SND_USB=y
fitzcarraldo@clevow230ss ~ $ grep INTEL /usr/src/linux/.config | grep -v ^#
CONFIG_PERF_EVENTS_INTEL_UNCORE=y
CONFIG_CPU_SUP_INTEL=y
CONFIG_X86_MCE_INTEL=y
CONFIG_MICROCODE_INTEL=y
CONFIG_MICROCODE_INTEL_EARLY=y
CONFIG_AGP_INTEL=y
CONFIG_INTEL_GTT=y
CONFIG_SND_HDA_INTEL=y
CONFIG_CRYPTO_AES_NI_INTEL=y
fitzcarraldo@clevow230ss ~ $


7. Check the PC Speaker settings in your kernel configuration and module options file. Remember that the latter only has an effect if you built the driver as a module rather than into the kernel. If you built the driver into the kernel instead of as a module, then you would need to use a quirk in grub.cfg instead. Anyway, the applicable setting in my installation are shown below for reference:

Code:
fitzcarraldo@clevow230ss ~ $ grep PCSP /usr/src/linux/.config
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_INPUT_PCSPKR=m
CONFIG_SND_PCSP=m
fitzcarraldo@clevow230ss ~ $ grep BEEP /usr/src/linux/.config
# CONFIG_SND_HDA_INPUT_BEEP is not set
fitzcarraldo@clevow230ss ~ $


Code:
fitzcarraldo@clevow230ss ~ $ cat /etc/modprobe.d/blacklist.conf
#blacklist pcspkr
blacklist snd-pcsp
fitzcarraldo@clevow230ss ~ $


Code:
fitzcarraldo@clevow230ss ~ $ grep -i pcsp /etc/modprobe.d/alsa.conf
# Only needed if you are using the snd-pcsp module (which I don't use)
# See Kernel Help text for CONFIG_SND_PCSP
options snd-pcsp index=2


8. Although I don't even need to have Beep Mode enabled in order to hear (emulated) pcbeeps, apparently this guy had to have it enabled and CONFIG_SND_HDA_INPUT_BEEP_MODE set to 1 in order get a pcbeep in Ubuntu:

https://bugs.launchpad.net/ubuntu/+source/beep/+bug/144022/comments/18

Code:
options snd-hda-intel power_save=10 power_save_controller=Y index=0 beep_mode=1


Mind you, he changed the Intel HDA power-saving settings at the same time (you can also see from his post that he enabled Intel HDA power-saving with a 10-second time-out), so he could be mistaken. Also, notice that he stated that CONFIG_SND_HDA_INPUT_BEEP_MODE is 1 by default. However, I had a look at the kernel configuration in Ubuntu 14.04 and it has CONFIG_SND_HDA_INPUT_BEEP=Y and CONFIG_SND_HDA_INPUT_BEEP_MODE=0, so the Ubuntu developers changed the default and therefore he's mistaken regarding that.

Anyway, as you can see further up, I didn't need to have CONFIG_SND_HDA_INPUT_BEEP enabled.

9. Note that pcbeeps only play on VTs (TTYs). To hear a pcbeep -- as distinct from a beep triggered by using the XKB Event Daemon -- from within X Windows, I have to do any of the following in Konsole/xterm/Eterm or other X Windows terminal program:

From my user account:
Code:
fitzcarraldo@clevow230ss ~ $ sudo su -c "echo -e '\a' > /dev/console"
fitzcarraldo@clevow230ss ~ $ sudo su -c "tput bel > /dev/console"
fitzcarraldo@clevow230ss ~ $ sudo su -c "beep" # You need to have app-misc/beep installed for this to work.

As root user:
Code:
clevow230ss fitzcarraldo # echo -e '\a' > /dev/console
clevow230ss fitzcarraldo # tput bel > /dev/console
clevow230ss fitzcarraldo # beep > /dev/console


(Note that the pitch of the pcbeep issued by the beep command is different to the pitch of the pcbeep for the other two because the beep utility is tunable and presumably has different defaults.)
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Thu Oct 06, 2016 5:13 pm    Post subject: Reply with quote

thank you Zucca for the prompt :)

and Fitzcarraldo, you are my beep angel :D each time i've had enough of this issue and give up, you turn up pressing me on and adding some more ideas into my head.

it was that reference to the ubuntu guy which sent me down the path to resolving my issue. i had enabled power save with a timeout. nothing wrong with powersave, but something is not right with the timeout. hence why, i would get beeps and then the beeps would stop after that timeout. if some other audio/video program used the sound card, i would start getting beeps again for some time. i tested this, by running a loop to beep in another terminal.

it seems the system beep event does not wake up my sound card. if my sound card goes to sleep, my pcspkr beep is not heard.

so now that we've identified the issue, the resolution was to increase the timeout or zap it. powersave is important to me, and so i always keep it enable, even when connected to a power source. i keep my system lean & mean enough to have loads of cpu/memory left over to not bother too much about performance. but battery is limited, and i'm always bothered about powersave and eeking just a bit more..

i build everything as modules, so i can always switch them about. i have tested with pcspkr and snd-pcsp. they both give me beeps on the tty and in x!!

now i don't need that digital beep anymore, and so have taken it out. pcspkr works (as does snd-pcsp) as expected everywhere (on tty or x) the same way. i can mute/increase/decrease beep volume via the beep control in alsamixer, independently of my audio volume. which is exactly as i wanted, and how it should be.

moral of the story: never ignore any warnings, however remotely you think they might link to your problem!

Fitzcarraldo wrote:
To rectify the following Intel HDA error message in your dmesg output:

Code:
snd_hda_intel 0000:00:1b.0: IRQ timing workaround is activated for card #0. Suggest a bigger bdl_pos_adj.

Fitzcarraldo wrote:
...although I don't think that issue is the reason you cannot hear a pcbeep. Nevertheless, you should fix it, if for no other reason than to rule it out.

thank you once again for reminding me to fix things i'd ignored as some quirks.. i had audio everywhere. so i hadn't bothered.

since you pressed me to fix this issue, i went on a trail through your post and elsewhere..

in the end, i didn't need to "fix" the bdl_pos_adj :) i don't seem to have that warning anymore!
imho 64k pre-allocated buffer size is amply sufficient. i think yours (2048kb) is too much (probably useful for a complicated pulseaudio setup). if you have alsa, try going back to the initial default and see if something stops working.

i also didn't have alsasound service enabled. i added it to the default runlevel. don't know if that contributed to my issue.
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey


Last edited by josephg on Thu Oct 06, 2016 5:21 pm; edited 3 times in total
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Thu Oct 06, 2016 5:16 pm    Post subject: Reply with quote

houston, i have a... beep!

and a proper beep this time :D i can beep beep beep everywhere.. and control it up/down/off
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Thu Oct 06, 2016 10:40 pm    Post subject: Reply with quote

josephg wrote:
each time i've had enough of this issue and give up, you turn up pressing me on and adding some more ideas into my head.

You're the one who resurrected it, not me!:

On Wed Oct 05, 2016 5:07 am josephg wrote:

Fitzcarraldo, i think i have tried all sorts of permutations wrt pcspkr and snd-pcsp and i can't get either to emit an audible beep, as per my previous posts on this thread. is there some way i could debug to find out if anything might be happening or not behind the scenes?

You clearly hadn't had enough, and hadn't given up. I suspect it was bugging you. :wink:

josephg wrote:
imho 64k pre-allocated buffer size is amply sufficient. i think yours (2048kb) is too much (probably useful for a complicated pulseaudio setup). if you have alsa, try going back to the initial default and see if something stops working.

I have it set to 2048kb for a reason, as a lower value gave me some trouble:

CONFIG_SND_HDA_PREALLOC_SIZE wrote:
Specifies the default pre-allocated buffer-size in kB for the HD-audio driver. A larger buffer (e.g. 2048) is preferred for systems using PulseAudio. The default 64 is chosen just for compatibility reasons.


josephg wrote:
i also didn't have alsasound service enabled. i added it to the default runlevel. don't know if that contributed to my issue.

https://wiki.gentoo.org/wiki/ALSA#Service

You'll need it if you want to save and restore ALSA mixer levels (have a look through /etc/init.d/alsasound). See also the /etc/conf.d/alsasound configuration file:

Code:
# RESTORE_ON_START:
# Do you want to restore your mixer settings?  If not, your cards will be
# muted.
# no - Do not restore state
# yes - Restore state

RESTORE_ON_START="yes"

# SAVE_ON_STOP:
# Do you want to save changes made to your mixer volumes when alsasound
# stops?
# no - Do not save state
# yes - Save state

SAVE_ON_STOP="yes"


Anyway, good to know you have a pcbeep now.
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Oct 07, 2016 10:38 am    Post subject: Reply with quote

Fitzcarraldo wrote:
9. Note that pcbeeps only play on VTs (TTYs). To hear a pcbeep -- as distinct from a beep triggered by using the XKB Event Daemon -- from within X Windows, I have to do any of the following in Konsole/xterm/Eterm or other X Windows terminal program:

From my user account:
Code:
fitzcarraldo@clevow230ss ~ $ sudo su -c "echo -e '\a' > /dev/console"
fitzcarraldo@clevow230ss ~ $ sudo su -c "tput bel > /dev/console"
fitzcarraldo@clevow230ss ~ $ sudo su -c "beep" # You need to have app-misc/beep installed for this to work.

As root user:
Code:
clevow230ss fitzcarraldo # echo -e '\a' > /dev/console
clevow230ss fitzcarraldo # tput bel > /dev/console
clevow230ss fitzcarraldo # beep > /dev/console


you can, and should get pcsp beeps within x too. i do now in x. the advantage is being able to control the beep volume up/down/mute. i am not using xkb event daemon any longer. less stuff to bother about.

i don't need to do any of that as sudo/root. i get beeps for each of those in urxvt as normal user. i don't need that beep package either.

i use pcspkr, which i think is the most efficient. if it doesn't work for you, try snd-pcsp which emulates pcspkr through your sound-card.

we should try to fix you now ;)
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Fri Oct 07, 2016 12:38 pm    Post subject: Reply with quote

I use pcspkr rather than snd-pcsp (the reason is given in the second link in my 29th September post).

Excerpt from the manual of the beep command (app-misc/beep):

man beep wrote:
IOCTL WACKINESS
Some users will encounter a situation where beep dies with a complaint from ioctl(). The reason for this, as Peter Tirsek was nice enough to point out to me, stems from how the kernel handles beep's attempt to poke at (for non-programmers: ioctl is a sort of catch-all function that lets you poke at things that have no other predefined poking-at mechanism) the tty, which is how it beeps. The short story is, the kernel checks that either:

- you are the superuser

- you own the current tty

What this means is that root can always make beep work (to the best of my knowledge!), and that any local user can make beep work, BUT a non-root remote user cannot use beep in it's natural state. What's worse, an xterm, or other x-session counts, as far as the kernel is concerned, as 'remote', so beep won't work from a non-priviledged xterm either.
I had originally chalked this up to a bug, but there's actually nothing I can do about it, and it really is a Good Thing that the kernel does things this way. There is also a solution.

By default beep is not installed with the suid bit set, because that would just be zany. On the other hand, if you do make it suid root, all your problems with beep bailing on ioctl calls will magically vanish, which is pleasant, and the only reason not to is that any suid program is a potential security hole. Conveniently, beep is very short, so auditing it is pretty straightforward.

Decide for yourself, of course, but it looks safe to me - there's only one buffer and fgets doesn't let it overflow, there's only one file opening, and while there is a potential race condition there, it's with /dev/console. If someone can exploit this race by replacing /dev/console, you've got bigger problems. :)

So the quick, only, and likely safe solution if beep is not beeping when you want it to is (as root):

# chmod 4755 /usr/bin/beep

(or wherever you put it)

The one snag is that this will give any little nitwit the ability to run beep successfully - make sure this is what you want. If it isn't, a slightly more complex fix would be something like:

# chgrp beep /usr/bin/beep

# chmod 4750 /usr/bin/beep

and then add only beep-worthy users to the 'beep' group.

Also, bear in mind you that are not using a Desktop Environment, there is a bug in KDE terminals preventing beeps, you are not using PulseAudio, and you are (probably) using a different codec (what is your codec, by the way?).
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Oct 07, 2016 2:14 pm    Post subject: Reply with quote

Fitzcarraldo wrote:
I use pcspkr rather than snd-pcsp (the reason is given in the second link in my 29th September post).

sorry yes you are right.. yes to pcspkr! i was thinking the other way around. snd-pcsp substitutes sound-card. strange both worked for me.

Fitzcarraldo wrote:
Excerpt from the manual of the beep command (app-misc/beep):

too complicated, unless the others don't work. or you want to sing different tunes while beeping ;)

Fitzcarraldo wrote:
Also, bear in mind you that are not using a Desktop Environment, there is a bug in KDE terminals preventing beeps, you are not using PulseAudio, and you are (probably) using a different codec (what is your codec, by the way?).

yes i don't want any extra luggage than absolutely necessary :) to me they are all bloatware :P

i don't understand what difference would codecs make, unless you could install them. they make no difference to sudo/root permissions etc.
Code:
$ grep -i codec /proc/asound/card*/*
/proc/asound/card0/codec#0:Codec: Realtek ALC268
/proc/asound/card0/codec#1:Codec: LSI Generic HDMI

_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Fri Oct 07, 2016 2:53 pm    Post subject: Reply with quote

josephg wrote:
Fitzcarraldo wrote:
I use pcspkr rather than snd-pcsp (the reason is given in the second link in my 29th September post).

sorry yes you are right.. yes to pcspkr! i was thinking the other way around. snd-pcsp substitutes sound-card. strange both worked for me.

They both work for me, but pcspkr works better. One of the factors is the model of codec, another is the driver.

josephg wrote:
Fitzcarraldo wrote:
Also, bear in mind you that are not using a Desktop Environment, there is a bug in KDE terminals preventing beeps, you are not using PulseAudio, and you are (probably) using a different codec (what is your codec, by the way?).

yes i don't want any extra luggage than absolutely necessary :) to me they are all bloatware :P

Understood, but my point is that they all have an influence and the behaviour in my case is explicable and does not need fixing (well, apart from KDE bug no. 177861 in the KDE terminals, which the KDE developers need to fix).

josephg wrote:
Fitzcarraldo wrote:
Excerpt from the manual of the beep command (app-misc/beep):

too complicated, unless the others don't work. or you want to sing different tunes while beeping ;)

I was not recommending the beep utility; I quoted that excerpt from its manual because it applies to pcbeeps in general. Please read through it. Note, for example:

Quote:
What's worse, an xterm, or other x-session counts, as far as the kernel is concerned, as 'remote', so beep won't work from a non-priviledged xterm either.
I had originally chalked this up to a bug, but there's actually nothing I can do about it, and it really is a Good Thing that the kernel does things this way.


josephg wrote:
i don't understand what difference would codecs make, unless you could install them. they make no difference to sudo/root permissions etc.

Codecs have a big influence. The software and firmware is different for different models of codec. Some codecs have ALSA channels that others don't. They behave differently. There are bugs in ALSA for some codecs but not others. If you look through the ALSA Mailing List, you'll see what I mean. Just to give one example of the influence of a codec, see the problems caused by the particular model of codec in one of my laptops: No sound from headphones after resume from suspension / No sound from headphones after re-plug. By the way, that article describes how to use Early Patching (nothing to do with source-code patching) in order to change the ALSA driver's initial configuration of that particular model of codec.

I've discussed beeps in the last two weeks more than enough to last a lifetime! Hopefully this thread will be of some use to others in future. Time to call it a day. Have fun with your beeping!
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
josephg
l33t
l33t


Joined: 10 Jan 2016
Posts: 783
Location: usually offline

PostPosted: Fri Oct 07, 2016 4:35 pm    Post subject: Reply with quote

Fitzcarraldo wrote:
I was not recommending the beep utility; I quoted that excerpt from its manual because it applies to pcbeeps in general. Please read through it. Note, for example:

Quote:
What's worse, an xterm, or other x-session counts, as far as the kernel is concerned, as 'remote', so beep won't work from a non-priviledged xterm either.
I had originally chalked this up to a bug, but there's actually nothing I can do about it, and it really is a Good Thing that the kernel does things this way.

have you tried adding your user to the audio group? i couldn't beep otherwise than like you with either sudo/root.

Fitzcarraldo wrote:
I've discussed beeps in the last two weeks more than enough to last a lifetime!

;) and again thank you!
_________________
"Growth for the sake of growth is the ideology of the cancer cell." Edward Abbey
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3345
Location: Rasi, Finland

PostPosted: Fri May 05, 2017 3:47 pm    Post subject: Reply with quote

Hi. If anyone reading this wants to play with their PC Speaker. I've put some samples to my wiki-page.

I plan to use my PC speaker as an indicator of some timed events, like backups. Different beep for success and failure.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum