1 |
Hello, Matthias. |
2 |
|
3 |
On Tue, Oct 20, 2015 at 07:22:48PM +0200, Matthias Gerstner wrote: |
4 |
> Hi Alan, |
5 |
|
6 |
> > I simply want to disable that one particular beeping at shutdown time. |
7 |
|
8 |
> well this topic made me curious where the beep is coming from. |
9 |
|
10 |
> It does originate from the shutdown command itself which is part of the |
11 |
> sys-apps/sysvinit package. In this package's source you find can a file |
12 |
> "src/dowall.c", where you will in turn find a function "wall(...)". |
13 |
|
14 |
> This is the function where the warning messages will be produced that |
15 |
> show up in the terminal and the message is produced like this: |
16 |
|
17 |
> snprintf(line, sizeof(line), |
18 |
> "\007\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n", |
19 |
> user, hostname, tty, date); |
20 |
|
21 |
> The "\007" is the beep you're getting. It's a bell character that you |
22 |
> can produce manually by doing this, too: |
23 |
|
24 |
> echo -e "\007" |
25 |
|
26 |
> Unfortunately the bell character is hard coded into the warning message. |
27 |
> Also there seems to be no way to suppress the warning message. |
28 |
|
29 |
> But you could still try is to disable the interpretation of the bell |
30 |
> character by your terminal. Then you could make an alias or wrapper |
31 |
> around the original shutdown command that does this. |
32 |
|
33 |
> According to Arch Linux docs here: |
34 |
|
35 |
> https://wiki.archlinux.org/index.php/Disable_PC_speaker_beep |
36 |
|
37 |
> You can locally disable the bell in the terminal by calling "setterm |
38 |
> -blength 0". But this doesn't work with my terminals. Says it's |
39 |
> unsupported. |
40 |
|
41 |
> Then you can put this in your ~/.inputrc: "set bell-style none". This |
42 |
> works for me. Then, however, all terminals stop beeping. The pcspkr is |
43 |
> still loaded though and can be used. |
44 |
|
45 |
> As you only want to stop the beep only during shutdown you might also be |
46 |
> able to call "xset -b", disabling the bell on the X-server (globally?). |
47 |
> This is not persistent across reboots and you won't have any beeps until |
48 |
> the machine shuts down. |
49 |
|
50 |
Hey, that's brilliant! Thank you very much indeed! That is an answer |
51 |
much more complete than I could have expected. |
52 |
|
53 |
Probably the most satisfactory way for me to make it work the way I want |
54 |
is to build my own version of shutdown, removing the offending \007 from |
55 |
that sprintf format string..... and then to watch out for new versions |
56 |
of sys-apps/sysvinit. The package appears to be relatively stable. |
57 |
|
58 |
> Regards |
59 |
|
60 |
> Matthias |
61 |
|
62 |
-- |
63 |
Alan Mackenzie (Nuremberg, Germany). |