The officially official Devuan Forum!

You are not logged in.

#1 2023-12-30 19:27:43

ks
Member
Registered: 2018-05-08
Posts: 30  

[SOLVED] Daedalus silences PC speaker

Since I installed daedalus I have another problem: PC speaker is unwilling
to beep. ^G, '\007' etc to console or /dev/tty don't work. The only thing that
does, is /usr/bin/beep still produces a beep.

It's annoying because over the years I've become used to my editor beeping
if a search was unsuccessful, or when hitting DEL at the beginning or end of
a line [or console input].

It _may_ have something to do with the fact that pulseaudio won't start now,
but so far it hasn't bothered me. I can use alsa to play music [if I find a
reasonable replacement for xmms2, otherwise I have to move the music to a
dedicated tiny system sitting idle here].

lspci reports my soundcard as
   03:00.0 Multimedia audio controller: C-Media Electronics Inc CMI8738/CMI8768 \
   PCI Audio (rev 10)

and the pcspkr module is loaded (snd_pcsp is not loaded and, if I understand
its purpose correctly, neither required for simple beeps).

tia

ks

Offline

#2 2023-12-30 21:29:09

UnixMan1230
Member
Registered: 2023-10-21
Posts: 43  

Re: [SOLVED] Daedalus silences PC speaker

check under /etc/modprobe.d and see if anything has blacklisted the pcspkr module


"Less is only more when it's what you're looking for" -Unknown

Offline

#3 2023-12-30 22:32:45

steve_v
Member
Registered: 2018-01-11
Posts: 390  

Re: [SOLVED] Daedalus silences PC speaker

The console bell is something I find incredibly irritating, so while do I know how to kill it with fire I'm probably of rather less use when it comes to the opposite. tongue

That said, (assuming we're talking about a real hardware pc-speaker here, not pc-speaker emulation) I'd probably start with going through the configuration items (inputrc / xset etc.) and potential permissions issues listed in the usual places. Most of it is biased towards eradicating the bell, but such advice should also work in reverse.

That the 'beep' command works suggests to me that your problem is likely either terminal configuration related, or something (e.g alsa or pulseaudio) is trying to redirect bell output to your sound card.
In the alsa case, IIRC that's controlled by e.g. SND_HDA_INPUT_BEEP and SND_HDA_INPUT_BEEP_MODE in the kernel config. As for pulse... Don't use, don't know, sorry.

Ed. Out of interest, does this beep?

#!/usr/bin/env python
"""Beep PC Speaker using Linux evdev API.

To make /dev/input/by-path/platform-pcspkr-event-spkr device available, run:

    root# modprobe pcspkr
"""
import ctypes
import math
import os
import time

EV_SND = 0x12  # linux/input-event-codes.h
SND_TONE = 0x2  # ditto
time_t = suseconds_t = ctypes.c_long

class Timeval(ctypes.Structure):
    _fields_ = [('tv_sec', time_t),       # seconds
                ('tv_usec', suseconds_t)] # microseconds

class InputEvent(ctypes.Structure):
    _fields_ = [('time', Timeval),
                ('type', ctypes.c_uint16),
                ('code', ctypes.c_uint16),
                ('value', ctypes.c_int32)]

frequency = 440  # Hz, A440 in ISO 16
device = "/dev/input/by-path/platform-pcspkr-event-spkr"
pcspkr_fd = os.open(device, os.O_WRONLY)  # root! + modprobe pcspkr
fsec, sec = math.modf(time.time())  # current time
ev = InputEvent(time=Timeval(tv_sec=int(sec), tv_usec=int(fsec * 1000000)),
                type=EV_SND,
                code=SND_TONE,
                value=frequency)
os.write(pcspkr_fd, ev)  # start beep
try:
    time.sleep(0.2)  # 200 milliseconds
finally:
    ev.value = 0  # stop
    os.write(pcspkr_fd, ev)

Last edited by steve_v (2023-12-30 23:00:54)


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#4 2023-12-31 09:51:24

ks
Member
Registered: 2018-05-08
Posts: 30  

Re: [SOLVED] Daedalus silences PC speaker

@UnixMan1230:

Nothing's blacklisted in /etc/modprobe.d

@steve_v:

Just tried your python script, it does indeed beep. Unfortunately I'm none the wiser why traditional beeps don't work.

Offline

#5 2023-12-31 14:18:54

steve_v
Member
Registered: 2018-01-11
Posts: 390  

Re: [SOLVED] Daedalus silences PC speaker

It's not mine, it's just some random script I stole 'cause I'm too lazy to write an evdev test in a more sane language, and it's simple enough for even non snake-charmers to see it's not a bomb tongue
Readline is set to produce an audible bell? (/etc/inputrc and ~/.inputrc)?


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#6 2024-01-01 19:11:37

ks
Member
Registered: 2018-05-08
Posts: 30  

Re: [SOLVED] Daedalus silences PC speaker

# Readline is set to produce an audible bell?

Well, in /etc/inputrc (which I hadn't checked) was
  # set bell-style none
which I changed to
  set bell-style audible
and it made. Made no difference.

Strange that /usr/bin/beep and the script you posted both beep.
beep writes to /dev/input/by-path/platform-pcspkr-event-spkr, unfortunately strace doesn't show anything beep or io related when I try anything other than the beep command.

But from a list of 15 things to sort out post installation I'm down to five, two of which I still don't know how to do. But not today.

Offline

#7 2024-02-13 15:13:51

ks
Member
Registered: 2018-05-08
Posts: 30  

Re: [SOLVED] Daedalus silences PC speaker

Found out what had disabled my beep in terminals and other programs such as nedit.

I used to set up every desktop here to start in runlevel 3 (or manual mode), followed by a startx. Always worked. As long as I can remember.

Now with Devuan 5 (because Debian) there are some changes, some of which I probably haven't tripped over yet. One of them is the retched beep which is somehow disabled if you run a window manager, such as fluxbox, openbox or blackbox, without a display manager. That's the key.

The differences are subtle, but they annoyed the hell out of not just me here (no audible feedback when backspacing or deleting into the void, no feedback on tab completion etc).

Finally got everything working by using lightdm, which is compact enough and very light on dependencies. Even corrected the misaligned positioning of the hostname that someone reported about four years ago and which was fixed last month, but hadn't filtered through to debian and then devuan.

Disadvantage: because ssh-agent wants to be started before windows are opened for business - and I don't like the many dependencies that come with all the alternatives - I opted for ssh-askpass, which, as a pure X11 app, is uglier than ..., let's just say pretty it's not.

But that's something for another day.

Offline

#8 2024-03-01 17:29:24

g4570n
Member
Registered: 2017-12-29
Posts: 7  

Re: [SOLVED] Daedalus silences PC speaker

I was having this same problem with Daedalus installed on a Thinkpad T430.
I had installed the beep package but it didn't sound, I solved it by following these steps:

I solved the problem using alsamixer.
first I need to find the correct card ( switched with F6 )
then I have to switch loopback in alsamixer to enabled.
unmute beep by press m button and volume up beep.
then, the last important thing -
i figured out that beep not work if the microfone volume below 0% -
so i turn it to 1% in alsamixer and then it works!!

source: https://github.com/spkr-beep/beep/issue … -637058344

Offline

Board footer