jackopen.c
上传用户:sy_wanhua
上传日期:2013-07-25
资源大小:3048k
文件大小:1k
- #include <sys/types.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <strings.h>
- #include <sys/ioctl.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include "ixjuser.h"
- int main(int argc, char *argv[])
- {
- int ixj1, hook, m_hook;
- char pname1[80], pname2[80];
- sprintf(pname1, "/dev/ixj%s", argv[1]);
- ixj1 = open(pname1, O_RDWR);
- if(ixj1 <= 0)
- {
- printf("Open failed %sn", pname1);
- exit(0);
- }
- hook = m_hook = ioctl(ixj1, IXJCTL_HOOKSTATE);
- printf("hook state %dn", hook);
- if(!ioctl(ixj1, IXJCTL_RING))
- exit(0);
- hook = m_hook = ioctl(ixj1, IXJCTL_HOOKSTATE);
- printf("hook state %dn", hook);
- while(1)
- {
- printf("hook state changed to %d m_hook = %dr", hook, m_hook);
- if((hook && !m_hook) || (!hook && m_hook))
- {
- printf("ttthook state changed to %dr", hook);
- m_hook = hook;
- }
- hook = ioctl(ixj1, IXJCTL_HOOKSTATE);
- }
- close(ixj1);
- }