[Kernel/Drive] 无法驱动COMSFAST CF-952AX USB wifi6 无线网卡 Resolved
Tofloor
poster avatar
观星者
deepin
2023-08-22 20:49
Author

解决方案:

方法一:升级内核到6.4

方法二:创建 /etc/udev/rules.d/90-usb-0846:9060-mt7921u.rules,填入以下内容:

ACTION=="add", \
	SUBSYSTEM=="usb", \
	ENV{ID_VENDOR_ID}=="0846", \
	ENV{ID_MODEL_ID}=="9060", \
	RUN+="/usr/sbin/modprobe mt7921u", \
	RUN+="/bin/sh -c 'echo 0846 9060 > /sys/bus/usb/drivers/mt7921u/new_id'"

重启

方法三:临时性解决或测试:

su
modprobe mt7921u
echo 0846 9060 > /sys/bus/usb/drivers/mt7921u/new_id

因为刚安装的20.9已经可以选择5.18内核了就没有测试其他版本,以前只在服务端用linux,第一次装驱动,终于体会到linux桌面用户的难处了。

其他版本可以尝试把官网linux驱动里FW的文件放到/lib/firmware/mediatek里,然后再做以上操作。 不行,内核不支持,modprobe无法加载。

另一个关键核心在于modprobe的型号,mt7921u,而非我猜测的MT7961。尽管网上一些资料显示,这两个应该是套壳。

特别感谢

@Bryan

@186******75

参考链接:https://github.com/morrownr/USB-WiFi/blob/main/home/USB_WiFi_Adapters_that_are_supported_with_Linux_in-kernel_drivers.md


系统版本:deepin-desktop-community-20.9-amd64

PC硬件:联想Thinkcenter M720q-N000,I5-9500T

设备硬件:COMSFAST CF-952AX USB wifi6 无线网卡 (从官网链接下载的Linux驱动推测,芯片应该是MT7961)

我的尝试:

因为这个机器没有网络,只能安装原版系统后直接操作。

1.在官方驱动里wlan_driver文件夹里make -f Makefile.x86 MTK_COMBO_CHIP=MT7961 hif=usb编译,但报错,代码如下:

xxx@xxx-deepin:~/Desktop/comfastCF954AX-linux-driver/wlan_driver$ sudo -i
请输入密码:
验证成功
root@xxx-deepin:/home/xxx/Desktop/comfastCF954AX-linux-driver# make -f Makefile.x86 MTK_COMBO_CHIP=MT7961 hif=usb^C
root@xxx-deepin:/home/xxx/Desktop/comfastCF954AX-linux-driver# cd wlan_driver/
root@xxx-deepin:/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver# make -f Makefile.x86 MTK_COMBO_CHIP=MT7961 hif=usb
cd /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver && make -C /lib/modules/5.18.17-amd64-desktop-community-hwe/build M=/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver PLATFORM_FLAGS="-DCFG_TX_DIRECT=1 -DCFG_RX_DIRECT=1 -DCFG_USB_REQ_TX_DATA_FFA_CNT=10 -DCFG_USB_REQ_TX_DATA_CNT=2 -DCFG_USB_REQ_RX_DATA_CNT=2 -DCFG_SUPPORT_PERMON=1 -DCFG_SUPPORT_WIFI_SYSDVT=0 -DCFG_SUPPORT_DMASHDL_SYSDVT=0 -DCFG_P2P_SCAN_REPORT_ALL_BSS=0 -DCFG_SDIO_RX_AGG_WORKQUE=0 -DCFG_BUILD_X86_PLATFORM" modules
make[1]: 进入目录“/usr/src/linux-headers-5.18.17-amd64-desktop-community-hwe”
warning: the compiler differs from the one used to build the kernel
  The kernel was built by: gcc (Uos 8.3.0.5-1+dde) 8.3.0
  You are using:           gcc (Uos 8.3.0.3-3+rebuild) 8.3.0
os option: linux
$MTK_PLATFORM is []
$WLAN_CHIP_ID is []
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/Makefile:783: wlan_mt7961_usb is kernel module
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/common/dump.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/common/wlan_lib.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/common/wlan_oid.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/common/wlan_bow.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/common/debug.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/common/wlan_p2p.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/common/wlan_he.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_tx.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_txd_v1.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_rxd_v1.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_rx.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_pwr_mgt.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_rate.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/cmd_buf.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/que_mgt.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_cmd_event.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_umac.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_ext_cmd_event.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_txd_v2.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/nic_rxd_v2.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/nic/p2p_nic.o
  CC [M]  /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.o
In file included from ./include/linux/string.h:253,
                 from ./include/linux/bitmap.h:11,
                 from ./include/linux/cpumask.h:12,
                 from ./arch/x86/include/asm/cpumask.h:5,
                 from ./arch/x86/include/asm/msr.h:11,
                 from ./arch/x86/include/asm/processor.h:22,
                 from ./arch/x86/include/asm/timex.h:5,
                 from ./include/linux/timex.h:67,
                 from ./include/linux/time32.h:13,
                 from ./include/linux/time.h:60,
                 from ./include/linux/ktime.h:24,
                 from ./include/linux/timer.h:6,
                 from /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/include/gl_os.h:126,
                 from /home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:75:
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c: In function ‘wlanSetMacAddress’:
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:2186:20: error: passing argument 1 of ‘__builtin_memcpy’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
  COPY_MAC_ADDR(ndev->dev_addr, sa->sa_data);
                ~~~~^~~~~~~~~~
./include/linux/fortify-string.h:362:20: note: in definition of macro ‘__fortify_memcpy_chk’
  __underlying_##op(p, q, __fortify_size);   \
                    ^
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/include/gl_kal.h:1054:2: note: in expansion of macro ‘memcpy’
  memcpy(pvDst, pvSrc, u4Size)
  ^~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/include/nic/mac.h:3727:2: note: in expansion of macro ‘kalMemCopy’
  kalMemCopy(_pucDestAddr, _pucSrcAddr, MAC_ADDR_LEN)
  ^~~~~~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:2186:2: note: in expansion of macro ‘COPY_MAC_ADDR’
  COPY_MAC_ADDR(ndev->dev_addr, sa->sa_data);
  ^~~~~~~~~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:2186:20: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
  COPY_MAC_ADDR(ndev->dev_addr, sa->sa_data);
                ~~~~^~~~~~~~~~
./include/linux/fortify-string.h:362:20: note: in definition of macro ‘__fortify_memcpy_chk’
  __underlying_##op(p, q, __fortify_size);   \
                    ^
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/include/gl_kal.h:1054:2: note: in expansion of macro ‘memcpy’
  memcpy(pvDst, pvSrc, u4Size)
  ^~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/include/nic/mac.h:3727:2: note: in expansion of macro ‘kalMemCopy’
  kalMemCopy(_pucDestAddr, _pucSrcAddr, MAC_ADDR_LEN)
  ^~~~~~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:2186:2: note: in expansion of macro ‘COPY_MAC_ADDR’
  COPY_MAC_ADDR(ndev->dev_addr, sa->sa_data);
  ^~~~~~~~~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c: In function ‘wlanOnPreNetRegister’:
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4935:39: error: passing argument 1 of ‘__builtin_memcpy’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    kalMemCopy(prGlueInfo->prDevHandler->dev_addr,
               ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
./include/linux/fortify-string.h:362:20: note: in definition of macro ‘__fortify_memcpy_chk’
  __underlying_##op(p, q, __fortify_size);   \
                    ^
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/include/gl_kal.h:1054:2: note: in expansion of macro ‘memcpy’
  memcpy(pvDst, pvSrc, u4Size)
  ^~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4935:4: note: in expansion of macro ‘kalMemCopy’
    kalMemCopy(prGlueInfo->prDevHandler->dev_addr,
    ^~~~~~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4935:39: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
    kalMemCopy(prGlueInfo->prDevHandler->dev_addr,
               ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
./include/linux/fortify-string.h:362:20: note: in definition of macro ‘__fortify_memcpy_chk’
  __underlying_##op(p, q, __fortify_size);   \
                    ^
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/include/gl_kal.h:1054:2: note: in expansion of macro ‘memcpy’
  memcpy(pvDst, pvSrc, u4Size)
  ^~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4935:4: note: in expansion of macro ‘kalMemCopy’
    kalMemCopy(prGlueInfo->prDevHandler->dev_addr,
    ^~~~~~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4950:27: error: passing argument 1 of ‘__builtin_memcpy’ discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    kalMemCopy(prDevHandler->dev_addr,
               ~~~~~~~~~~~~^~~~~~~~~~
./include/linux/fortify-string.h:362:20: note: in definition of macro ‘__fortify_memcpy_chk’
  __underlying_##op(p, q, __fortify_size);   \
                    ^
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/include/gl_kal.h:1054:2: note: in expansion of macro ‘memcpy’
  memcpy(pvDst, pvSrc, u4Size)
  ^~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4950:4: note: in expansion of macro ‘kalMemCopy’
    kalMemCopy(prDevHandler->dev_addr,
    ^~~~~~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4950:27: note: expected ‘void *’ but argument is of type ‘const unsigned char *’
    kalMemCopy(prDevHandler->dev_addr,
               ~~~~~~~~~~~~^~~~~~~~~~
./include/linux/fortify-string.h:362:20: note: in definition of macro ‘__fortify_memcpy_chk’
  __underlying_##op(p, q, __fortify_size);   \
                    ^
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/include/gl_kal.h:1054:2: note: in expansion of macro ‘memcpy’
  memcpy(pvDst, pvSrc, u4Size)
  ^~~~~~
/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.c:4950:4: note: in expansion of macro ‘kalMemCopy’
    kalMemCopy(prDevHandler->dev_addr,
    ^~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:289:/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver/os/linux/gl_init.o] 错误 1
make[1]: *** [Makefile:1838:/home/xxx/Desktop/comfastCF954AX-linux-driver/wlan_driver] 错误 2
make[1]: 离开目录“/usr/src/linux-headers-5.18.17-amd64-desktop-community-hwe”
make: *** [Makefile.x86:215:driver] 错误 2

2.把FW文件夹下的bin文件复制到lib/firmware/mediatek文件夹,并参考文件夹内的其他文件修改权限。

以上尝试均失败。

各位大佬可否指点一下?

参考资料:

How_to_Install_Firmware_for_Mediatek_based_USB_WiFi_adapters.md

How to install driver for Wi-Fi Mediatek MT7921 and Mediatek MT7961 in Linux--没有网,没有尝试。。。

Reply Favorite View the author
All Replies
Bryan
deepin
2023-08-22 21:21
#1

可以尝试升级到6.3以及后续版本的内核

参考资料:

https://github.com/morrownr/USB-WiFi/blob/main/home/USB_WiFi_Adapters_that_are_supported_with_Linux_in-kernel_drivers.md 里面 AliExpress - 21 USD - COMFAST CF-953AX 那一部分

Reply View the author
186******75
deepin
2023-08-22 22:35
#2

编译完了没有错误提示呀
截图_选择区域_20230822143317.png

Reply View the author
186******75
deepin
2023-08-22 22:36
#3

我用5.7.7内核编译的,你的内核可能版本太高了,与驱动不符合

Reply View the author
观星者
deepin
2023-08-22 22:47
#4
186******75

我用5.7.7内核编译的,你的内核可能版本太高了,与驱动不符合

感谢帮助,这确实有可能,我的版本是5.18.17,新内核反倒不能用么。。。ε=(´ο`*)))唉

您用的哪个版本的deepin?是自己替换的5.7.7内核吗?

另外想请教一下,我的这两种操作思路是否正确?

1.直接复制bin文件,如果版本正确,硬件设备会直接可用吗?

2.编译成功后是否还需要一个make install?

谢谢!

Reply View the author
观星者
deepin
2023-08-22 22:48
#5
Bryan

可以尝试升级到6.3以及后续版本的内核

参考资料:

https://github.com/morrownr/USB-WiFi/blob/main/home/USB_WiFi_Adapters_that_are_supported_with_Linux_in-kernel_drivers.md 里面 AliExpress - 21 USD - COMFAST CF-953AX 那一部分

非常感谢!

6.3的内核,deepin支持么?主要是现在这个机子连不上网

是需要单独升级替换内核吧?

Reply View the author
观星者
deepin
2023-08-22 22:56
#6
Bryan

可以尝试升级到6.3以及后续版本的内核

参考资料:

https://github.com/morrownr/USB-WiFi/blob/main/home/USB_WiFi_Adapters_that_are_supported_with_Linux_in-kernel_drivers.md 里面 AliExpress - 21 USD - COMFAST CF-953AX 那一部分

If your adapter is not plug and play, see below.

952是不能即插即用的。

我试试下边的方法哈。

Reply View the author
186******75
deepin
2023-08-22 23:17
#7
观星者

感谢帮助,这确实有可能,我的版本是5.18.17,新内核反倒不能用么。。。ε=(´ο`*)))唉

您用的哪个版本的deepin?是自己替换的5.7.7内核吗?

另外想请教一下,我的这两种操作思路是否正确?

1.直接复制bin文件,如果版本正确,硬件设备会直接可用吗?

2.编译成功后是否还需要一个make install?

谢谢!

我用了好多个内核,我最后发现5.7.7最适合我的电脑,网速最快,开机快。我就把高版本内核删除了。是否要用make install来安装,这要你驱动的说明书,每个是不一样的。有些这样可以,有的就不行。

Reply View the author
186******75
deepin
2023-08-22 23:19
#8
观星者

感谢帮助,这确实有可能,我的版本是5.18.17,新内核反倒不能用么。。。ε=(´ο`*)))唉

您用的哪个版本的deepin?是自己替换的5.7.7内核吗?

另外想请教一下,我的这两种操作思路是否正确?

1.直接复制bin文件,如果版本正确,硬件设备会直接可用吗?

2.编译成功后是否还需要一个make install?

谢谢!

我的也是20.9

Reply View the author
观星者
deepin
2023-08-23 00:13
#9
186******75

我的也是20.9

收到谢谢😃

Reply View the author
观星者
deepin
2023-08-23 00:14
#10
Bryan

可以尝试升级到6.3以及后续版本的内核

参考资料:

https://github.com/morrownr/USB-WiFi/blob/main/home/USB_WiFi_Adapters_that_are_supported_with_Linux_in-kernel_drivers.md 里面 AliExpress - 21 USD - COMFAST CF-953AX 那一部分

修改vid/pid之后,有无线wifi的选项了,但是无法开启,点击开启按钮没反应😭

Reply View the author
Bryan
deepin
2023-08-23 04:00
#11
观星者

修改vid/pid之后,有无线wifi的选项了,但是无法开启,点击开启按钮没反应😭

无法开启?

你执行 sudo rfkill list all看一下网卡是不是被 block了,如果是的话,执行 sudo rfkill unblock all将它解开

Reply View the author