用了以前一个在2440上的音量调节程序,无法对tiny210的音量进行调节,请问是否是210的驱动架构有新的变化?要使用新的接口进行音量的控制?
下面的程序在2440里面是可以直接控制音量的!
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/soundcard.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
int MIX_FD;
int iLeft = 0;
int iRight = 0;
int iLevel0 ,iLevel;
int ret;
if (argc < 2) {
printf("Please add a file name and the volume level such as: ./volume 80\n");
exit(0);
}
iLeft = iRight = atoi(argv[1]);
iLevel = (iRight << 8) + iLeft;
MIX_FD= open("/dev/mixer", O_WRONLY);
if (MIX_FD == -1) {
perror("Error:open /dev/mixer error");
exit(1);
}
ret = ioctl(MIX_FD, MIXER_WRITE(SOUND_MIXER_VOLUME), &iLevel); /* 调整大小 */
printf("ioctl ret = %d \n",ret);
close(MIX_FD);
return 0;