2024年4月28日发(作者:)
#include
#include
#include
#include "command.h"
int main(int argc, char *argv[])
{
int fd = open("/dev/hello0", O_RDWR);
if(fd < 0)
{
perror("open error:");
return -1;
}
if(ioctl(fd, HELLO_RESET) < 0)
{
perror("error:");
return -1;
}
int val = 1;
if(ioctl(fd, HELLO_WRITE, &val) < 0)
{
perror("write error:");
return -1;
}
val = 2;
if(ioctl(fd, HELLO_READ, &val) < 0)
{
perror("read error");
return -1;
}
printf("val = %dn", val);
return 0;
}
发布评论