下面代码想实现让屏幕变黑
#include <stdio.h>
#include <fcntl.h>
#include <sys/mman.h>
int main(void)
{
unsigned long *buffer;
int fd,;
fd = open("/dev/video0", O_RDWR);
if (fd == -1)
{
printf("Cannot open video0!\n");
exit(0);
}
buffer = mmap(NULL, (480 *240) , PROT_READ|PROT_WRITE,0,fd,0);
if(buffer==-1)
{
printf("Cannot map memory!\n");
exit(0);
}
memset(buffer,0,480*240);
sleep(3);
close(fd);
return 0;
}
程序运行结果:Cannot map memory!
用errno查看是错误22 mmap参数错误。。。哪里错了呢?我用的是w90p710.. |