More on BEEP

A few months ago, back in the dark agains, BF (Before Foundry27), I hurriedly blogged about trying to turn off the annoying Beep – the bane of laptop owners anywhere.

Well, today I had a few minutes, and so I went of in search of a more complete solution.

Switching Modes

As you may remember, one of the issues was that the beep control sequence, was only understood by devc-con when it was running QNX4 Terminal emulation mode, which is not the default.

I was telling this to my colleague, Peterv, and he said – well just emit the code to switch to QNX emulation and back.

Well, it was one of those ‘Duh’ moments. :-)

Of course, the fun part was figuring out the codes to emit. I couldn’t find a decent doc of the QNX4 Terminal Emulator codes, and the ANSI code to switch to QNX4 was a private vendor extension.

After a bit of mucking around though, I figured it out…

The Dark Majik

And yeah shall chant…


# switch to QNX4 emulation
printf "%c[?+q" 0x1b

# set beep tick count = 1, frequency divider to 1

printf "%cs%c%c%c" 0x1b 33 33 32

# switch back to ANSI emulation
printf "%c?1+q" 0x1b

Now, make sure you put this output to /dev/con1, because that is the device that actually talks to the PC beep port. Photon pterm terminals do understand these codes, but they just send a bell character to /dev/con1!

Enjoy a beepless world, my friends.

BTW – you can muck around with the parameters. You might find you like a beep but just a bit shorter – each tick is 50ms.


5 comments so far

  1. colinburgess on

    wordpress’s editor is working against me again – anywhere you see a backslash thirtythree it should be backslash zero thirtythree. I’ll try fixing it up later, sorry about that.

  2. colinburgess on

    ok, switched to using the source code view, but it still eats backslashes. Changed to use printf…

  3. colinburgess on

    BTW – I just updated the parameters in the script – you may want to update, since it now works much better. :-)

  4. colinburgess on

    *SIGH* more updates. :-)

    You don’t need to switch to QNX mode after all, there is an ANSI vendor extension for it.

    printf %c[=1;1;B 0x1b

  5. Kevin on

    Ahhh! Very nice, silence is golden!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: