#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define BUZZER_NUM 2
int main(int argc , char* argv[])
{
int fd , buzzer_num;
char *buzzer = "/dev/buzzer_ctl";
if(atoi(argv[1]) >= BUZZER_NUM)
{
printf("argv1 is 0 or 1 \n");
exit(1);
}
if((fd = open(buzzer,O_RDWR|O_NOCTTY|O_NDELAY)) < 0)
{
printf("open %s failed \n",buzzer);
exit(1);
}else{
ioctl(fd, atoi(argv[1]),atoi(argv[2]));
printf("open %s success \n ",buzzer);
}
close(fd);
return 0;
}