【发布时间】:2014-05-14 06:17:53
【问题描述】:
我正在尝试为我的设备读取资源文件,mmap 它是为了读取设备寄存器,但是当我尝试打开文件位置错误提示时:NO such file or directory。我已经使用 chmod 666 更改了文件的权限。我用来打开文件的代码:
sprintf(filePath , "sys/bus/pci/devices/%04x:%02x:%02x.%d/resource0",segment,bus,device,function)
fileHandle = open(filePath , O_RDONLY);
if (fileHandle < 0)
{
perror("ERRRO : ");
}
该文件存在,我可以使用 cat 实用程序读取它。
【问题讨论】: