ARM LINUX 使用Mt7601AP驱动报错:no file read method

驱动编译过了之后加载驱动并且启动AP,执行iwconfig之后发现一堆的HT_AP****的AP名称,查看驱动打印,发现以下报错内容:

no file read method
Read file "/appfs/fconfigs/wifi/RT2870AP.dat" failed(errCode=-1)!
1. Phy Mode = 6
2. Phy Mode = 6
NVM is Efuse and its size =1d[1e0-1fc] 
3. Phy Mode = 6
AntCfgInit: primary/secondary ant 0/1
RTMPSetPhyMode: channel is out of range, use first channel=0 
MCS Set = 00 00 00 00 00
SYNC - BBP R4 to 20MHz.l
RTMPSetPhyMode: channel is out of range, use first channel=0 
Main bssid = f0:c8:14:99:9b:ca

查看源码,发现报错的原因是无法读取配置文件

int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen)
{
    /* The object must have a read method */
    if (osfd->f_op && osfd->f_op->read) {
        return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos);
    } else {
        DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n"));
        return -1;
    }
}

这里报的no file read method错误,检查 osfd->f_op 和 osfd->f_op->read 发现后者为空,也就是因为没有read函数来读取文件导致报错。
把函数修改一下,使用vfs_read替代

int RtmpOSFileRead(RTMP_OS_FD osfd, char *pDataPtr, int readLen)
{
	/* The object must have a read method */
#if 0
	if (osfd->f_op && osfd->f_op->read) {
		return osfd->f_op->read(osfd, pDataPtr, readLen, &osfd->f_pos);
	} else {
		DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n"));
		return -1;
	}
#else
	if (osfd->f_op) {
		return vfs_read(osfd, pDataPtr, readLen, &osfd->f_pos);
	} else {
		DBGPRINT(RT_DEBUG_ERROR, ("no file read method\n"));
		return -1;
	}
#endif
}

重新编译加载即可。

你可能感兴趣的:(其他,arm,linux,arm开发,嵌入式)