1 Star 0 Fork 1

qingsonggege / openwrt_mt7688_ctest

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
lirc_conflict_test.c 2.17 KB
一键复制 编辑 原始数据 按行查看 历史
#include <stdio.h>
#include <stdlib.h> //---system()
//#include <curses.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include <string.h> //--strcat()
#define CODE_NEXT 67
#define CODE_PREV 64
#define CODE_PLAY_PAUSE 68
#define CODE_VOLUME_UP 9
#define CODE_VOLUME_DOWN 21
char str_dev[]="/dev/LIRC_dev";
int main(int argc, char **argv)
{
int fd;
int ret;
unsigned int LIRC_DATA = 0; //---raw data from LIRC module
unsigned int LIRC_CODE =0;
unsigned int volume_val=105;
char str_tmp[5];
char str_cmd_vol[50];
//------- open driver--------
fd = open(str_dev, O_RDWR | O_NONBLOCK);
if (fd < 0)
{
printf("can't open %sn",str_dev);
return -1;
}
//------------- read LIRC_DATA -------
while(1)
{
ret=read(fd, &LIRC_DATA, sizeof(LIRC_DATA));
printf("----- read ret=%d -----\n",ret);
if(LIRC_DATA!=0)
{
printf("LIRC_DATA: 0x%0x\n",LIRC_DATA);
LIRC_CODE=(LIRC_DATA>>16)&0x000000ff;
printf("LIRC_CODE: %d\n",LIRC_CODE);
/*
switch(LIRC_CODE)
{
case CODE_NEXT: system("echo 'pt_step 1' > /home/slave");break;
case CODE_PREV: system("echo 'pt_step -1' > /home/slave");break;
case CODE_PLAY_PAUSE: system("echo pause > /home/slave");break;
//case CODE_VOLUME_UP: system("echo 'volume +10' > /home/slave");break;
case CODE_VOLUME_UP:
{
volume_val+=3;
if(volume_val>127)volume_val=127;
sprintf(str_cmd_vol,"amixer set Speaker %d",volume_val);
system(str_cmd_vol);
break;
}
case CODE_VOLUME_DOWN:
{
volume_val-=3;
if(volume_val<50)volume_val=50;
sprintf(str_cmd_vol,"amixer set Speaker %d",volume_val);
system(str_cmd_vol);
break;
}
//default:
}
*/
}
usleep(100000); //--wait
}
close(fd);
return 0;
}
1
https://gitee.com/qingsonggege/openwrt_mt7688_ctest.git
git@gitee.com:qingsonggege/openwrt_mt7688_ctest.git
qingsonggege
openwrt_mt7688_ctest
openwrt_mt7688_ctest
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891