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