# Beep on console missing



## agm (Sep 21, 2018)

I have an Acer TravelMate P2 laptop ... and I miss the console beep.

After readings manuals, handbook and playing with nid pins, reading kernel source I made the following test.

I used the usb memstick image (11.2) for boot on this and a similar control system. 
Boot uefi, set verbose mode in the boot menu and select live... from the menu.
After login I ran the command 'sysctl hw.snd.verbose=4' and saved dmesg, sndstat, mixer ...etc outputs.

On the control system the command 'mixer igain 2' switches on the console bell with 
a message like 'Setting amplifier nid=12 index=1 in mute=0/0 vol=0/0'.
On this laptop the same command does not switch on console bell and I see no message.

Booting on this laptop from harddisk (installed with the same memstick some weeks ago)
where 'hw.snd.verbose=4' is set in /etc/sysctl.conf
I can see lot of 'Setting amplifier nid=12 ...' messages during boot:
hdaa0: Setting amplifier nid=12 index=0 in mute=0/0 vol=0/0
hdaa0: Setting amplifier nid=12 index=1 in mute=1/1 vol=0/0
hdaa0: Setting amplifier nid=12 index=0 in mute=0/0 vol=0/0
hdaa0: Setting amplifier nid=12 index=1 in mute=1/1 vol=0/0
hdaa0: Setting amplifier nid=12 index=1 in mute=1/1 vol=0/0

The pin configuration status seems to be the same as on the control system, the Mic has differnt nid.
So, I assume the status after boot is the same, but somehow the 'mixer igain 2' does not trigger
an unmute on this laptop.

Sound is otherwise working, I can play music. Headphone switch and noise does not matter now.

How can I patch my system to have beep on console?


----------



## Martin Paredes (Sep 24, 2018)

Are you sure that the sound is emitted by the console?

What are you doing that you expect a beep?

The bell is controlled by the console driver you are using, syscon(4) or vt(4)


```
hw.*syscons*.bell=1
kern.*vt*.enable_bell=1
```

To test, in the console try, `printf "\7"` or `spkrtest`


----------



## agm (Sep 24, 2018)

After setting igain to something nonzero I press backspace... that should work
as well the mentioned printf '\7' or echo -e '\a'
and after sudo kldload speaker and sudo chmod g+w /dev/speaker
echo 'ec' > /dev/speaker

I have FreeBSD 11.2, booting from uefi, vt by default, and bell is on by default:

```
$ sysctl -a | grep bell
kern.vt.enable_bell: 1
hw.syscons.bell: 1
```


----------



## Martin Paredes (Sep 25, 2018)

You miss the beep produced by the backspace of the keyboard, try `kbdcontrol -b normal`

What you are trying to do, should be activated by default, does the /dev/speaker file exist by default (no kldload speaker)?

Do you hear something with `beep -d /dev/pcm0`?


----------



## agm (Sep 25, 2018)

Running kbdcontrol does not help.
The speaker module iss not loaded by default and there is no /dev/speaker device, only after kldload speaker.

I have installed beep for the test, with the recommended configs.
I have no /dev/pcm0, using default device:

```
# beep -v
frequency: 800Hz   duration: 5ms   device: /dev/speaker
```
silence


----------



## shkhln (Sep 25, 2018)

Aren't these beeps supposed to be produced by a dedicated piezoelectric buzzer?


----------



## agm (Sep 25, 2018)

I can play music, so somethig is working, but
`echo 'ec' > /dev/speaker` should give the sounds  like the `printf '\7'` also the beep
and there is nothing


----------



## Martin Paredes (Sep 25, 2018)

agm said:


> I have no /dev/pcm0, using default device


Use the device of the soun card, if you hear the beep, then you can `ln -s /dev/pcm0 /dev/speaker` to solve your problem


shkhln said:


> Aren't these beeps supposed to be produced by a dedicated piezoelectric buzzer?


Since it is a laptop, it is more likely that it does not have a piezoelectric buzzer (PC speaker).


----------



## Martin Paredes (Sep 25, 2018)

agm said:


> I can play music, so somethig is working, but
> `echo 'ec' > /dev/speaker` should give the sounds  like the `printf '\7'` also the beep
> and there is nothing


What I think is that you don't have /dev/speaker because your laptop does not have physically a speaker, more info in "console speaker device driver" speaker(4)

The beep should be redirected to the sound card and for the content of your dmesg, it may be in mute

```
pcm0: <Realtek ALC255 (Internal Analog)> at nid 20 and 18 on hdaa0
pcm0: Speaker/Beep Volume (OSS: speaker): -34/12dB
pcm0:    +- ctl  9 (nid  11 in   4): -34/12dB (32 steps) + mute
pcm0:    +- ctl 11 (nid  12 in   1): mute
pcm0:    +- ctl 34 (nid  35 in   4): mute
pcm0:    +- ctl 35 (nid  35 in   5): mute
pcm0: Mixer "speaker":

pcm1: <Realtek ALC255 (Front Analog Headphones)> at nid 33 on hdaa0
pcm1: Speaker/Beep Volume (OSS: speaker)
pcm1:    +- ctl 13 (nid  13 in   1): mute
```


----------



## agm (Sep 25, 2018)

As I mentioned in #1, I have this laptop and an older one where beep works.
Booting from the same USB with memstick 11.2 "Live CD" on these systems the kernel is the same, config is the same.
What is different is BIOS/UEFI (I used uefi boot on both) and the hardware itself.
There is no /dev/speaker after boot, the two systems show the same, except on changing igain makes beep working on that and nothing on this.


----------



## shkhln (Sep 25, 2018)

agm said:


> As I mentioned in #1, I have this laptop and an older one



Well, you did not. Do both these notebooks produce one short beep on boot?



agm said:


> changing igain makes beep working on that



Beeps are not emulated through OSS.


----------



## agm (Sep 26, 2018)

Sorry for repeating


agm said:


> I used the usb memstick image (11.2) for boot on this and a similar control system.
> Boot uefi, set verbose mode in the boot menu and select live... from the menu.
> After login I ran the command 'sysctl hw.snd.verbose=4' and saved dmesg, sndstat, mixer ...etc outputs.
> 
> ...



The control system is a dell, this is an acer, both have ALC255 for the default hda, but the hdac/hdaa/pcm structure is different.
I used memstick 11.2 "live cd" to eliminate custom settings.

I will check the audio signaI during boot as soon as I can.


----------



## agm (Sep 26, 2018)

shkhln said:


> Beeps are not emulated through OSS.


I followed that link (Beeps : /sys/kern/kern_cons.c +651), added two printf's to see if the hw exists or not
and make buildkernel/installkernel and reboot...
After reboot I see the answer on console, so at least the hardware exists. GREAT!!!
then I did mixer igain 23 and
on every backspace press I see the printf that in sysbeep() function HAS_TIMER_SPKR defined and beeping=0
(a little bit experimental)

How can I debug further to find why it is silent?


----------



## shkhln (Sep 27, 2018)

agm said:


> mixer igain 23



This command does _nothing_. It's completely unrelated.



agm said:


> I see the printf that in sysbeep() function HAS_TIMER_SPKR defined



It's defined on i386 and amd64 platforms (also, it's a macro, so it's value is not determined at runtime). To actually hear beeps you need a beeper/buzzer attached to the motherboard and I'm pretty sure you don't have one. They _really_ are out of fashion now, I don't expect anything like that in a modern consumer notebook. Maybe there is some kind of hardware support for beeping through regular notebook speakers.


----------



## shkhln (Sep 27, 2018)

shkhln said:


> Maybe there is some kind of hardware support for beeping through regular notebook speakers.



Found that rather popular Realtek ALCxxx chipsets have "Supports external PCBEEP input and built-in digital BEEP generator" line in description. Other sound chips likely have similar features. That's not something that you can connect yourself, though; it's up to the motherboard manufacturer to properly set up.


----------



## Martin Paredes (Sep 27, 2018)

FreeBSD is detecting 3 sound cards

```
pcm0: <Realtek ALC255 (Internal Analog)> at nid 20 and 18 on hdaa0
pcm1: <Realtek ALC255 (Front Analog Headphones)> at nid 33 on hdaa0
pcm2: <Intel Kabylake (HDMI/DP 8ch)> at nid 3 on hdaa1
```
There should be 3 devices

```
/dev/mixer0
/dev/mixer1
/dev/mixer2
```
Set to the maximun the volume of the speaker `mixer -f /dev/mixer0 speaker 100` and test with `beep -v -d /dev/mixer0`

You can also try set all to 100 in mixer0


----------



## agm (Sep 28, 2018)

Anyway, while I'm in the boot menu, when I unplug/plug the power cord I hear the beep.


----------



## agm (Oct 3, 2018)

Maybe somebody has new idea, I will sum the facts.

I have an Acer travelmate with KabyLake and ALC255. 
To have an original environment I boot from FreeBSD memstick 11.2 and run the "Live cd".
With this setting I have checked some other laptops with ALC255 and the I could get the bell, just after mixer igain 50.
On this laptop when I push all the values with mixer up, I hope I will be able to hear the beep, for example pressing the TAB on multiple selection or the Backspace on the prompt.
But there is silence.



> ls -l  > /dev/dsp


 gives some garbage noise.
After loading speaker.ko 





> echo 'ec' > /dev/speaker


 is silent.
When I boot from disk I can play music.


Pciconf and devinfo (is it ok to have only hdac0?)


> hdac0@pci0:0:31:3:    class=0x040300 card=0x12281025 chip=0x9d718086 rev=0x21 hdr=0x00
> 
> hdac0 pnpinfo vendor=0x8086 device=0x9d71 subvendor=0x1025 subdevice=0x1228 class=0x040300 at slot=31 function=3 dbsf=pci0:0:31:3 handle=\_SB_.PCI0.HDAS
> hdacc0 pnpinfo vendor=0x10ec device=0x0255 revision=0x00 stepping=0x02 at cad=0
> ...



selected lines from dmesg


> hdaa0: <Realtek ALC255 Audio Function Group> at nid 1 on hdacc0
> hdaa0: Subsystem ID: 0x10251228
> hdaa0: NumGPIO=3 NumGPO=0 NumGPI=0 GPIWake=0 GPIUnsol=1
> hdaa0: Original pins configuration:
> ...


----------



## uii (Oct 4, 2018)

Are you in X?
When I switch to a text console with CTRL + ALT + F1-8 I hear a beep.

In X:
You can switch the sound devices with:
`sysctl hw.snd.default_unit=n`
n is in your case 0,1 or 2


----------

