#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define EMPEG_MIXER_MAGIC 'm'
#define EMPEG_MIXER_READ_SIGNAL_STRENGTH _IOR(EMPEG_MIXER_MAGIC, 18, int)
#define EMPEG_MIXER_READ_SIGNAL_STEREO _IOR(EMPEG_MIXER_MAGIC, 19, int)
#define EMPEG_MIXER_READ_SIGNAL_NOISE _IOR(EMPEG_MIXER_MAGIC, 21, int)
#define EMPEG_MIXER_READ_SIGNAL_MULTIPATH _IOR(EMPEG_MIXER_MAGIC, 22, int)
#define EMPEG_MIXER_READ_SIGNAL_STRENGTH_FAST _IOR(EMPEG_MIXER_MAGIC, 24, int)
int main (int argc, char *argv[])
{
const char devpath[] = "/dev/mixer";
int fd, result;
fd = open(devpath, O_RDWR);
if (fd == -1) {
perror(devpath);
exit(1);
}
if (-1 == ioctl(fd, EMPEG_MIXER_READ_SIGNAL_STRENGTH, &result)) {
perror("EMPEG_MIXER_READ_SIGNAL_STRENGTH");
exit(1);
}
printf("EMPEG_MIXER_READ_SIGNAL_STRENGTH = %d\n", result);
if (-1 == ioctl(fd, EMPEG_MIXER_READ_SIGNAL_STEREO, &result)) {
perror("EMPEG_MIXER_READ_SIGNAL_STEREO");
exit(1);
}
printf("EMPEG_MIXER_READ_SIGNAL_STEREO = %d\n", result);
if (-1 == ioctl(fd, EMPEG_MIXER_READ_SIGNAL_NOISE, &result)) {
perror("EMPEG_MIXER_READ_SIGNAL_NOISE");
exit(1);
}
printf("EMPEG_MIXER_READ_SIGNAL_NOISE = %d\n", result);
if (-1 == ioctl(fd, EMPEG_MIXER_READ_SIGNAL_MULTIPATH, &result)) {
perror("EMPEG_MIXER_READ_SIGNAL_MULTIPATH");
exit(1);
}
printf("EMPEG_MIXER_READ_SIGNAL_MULTIPATH = %d\n", result);
if (-1 == ioctl(fd, EMPEG_MIXER_READ_SIGNAL_STRENGTH_FAST, &result)) {
perror("EMPEG_MIXER_READ_SIGNAL_STRENGTH_FAST");
exit(1);
}
printf("EMPEG_MIXER_READ_SIGNAL_STRENGTH_FAST = %d\n", result);
return 0;
}