0%

Ubuntu18.04下安装rtl8821CU网卡(CF-WU910A)

Key: rtl8821CU,COMFAST CF-WU910A,Linux Ubuntu18.04安装报错,如下:

71031_COEX20170310-1212/include/osdep_service_linux.h:295:8: error: ‘_timer {aka struct timer_list}’ has no member named ‘data’
  ptimer->data = (unsigned long)cntx;
        ^~
/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/include/osdep_service_linux.h:296:2: error: implicit declaration of function ‘init_timer’; did you mean ‘_init_timer’? [-Werror=implicit-function-declaration]
  init_timer(ptimer);
  ^~~~~~~~~~
  _init_timer
In file included from /home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/include/drv_types.h:32:0,
                 from /home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/core/rtw_cmd.c:22:
/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/include/osdep_service.h: In function ‘thread_enter’:
/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/include/osdep_service.h:363:2: error: implicit declaration of function ‘allow_signal’; did you mean ‘do_signal’? [-Werror=implicit-function-declaration]
  allow_signal(SIGTERM);
  ^~~~~~~~~~~~
  do_signal
/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/include/osdep_service.h: In function ‘flush_signals_thread’:
/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/include/osdep_service.h:385:6: error: implicit declaration of function ‘signal_pending’; did you mean ‘timer_pending’? [-Werror=implicit-function-declaration]
  if (signal_pending(current))
      ^~~~~~~~~~~~~~
      timer_pending
/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/include/osdep_service.h:386:3: error: implicit declaration of function ‘flush_signals’; did you mean ‘do_signal’? [-Werror=implicit-function-declaration]
   flush_signals(current);
   ^~~~~~~~~~~~~
   do_signal
cc1: some warnings being treated as errors
scripts/Makefile.build:323: recipe for target '/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/core/rtw_cmd.o' failed
make[2]: *** [/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212/core/rtw_cmd.o] Error 1
Makefile:1534: recipe for target '_module_/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212' failed
make[1]: *** [_module_/home/harry/wifi/RTL8821CU/RTL8821CU_WiFi_linux_v5.2.5.3_24795_COEX20170310-1212.20171031/driver/rtl8821CU_WiFi_linux_v5.2.5.3_24795.20171031_COEX20170310-1212] Error 2
make[1]: 离开目录“/usr/src/linux-headers-4.18.0-21-generic”
Makefile:1893: recipe for target 'modules' failed
make: *** [modules] Error 2
##################################################
Compile make driver error: 2
Please check error Mesg
##################################################

安装教程

参考Github:https://github.com/whitebatman2/rtl8821CU

git clone https://github.com/whitebatman2/rtl8821CU
cd rtl8821CU
sudo apt-get install dkms
DRV_NAME=rtl8821CU
DRV_VERSION=5.2.5.3
sudo mkdir /usr/src/${DRV_NAME}-${DRV_VERSION}
git archive master | sudo tar -x -C /usr/src/${DRV_NAME}-${DRV_VERSION}
sudo dkms add -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms build -m ${DRV_NAME} -v ${DRV_VERSION}
sudo dkms install -m ${DRV_NAME} -v ${DRV_VERSION}


#下面切换USB模式
lsusb
#这个后面的ID是你看到的那个
sudo usb_modeswitch -KW -v 0bda -p 1a2b

我的是这样的:

root@harry-O-E-M:~/wifigit/rtl8821CU# lsusb
Bus 002 Device 002: ID 0bda:1a2b Realtek Semiconductor Corp.   #这个
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

我们使用nmcli dev查看已启用的网卡:

root@harry-O-E-M:~/wifigit/rtl8821CU# nmcli dev
DEVICE           TYPE      STATE   CONNECTION
wlp5s0           wifi      已连接  1003N
wlx40a5eff71b6d  wifi      已断开  --
enp4s0           ethernet  不可用  --
lo               loopback  未托管  --

下一步连接WIFI

nmtui  #会出现一个图形化界面就可以愉快的连上wifi了!