1

I tried running a busybox version of beep over SSH but recieved the following error message:

$ beep                                                                
beep: can't open console
$ ls -l /dev/console                                                  
crw-------    1 root     root        5,   1 Jun 22 23:32 /dev/console

If I were to invest the time in rooting my device would this work? I imagine that this may not be the only complication...

  • To add further more info, I tried this command with root privileges, got the same error. Don't know what it is but thought I should add my part. – Firelord Jul 6 '15 at 18:59
  • I can't believe no one up voted this question ,it is a serious question even if the asker never came back to see an answer – lord-ralf-adolf Jul 8 '15 at 3:07
1

After a long time of reflection and a good night sleep ,I came back to edit my answer.

Short answer:

beep will not work under Android as Android devices do not have an internal system speaker and no kernel module pcspkr. I tried to beep old school way with the command echo -en "\a" > /dev/tty5, but it will not work since Android doesn't have an internal speaker.

Whenever I run beep with root or without it always return the same error:

   beep : can't open console

After reading the beep documentation I think the problem is not that you don't have permission – but due to beep command not finding the console (for info: beep will use tty0 as default console to beep and not the /dev/console) and that's why it returns "can't open console" and not "permission denied". To fix this you would need to compile beep from busybox source with option to change the default console like in the beep desktop version.

But nothing is impossible you can make your own beep program easily following this steps :

  • make sure you have the binary aplay on your phone have it under /system/bin it is used by the system to play boot sounds if you don't have it grab the arm version from here and put it under /system/bin on your phone and give it the right permission it have to be executable.
  • download this beep.wav file from here and put it somewhere on the system partition of the phone or any where else your choice in my exemple it will be /system/beep.wav.
  • now you can either beep usin this command

    aplay /system/beep.wav
    

    or you can make a script file name it beep and put it under /system/xbin or /system/bin you can either over right or rename the old copy since it is just a symlink to the busybox binary. You can always call the original beep by busybox beep command and don't forget to give it the execute permission.

Here is the simple exemple of the script to write:

#!/system/bin/sh
aplay /system/beep.wav

This will beep your device with the current default speaker it can be the phone's speaker, headset or Bluetooth headset, you can change that using the aplay option -Dnameofpcmdevice

This script can only beep once but, I see many possibilities can be added easily, like playing other sounds alarm and adding arguments like frequency – and much more.

externel links reference and assets :

http://linux.die.net/man/1/beep

http://www.soundjay.com/beep-sounds-1.html

http://media.io/ >> great online service to convert sounds to wav format supported by aplay

I hope this will solve your problem or at least give you an alternative

  • @LôrdRalfAdolf May I still ask if you verified what you wrote on an Android device (and if so, on which)? Neither me nor Firelord were able to have that "work just fine", but both got the same error: "beep: can't open console" in all cases (via adb shell, via ssh, and via local terminal). – Izzy Jul 7 '15 at 15:45
  • I can confirm what Izzy and firelord said ,the command beep return can't open console even with root ,tested on HTC one with CyanogenMod on local terminal ,adb shell and ssh – lord-ralf-adolf Jul 8 '15 at 12:53
  • @Izzy I updated my answer with a proper explanation of the beep binary and what may be causing this issue ,but I can be wrong :D please read and tell me what you think – lord-ralf-adolf Jul 12 '15 at 1:13
  • I cannot verify currently, but it sounds great now (I've just applied a little formatting, hope you don't mind ;) Now let's wait for the OP who is likely to have the urge of verification :) Thanks a lot for all your effort. That alone is worth an upvote: though I cannot really "try it out", it seems sound to me. Great you don't only say beep doesn't work, even explain why – but also include a way to "fake" it. Good job I'd say! – Izzy Jul 12 '15 at 10:24
  • Thanks @Izzy I don't mind the edit ,I appreciate it ,I know I am not getting any spell or text formatting awards any time soon ,I will try my best next time to save you the trouble – lord-ralf-adolf Jul 12 '15 at 19:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.