Buzzer Howto
From OESF
Howto utilize the buzzer on the Zaurus
Intro
The Sharp Zaurus doesn't have a built in speaker, but it does have a a "buzzer" type audio device. This audio device can make rudimentary sound as defined in "sharp_char.h"
Basics
If you wish to use the buzzer in your application you need to do at least the following three things:
Include sharp_char.h into your application to use the defines. The header is installed in : /opt/Embedix/tools/arm-linux/include/asm/ so you may want to manually copy the file locally or create a sym-link to the file into the local directory.
#include <sharp_char.h>
Open /dev/sharp_buz. Use normal error checking here.
int fd= open("/dev/sharp_buz", O_WRONLY);
Make an ioctl cal on /dev/sharp_buz replacing SHARP_BUZ_TOUCHSOUND with your desired sound from sharp_char.h
ioctl(fd, SHARP_BUZZER_MAKESOUND, SHARP_BUZ_TOUCHSOUND);
There's only 3 sounds that have any actual data to send through the buzzer device. (Until they add them to the device driver). The warning sound and alarm sound are the same. #define SHARP_BUZ_TOUCHSOUND 1 /* touch panel sound */
#define SHARP_BUZ_KEYSOUND 2 /* key sound */ #define SHARP_PDA_WARNSOUND 4 /* warning occurred */ #define SHARP_BUZ_SCHEDULE_ALARM 11 /* schedule alarm */
Example
Download example source and binary in a tar.gz file [here | http://docs.zaurus.com/downloads/buz.tar.gz].
This test program will open the driver and cycles through all the buzzer sounds. (Make sure to compile it for arm so you can run it on the Zaurus)
Create the makefile with:
# tmake -o Makefile buz.pro
Then build the binary:
# make
Once it is done compiling copy the binary (buz) to the Zaurus and run from command line to hear the results.
---- buz.c -----
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/types.h>
#include <stdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <sharp_char.h>
int main(){
int stat, fd;
int i;
fd= open("/dev/sharp_buz", O_WRONLY);
if(fd == -1){
perror("/dev/sharp_buz");
return(1);
}
for(i=1;i<=14;i++){
printf("Sound: %d\n", i);
stat= ioctl(fd, SHARP_BUZZER_MAKESOUND, i);
if(stat == -1){
perror("ioctl");
}
tcdrain (fd);
}
close(fd);
return(0);
}
--- buz.pro ---- TEMPLATE = app #CONFIG = qt warn_on debug CONFIG = qt warn_on release SOURCES = buz.c TARGET = buz
strategy online casino online slots Casino games. craps slots online Online casino - Internet Casinos online casino games Online casino - Poker in casino Gambling Online - Risks. slots

