# Problem wlan driver installation rtl8192cu

## alocacoc

Dear friends,

my card is a ASUS N13 USB WIFI card. The following lsusb gives me this:

```
#lsusb

Bus 001 Device 002: ID 0b05:17ab ASUSTek Computer, Inc. USB-N13 802.11n Network Adapter (rev. B1) [Realtek RTL8192CU]
```

The kernel driver itself seems to be buggy, which is confirmed by other users in other distro forums. the connection can be established and used, but its hanging somewhen after some minutes and the usb dongle needs to be replugged in to make it work again.

To solve the problem I have to install the driver from the RealTek website, which is: RTL819xC_USB_linux_v3.4.4_4749.20120806.zip

The makefile, which works for example in Ubuntu well (tested by me), isn't working in Gentoo for a reason which I don't know and the code looks very complex to me.

This is the makefile:

```
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)

EXTRA_CFLAGS += -O1

#EXTRA_CFLAGS += -O3

#EXTRA_CFLAGS += -Wall

#EXTRA_CFLAGS += -Wextra

#EXTRA_CFLAGS += -Werror

#EXTRA_CFLAGS += -pedantic

#EXTRA_CFLAGS += -Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes

EXTRA_CFLAGS += -Wno-unused-variable

EXTRA_CFLAGS += -Wno-unused-value

EXTRA_CFLAGS += -Wno-unused-label

EXTRA_CFLAGS += -Wno-unused-parameter

EXTRA_CFLAGS += -Wno-unused-function

EXTRA_CFLAGS += -Wno-unused

EXTRA_CFLAGS += -Wno-uninitialized

EXTRA_CFLAGS += -I$(src)/include

CONFIG_AUTOCFG_CP = n

CONFIG_RTL8192C = y

CONFIG_RTL8192D = n

CONFIG_USB_HCI = y

CONFIG_PCI_HCI = n

CONFIG_SDIO_HCI = n

CONFIG_MP_INCLUDED = n

CONFIG_POWER_SAVING         =   y

CONFIG_USB_AUTOSUSPEND         =   n

CONFIG_HW_PWRP_DETECTION      =   n

CONFIG_WIFI_TEST                  =   n

CONFIG_BT_COEXISTENCE            = n

CONFIG_RTL8192CU_REDEFINE_1X1 =n

CONFIG_WAKE_ON_WLAN            =   n

CONFIG_PLATFORM_I386_PC = y

CONFIG_PLATFORM_TI_AM3517 = n

CONFIG_PLATFORM_ANDROID_X86 = n

CONFIG_PLATFORM_ARM_S3C2K4 = n

CONFIG_PLATFORM_ARM_PXA2XX = n

CONFIG_PLATFORM_ARM_S3C6K4 = n

CONFIG_PLATFORM_MIPS_RMI = n

CONFIG_PLATFORM_RTD2880B = n

CONFIG_PLATFORM_MIPS_AR9132 = n

CONFIG_PLATFORM_RTK_DMP = n

CONFIG_PLATFORM_MIPS_PLM = n

CONFIG_PLATFORM_MSTAR389 = n

CONFIG_PLATFORM_MT53XX = n

CONFIG_PLATFORM_ARM_MX51_241H = n

CONFIG_PLATFORM_ACTIONS_ATJ227X = n

CONFIG_PLATFORM_ARM_TEGRA3 = n

CONFIG_PLATFORM_ARM_TCC8900 = n

CONFIG_PLATFORM_ARM_TCC8920 = n

CONFIG_PLATFORM_ARM_RK2818 = n

CONFIG_PLATFORM_ARM_TI_PANDA = n

CONFIG_PLATFORM_MIPS_JZ4760 = n

CONFIG_PLATFORM_DMP_PHILIPS = n

CONFIG_PLATFORM_TI_DM365   =   n

CONFIG_PLATFORM_MN10300 = n

CONFIG_PLATFORM_MSTAR_TITANIA12 = n

CONFIG_DRVEXT_MODULE = n

export TopDIR ?= $(shell pwd)

ifeq ($(CONFIG_RTL8712), y)

RTL871X = rtl8712

ifeq ($(CONFIG_SDIO_HCI), y)

MODULE_NAME = 8712s

endif

ifeq ($(CONFIG_USB_HCI), y)

MODULE_NAME = 8712u

endif

endif

ifeq ($(CONFIG_RTL8192C), y)

RTL871X = rtl8192c

ifeq ($(CONFIG_SDIO_HCI), y)

MODULE_NAME = 8192cs

endif

ifeq ($(CONFIG_USB_HCI), y)

MODULE_NAME = 8192cu

FW_FILES := hal/$(RTL871X)/usb/Hal8192CUHWImg.o

ifneq ($(CONFIG_WAKE_ON_WLAN), n)

FW_FILES += hal/$(RTL871X)/usb/Hal8192CUHWImg_wowlan.o

endif

endif

ifeq ($(CONFIG_PCI_HCI), y)

MODULE_NAME = 8192ce

FW_FILES := hal/$(RTL871X)/pci/Hal8192CEHWImg.o

endif

CHIP_FILES := hal/$(RTL871X)/$(RTL871X)_sreset.o

CHIP_FILES += $(FW_FILES)

endif

ifeq ($(CONFIG_RTL8192D), y)

RTL871X = rtl8192d

ifeq ($(CONFIG_SDIO_HCI), y)

MODULE_NAME = 8192ds

endif

ifeq ($(CONFIG_USB_HCI), y)

MODULE_NAME = 8192du

FW_FILES := hal/$(RTL871X)/usb/Hal8192DUHWImg.o \

         hal/$(RTL871X)/usb/Hal8192DUTestHWImg.o

ifneq ($(CONFIG_WAKE_ON_WLAN), n)

FW_FILES += hal/$(RTL871X)/usb/Hal8192DUHWImg_wowlan.o

endif

endif

ifeq ($(CONFIG_PCI_HCI), y)

MODULE_NAME = 8192de

FW_FILES := hal/$(RTL871X)/pci/Hal8192DEHWImg.o \

         hal/$(RTL871X)/pci/Hal8192DETestHWImg.o

endif

CHIP_FILES += $(FW_FILES)

endif

ifeq ($(CONFIG_SDIO_HCI), y)

HCI_NAME = sdio

_OS_INTFS_FILES :=   os_dep/osdep_service.o \

         os_dep/linux/os_intfs.o \

         os_dep/linux/sdio_intf.o \

         os_dep/linux/ioctl_linux.o \

         os_dep/linux/xmit_linux.o \

         os_dep/linux/mlme_linux.o \

         os_dep/linux/recv_linux.o \

         os_dep/linux/rtw_android.o

_HAL_INTFS_FILES := hal/$(RTL871X)/hal_init.o \

          hal/$(RTL871X)/sdio_halinit.o \

          hal/$(RTL871X)/sdio_ops.o \

          hal/$(RTL871X)/sdio_ops_linux.o

endif

ifeq ($(CONFIG_USB_HCI), y)

HCI_NAME = usb

_OS_INTFS_FILES :=   os_dep/osdep_service.o \

         os_dep/linux/os_intfs.o \

         os_dep/linux/$(HCI_NAME)_intf.o \

         os_dep/linux/ioctl_linux.o \

         os_dep/linux/xmit_linux.o \

         os_dep/linux/mlme_linux.o \

         os_dep/linux/recv_linux.o   \

         os_dep/linux/ioctl_cfg80211.o \

         os_dep/linux/rtw_android.o

_HAL_INTFS_FILES :=   hal/hal_init.o \

                        hal/$(RTL871X)/$(RTL871X)_hal_init.o \

         hal/$(RTL871X)/$(RTL871X)_phycfg.o \

         hal/$(RTL871X)/$(RTL871X)_rf6052.o \

         hal/$(RTL871X)/$(RTL871X)_dm.o \

         hal/$(RTL871X)/$(RTL871X)_rxdesc.o \

         hal/$(RTL871X)/$(RTL871X)_cmd.o \

         hal/$(RTL871X)/$(RTL871X)_mp.o \

         hal/$(RTL871X)/usb/usb_ops_linux.o \

         hal/$(RTL871X)/usb/usb_halinit.o \

         hal/$(RTL871X)/usb/rtl$(MODULE_NAME)_led.o \

         hal/$(RTL871X)/usb/rtl$(MODULE_NAME)_xmit.o \

         hal/$(RTL871X)/usb/rtl$(MODULE_NAME)_recv.o

_HAL_INTFS_FILES += $(CHIP_FILES)

endif

ifeq ($(CONFIG_PCI_HCI), y)

HCI_NAME = pci

_OS_INTFS_FILES :=   os_dep/osdep_service.o \

         os_dep/linux/os_intfs.o \

         os_dep/linux/$(HCI_NAME)_intf.o \

         os_dep/linux/ioctl_linux.o \

         os_dep/linux/xmit_linux.o \

         os_dep/linux/mlme_linux.o \

         os_dep/linux/recv_linux.o \

         os_dep/linux/rtw_android.o

_HAL_INTFS_FILES :=   hal/hal_init.o \

                        hal/$(RTL871X)/$(RTL871X)_hal_init.o \

         hal/$(RTL871X)/$(RTL871X)_phycfg.o \

         hal/$(RTL871X)/$(RTL871X)_rf6052.o \

         hal/$(RTL871X)/$(RTL871X)_dm.o \

         hal/$(RTL871X)/$(RTL871X)_rxdesc.o \

         hal/$(RTL871X)/$(RTL871X)_cmd.o \

         hal/$(RTL871X)/$(RTL871X)_mp.o \

         hal/$(RTL871X)/pci/pci_ops_linux.o \

         hal/$(RTL871X)/pci/pci_halinit.o \

         hal/$(RTL871X)/pci/rtl$(MODULE_NAME)_led.o \

         hal/$(RTL871X)/pci/rtl$(MODULE_NAME)_xmit.o \

         hal/$(RTL871X)/pci/rtl$(MODULE_NAME)_recv.o

_HAL_INTFS_FILES += $(CHIP_FILES)

endif

ifeq ($(CONFIG_AUTOCFG_CP), y)

$(shell cp $(TopDIR)/autoconf_$(RTL871X)_$(HCI_NAME)_linux.h $(TopDIR)/include/autoconf.h)

endif

ifeq ($(CONFIG_USB_HCI), y)

ifeq ($(CONFIG_USB_AUTOSUSPEND), y)

EXTRA_CFLAGS += -DCONFIG_USB_AUTOSUSPEND

endif

endif

ifeq ($(CONFIG_POWER_SAVING), y)

EXTRA_CFLAGS += -DCONFIG_POWER_SAVING

endif

ifeq ($(CONFIG_HW_PWRP_DETECTION), y)

EXTRA_CFLAGS += -DCONFIG_HW_PWRP_DETECTION

endif

ifeq ($(CONFIG_WIFI_TEST), y)

EXTRA_CFLAGS += -DCONFIG_WIFI_TEST

endif

ifeq ($(CONFIG_BT_COEXISTENCE), y)

EXTRA_CFLAGS += -DCONFIG_BT_COEXISTENCE

endif

ifeq ($(CONFIG_RTL8192CU_REDEFINE_1X1), y)

EXTRA_CFLAGS += -DRTL8192C_RECONFIG_TO_1T1R

endif

ifeq ($(CONFIG_WAKE_ON_WLAN), y)

EXTRA_CFLAGS += -DCONFIG_WAKE_ON_WLAN

endif

ifeq ($(CONFIG_PLATFORM_I386_PC), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)

ARCH ?= $(SUBARCH)

CROSS_COMPILE ?=

KVER  := $(shell uname -r)

KSRC := /lib/modules/$(KVER)/build

MODDESTDIR := /lib/modules/$(KVER)/kernel/drivers/net/wireless/

INSTALL_PREFIX :=

endif

ifeq ($(CONFIG_PLATFORM_TI_AM3517), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_SHUTTLE

CROSS_COMPILE := arm-eabi-

KSRC := $(shell pwd)/../../../Android/kernel

ARCH := arm

endif

ifeq ($(CONFIG_PLATFORM_MSTAR_TITANIA12), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR_TITANIA12

ARCH:=mips

CROSS_COMPILE:= /work/mstar/mips-4.3/bin/mips-linux-gnu-

KVER:= 2.6.28.9

KSRC:= /work/mstar/2.6.28.9/

endif

ifeq ($(CONFIG_PLATFORM_ANDROID_X86), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)

ARCH := $(SUBARCH)

CROSS_COMPILE := /media/DATA-2/android-x86/ics-x86_20120130/prebuilt/linux-x86/toolchain/i686-unknown-linux-gnu-4.2.1/bin/i686-unknown-linux-gnu-

KSRC := /media/DATA-2/android-x86/ics-x86_20120130/out/target/product/generic_x86/obj/kernel

MODULE_NAME :=wlan

endif

ifeq ($(CONFIG_PLATFORM_ARM_PXA2XX), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

ARCH := arm

CROSS_COMPILE := arm-none-linux-gnueabi-

KVER  := 2.6.34.1

KSRC ?= /usr/src/linux-2.6.34.1

endif

ifeq ($(CONFIG_PLATFORM_ARM_S3C2K4), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

ARCH := arm

CROSS_COMPILE := arm-linux-

KVER  := 2.6.24.7_$(ARCH)

KSRC := /usr/src/kernels/linux-$(KVER)

endif

ifeq ($(CONFIG_PLATFORM_ARM_S3C6K4), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

ARCH := arm

CROSS_COMPILE := arm-none-linux-gnueabi-

KVER  := 2.6.34.1

KSRC ?= /usr/src/linux-2.6.34.1

endif

ifeq ($(CONFIG_PLATFORM_RTD2880B), y)

EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN -DCONFIG_PLATFORM_RTD2880B

ARCH:=

CROSS_COMPILE:=

KVER:=

KSRC:=

endif

ifeq ($(CONFIG_PLATFORM_MIPS_RMI), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN

ARCH:=mips

CROSS_COMPILE:=mipsisa32r2-uclibc-

KVER:=

KSRC:= /root/work/kernel_realtek

endif

ifeq ($(CONFIG_PLATFORM_MIPS_PLM), y)

EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN

ARCH:=mips

CROSS_COMPILE:=mipsisa32r2-uclibc-

KVER:=

KSRC:= /root/work/kernel_realtek

endif

ifeq ($(CONFIG_PLATFORM_MSTAR389), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MSTAR389

ARCH:=mips

CROSS_COMPILE:= mips-linux-gnu-

KVER:= 2.6.28.10

KSRC:= /home/mstar/mstar_linux/2.6.28.9/

endif

ifeq ($(CONFIG_PLATFORM_MIPS_AR9132), y)

EXTRA_CFLAGS += -DCONFIG_BIG_ENDIAN

ARCH := mips

CROSS_COMPILE := mips-openwrt-linux-

KSRC := /home/alex/test_openwrt/tmp/linux-2.6.30.9

endif

ifeq ($(CONFIG_PLATFORM_DMP_PHILIPS), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM

ARCH := mips

#CROSS_COMPILE:=/usr/local/msdk-4.3.6-mips-EL-2.6.12.6-0.9.30.3/bin/mipsel-linux-

CROSS_COMPILE:=/usr/local/toolchain_mipsel/bin/mipsel-linux-

KSRC ?=/usr/local/Jupiter/linux-2.6.12

endif

ifeq ($(CONFIG_PLATFORM_RTK_DMP), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DRTK_DMP_PLATFORM

ARCH:=mips

CROSS_COMPILE:=mipsel-linux-

KVER:=

KSRC ?= /usr/src/work/DMP_Kernel/jupiter/linux-2.6.12

endif

ifeq ($(CONFIG_PLATFORM_MT53XX), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MT53XX

ARCH:= arm

CROSS_COMPILE:= arm11_mtk_le-

KVER:= 2.6.27

KSRC?= /proj/mtk00802/BD_Compare/BDP/Dev/BDP_V301/BDP_Linux/linux-2.6.27

endif

ifeq ($(CONFIG_PLATFORM_ARM_MX51_241H), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_WISTRON_PLATFORM

ARCH := arm

CROSS_COMPILE := /opt/freescale/usr/local/gcc-4.1.2-glibc-2.5-nptl-3/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-

KVER  := 2.6.31

KSRC ?= /lib/modules/2.6.31-770-g0e46b52/source

endif

ifeq ($(CONFIG_PLATFORM_ACTIONS_ATJ227X), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ACTIONS_ATJ227X

ARCH := mips

CROSS_COMPILE := /home/cnsd4/project/actions/tools-2.6.27/bin/mipsel-linux-gnu-

KVER  := 2.6.27

KSRC := /home/cnsd4/project/actions/linux-2.6.27.28

endif

ifeq ($(CONFIG_PLATFORM_TI_DM365), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_TI_DM365

ARCH := arm

CROSS_COMPILE := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-

KVER  := 2.6.18

KSRC := /home/cnsd4/Appro/mv_pro_5.0/montavista/pro/devkit/lsp/ti-davinci/linux-dm365

endif

ifeq ($(CONFIG_PLATFORM_ARM_TEGRA3), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE

ARCH ?= arm

CROSS_COMPILE ?= /media/DATA-1/nvidia/gingerbread/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-

KSRC ?= /media/DATA-1/nvidia/gingerbread/out/debug/target/product/cardhu/obj/KERNEL

MODULE_NAME := wlan

endif

ifeq ($(CONFIG_PLATFORM_ARM_TCC8900), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_MINIMAL_MEMORY_USAGE

ARCH ?= arm

CROSS_COMPILE ?= /media/DATA-1/telechips/SDK_2302_20110425/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-

KSRC ?=/media/DATA-1/telechips/SDK_2302_20110425/kernel

MODULE_NAME := wlan

endif

ifeq ($(CONFIG_PLATFORM_ARM_TCC8920), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE

ARCH := arm

CROSS_COMPILE := /media/DATA-2/telechips/ics_sdk/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-

KSRC := /media/DATA-2/telechips/ics_sdk/kernel

MODULE_NAME := wlan

endif

ifeq ($(CONFIG_PLATFORM_ARM_RK2818), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS -DCONFIG_MINIMAL_MEMORY_USAGE

ARCH := arm

CROSS_COMPILE := /usr/src/release_fae_version/toolchain/arm-eabi-4.4.0/bin/arm-eabi-

KSRC := /usr/src/release_fae_version/kernel25_A7_281x

MODULE_NAME := wlan

endif

ifeq ($(CONFIG_PLATFORM_ARM_TI_PANDA), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN #-DCONFIG_MINIMAL_MEMORY_USAGE

ARCH := arm

#CROSS_COMPILE := /media/DATA-1/aosp/ics-aosp_20111227/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-

#KSRC := /media/DATA-1/aosp/android-omap-panda-3.0_20120104

CROSS_COMPILE := /media/DATA-1/android-4.0/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-

KSRC := /media/DATA-1/android-4.0/panda_kernel/omap

MODULE_NAME := wlan

endif

ifeq ($(CONFIG_PLATFORM_MIPS_JZ4760), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_MINIMAL_MEMORY_USAGE

ARCH ?= mips

CROSS_COMPILE ?= /mnt/sdb5/Ingenic/Umido/mips-4.3/bin/mips-linux-gnu-

KSRC ?= /mnt/sdb5/Ingenic/Umido/kernel

endif

#Add setting for MN10300

ifeq ($(CONFIG_PLATFORM_MN10300), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_MN10300

ARCH := mn10300

CROSS_COMPILE := mn10300-linux-

KVER := 2.6.32.2

KSRC := /home/winuser/work/Plat_sLD2T_V3010/usr/src/linux-2.6.32.2

INSTALL_PREFIX :=

endif

ifeq ($(CONFIG_MP_INCLUDED), y)

MODULE_NAME := $(MODULE_NAME)_mp

EXTRA_CFLAGS += -DCONFIG_MP_INCLUDED

endif

ifneq ($(KERNELRELEASE),)

rtk_core :=   core/rtw_cmd.o \

      core/rtw_security.o \

      core/rtw_debug.o \

      core/rtw_io.o \

      core/rtw_ioctl_query.o \

      core/rtw_ioctl_set.o \

      core/rtw_ieee80211.o \

      core/rtw_mlme.o \

      core/rtw_mlme_ext.o \

      core/rtw_wlan_util.o \

      core/rtw_pwrctrl.o \

      core/rtw_rf.o \

      core/rtw_recv.o \

      core/rtw_sta_mgt.o \

      core/rtw_xmit.o   \

      core/rtw_p2p.o \

      core/rtw_br_ext.o \

      core/rtw_iol.o

$(MODULE_NAME)-y += $(rtk_core)

$(MODULE_NAME)-y += core/efuse/rtw_efuse.o

$(MODULE_NAME)-y += $(_HAL_INTFS_FILES)

$(MODULE_NAME)-y += $(_OS_INTFS_FILES)

$(MODULE_NAME)-$(CONFIG_MP_INCLUDED) += core/rtw_mp.o \

               core/rtw_mp_ioctl.o \

               core/rtw_ioctl_rtl.o

obj-$(CONFIG_RTL8192CU) := $(MODULE_NAME).o

else

export CONFIG_RTL8192CU = m

all: modules

modules:

   $(MAKE) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) -C $(KSRC) M=$(shell pwd)  modules

strip:

   $(CROSS_COMPILE)strip $(MODULE_NAME).ko --strip-unneeded

install:

   install -p -m 644 $(MODULE_NAME).ko  $(MODDESTDIR)

   /sbin/depmod -a ${KVER}

uninstall:

   rm -f $(MODDESTDIR)/$(MODULE_NAME).ko

   /sbin/depmod -a ${KVER}

config_r:

   @echo "make config"

   /bin/bash script/Configure script/config.in

.PHONY: modules clean

clean:

   rm -fr *.mod.c *.mod *.o .*.cmd *.ko *~

   rm .tmp_versions -fr ; rm Module.symvers -fr

   rm -fr Module.markers ; rm -fr modules.order

   cd core/efuse ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko

   cd core ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko

   cd hal/$(RTL871X)/$(HCI_NAME) ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko

   cd hal/$(RTL871X) ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko

   cd hal ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko

   cd os_dep/linux ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko

   cd os_dep ; rm -fr *.mod.c *.mod *.o .*.cmd *.ko

endif
```

This is the error I get when I use #make

```
    make ARCH=x86_64 CROSS_COMPILE= -C /lib/modules/3.5.0-gentoo/build M=/home/name/Downloads/RTL  modules

    make[1]: Entering directory `/usr/src/linux-3.5.0-gentoo'

    Makefile:323: /usr/src/linux-3.5.0-gentoo/scripts/Kbuild.include: No such file or directory

    Makefile:564: /usr/src/linux-3.5.0-gentoo/arch/x86/Makefile: No such file or directory

    /bin/sh: /usr/src/linux-3.5.0-gentoo/scripts/gcc-goto.sh: No such file or directory

    make[1]: *** No rule to make target `/usr/src/linux-3.5.0-gentoo/arch/x86/Makefile'.  Stop.

    make[1]: Leaving directory `/usr/src/linux-3.5.0-gentoo'

    make: *** [modules] Error 2
```

The driver directory includes many *.c files which I am surely not supposed to touch in the subdirectories: core, hal, include and os_dep. There are also files clean, ifcfg-wlan0, Kconfig wlan0dhcp and the makefile which I tried to execute.

I backlisted the kernel driver rtl8192cu. The new driver is supposed to be called 8192cu without the rtl.

Please help me to install the new driver so I can properly use my wlan card.

Thank you.Last edited by alocacoc on Mon Oct 29, 2012 2:24 pm; edited 1 time in total

----------

## alocacoc

If I use the command:

```
#make install
```

It will show the following message:

```
install -p -m 644 8192cu.ko  /lib/modules/3.5.0-gentoo/kernel/drivers/net/wireless/

install: cannot stat ‘8192cu.ko’: No such file or directory

make: *** [install] Error 1
```

The directory /lib/modules/3.5.0-gentoo/kernel/drivers/net/wireless/ exists.

Under /lib/modules/3.5.0-gentoo/kernel/drivers/net/wireless/rtlwifi/rtl8192cu/ is a file rtl8192cu.ko

Maybe this helps.Last edited by alocacoc on Mon Oct 29, 2012 2:24 pm; edited 1 time in total

----------

## alocacoc

I updated the kernel to 3.6.0, hope the kernel driver will work better. 

Is after a kernel update the new driver automatically used?

----------

## alocacoc

Unfortunately the kernel update did not change the problem.

----------

## khayyam

 *alocacoc wrote:*   

> 
> 
> ```
> KVER  := $(shell uname -r)
> 
> ...

 

alocacoc ... here is the source of the problem. You must be booted the target kernel (and so match 'uname -r') when compiling the module, and /lib/modules/$(KVER)/build must exist and point to the kernel sources (build -> /usr/src/linux-${KVER}). So, first 'make && make modules_install' for the target kernel, then install the kernel and boot it. You should then be able to compile the rtl8192cu module.

best ... khay

----------

## alocacoc

#uname -r

gives me:

3.6.0-gentoo

This kernel is booted now.

The directory /lib/modules/3.6.0-gentoo/build exists, it contains a makefile, Module.symvers, system.map, config and a directory called include.

The directory /usr/src/3.6.0-gentoo/ got quite the same files.

So it means my compiled kernel is 3.6.0 and I have also booted this kernel 3.6.0. 

Isn't my target kernel always the booted kernel?

With 'make &&make modules install' I will compile my kernel again, right?

How to link /lib/modules/3.6.0-gentoo/build to /usr/src/3.6.0-gentoo/?

Like this? 'ln -s /lib/modules/3.6.0-gentoo/build /usr/src/3.6.0-gentoo/'

Thank you for your help.

----------

## khayyam

 *alocacoc wrote:*   

> The directory /lib/modules/3.6.0-gentoo/build exists, it contains a makefile, Module.symvers, system.map, config and a directory called include.

 

alocacoc ... this will be a symlink to the kernel sources, its created when running 'make modules_install'.

 *alocacoc wrote:*   

> The directory /usr/src/3.6.0-gentoo/ got quite the same files.

 

This is incorrect ... the directory will/should be named '/usr/src/linux-3.6.0-gentoo/', I'm not sure why you have the above, or if its a typo on your part, but gentoo-sources should be installed as linux-{version}-gentoo.

 *alocacoc wrote:*   

> With 'make &&make modules install' I will compile my kernel again, right?

 

yes and no ... with the above (typo's) you'll just get an error as "space" is a specical character and the command is "&& make modules_install" not "make modules install". But, otherwise, yes the above will compile the kernel and install the modules.

 *alocacoc wrote:*   

> How to link /lib/modules/3.6.0-gentoo/build to /usr/src/3.6.0-gentoo/? Like this? 'ln -s /lib/modules/3.6.0-gentoo/build /usr/src/3.6.0-gentoo/'

 

No, firstly the link is created when 'make modules_install" is run, so there is no need to link, secondly the path is incorrect, thirdly, 'ln -s /from /to' and you have it visa-versa, and fourthly, to change a symlink the '-f' switch should be used.

best ... khay

----------

## alocacoc

You are 100% right, the directory is call /usr/src/linux-3.6.0-gentoo/, my typing mistake.

When I do in /lib/modules/3.6.0-gentoo/build

```
# make modules_install
```

I get this error:

```
Makefile:323: /usr/src/linux-3.6.0-gentoo/scripts/Kbuild.include: No such file or directory

Makefile:564: /usr/src/linux-3.6.0-gentoo/arch/x86/Makefile: No such file or directory

/bin/sh: /usr/src/linux-3.6.0-gentoo/scripts/gcc-goto.sh: No such file or directory

make: *** No rule to make target `/usr/src/linux-3.6.0-gentoo/arch/x86/Makefile'.  Stop.
```

It is quite the same error like when I try to make the wlan driver module, so I am doing something wrong in general here, nothing to do with the driver module itself I think.

The correct command would be 'ln -f /usr/src/linux-3.6.0-gentoo /lib/modules/3.6.0-gentoo/build', but I don't need it.

Thanks for your help.

----------

## khayyam

 *alocacoc wrote:*   

> When I do in /lib/modules/3.6.0-gentoo/build

 

alocacoc ... ignore /lib/modules/3.6.0-gentoo/build its just a symlink to /usr/src/linux-{version}-gentoo ... its there meerly to point a build at the sources for those modules.

 *alocacoc wrote:*   

> 
> 
> ```
> # make modules_install
> ```
> ...

 

Is this perhaps a VM? ... anyhow, the package isn't installed correctly as some files from that package are missing.

```
# equery belongs /usr/src/linux-3.6.4-geek/scripts/Kbuild.include

 * Searching for /usr/src/linux-3.6.4-geek/scripts/Kbuild.include ...

sys-kernel/geek-sources-3.6.4 (/usr/src/linux-3.6.4-geek/scripts/Kbuild.include)
```

 *alocacoc wrote:*   

> The correct command would be 'ln -f /usr/src/linux-3.6.0-gentoo /lib/modules/3.6.0-gentoo/build', but I don't need it.

 

carefull ... that would get you a hard link and not a symbolic link ... "ln -sf"

 *alocacoc wrote:*   

> Thanks for your help.

 

your welcome & best ... khay

----------

## alocacoc

Something was wrong with the sources. I reinstalled the 3.6.0 sources. Then I created the correct symbolic link to this source directory and installed the module with 'make modules' and 'make modules install'. Everything went correctly I guess. The module seems to be installed. I blacklisted the other driver rtl8192cu.

Now in KDE I see in the systray under WLAN Interfaces 'driver: rtl8192cu'. I am not sure how to see if my new driver is now actually working.

This are some commands where I'm not sure how to see if my module is now used by my wlan card.

```
# lsmod | grep 8192

8192cu                514313  0 

```

```

# grep 8192 /usr/src/linux/.config 

CONFIG_RTL8192CE=m

CONFIG_RTL8192SE=m

CONFIG_RTL8192DE=m

CONFIG_RTL8192CU=m

CONFIG_RTL8192C_COMMON=m

CONFIG_RTL8192U=m

CONFIG_RTL8192E=m
```

```
# systool -v -m 8192cu

Module = "8192cu"

  Attributes:

    coresize            = "514313"

    initsize            = "0"

    initstate           = "live"

    refcnt              = "0"

    srcversion          = "66BBB40DB96A36E5822F922"

    taint               = "O"

    uevent              = <store method only>

    version             = "v3.4.4_xxxx.20120730"

  Parameters:

    ifname              = "wlan%d"

    rtw_ampdu_amsdu     = "0"

    rtw_ampdu_enable    = "1"

    rtw_antdiv_cfg      = "2"

    rtw_busy_thresh     = "40"

    rtw_cbw40_enable    = "1"

    rtw_channel_plan    = "65"

    rtw_channel         = "1"

    rtw_chip_version    = "0"

    rtw_enusbss         = "0"

    rtw_force_iol       = "N"

    rtw_ht_enable       = "1"

    rtw_hwpdn_mode      = "2"

    rtw_hwpwrp_detect   = "0"

    rtw_initmac         = "(null)"

    rtw_intel_class_mode= "0"

    rtw_ips_mode        = "0"

    rtw_lbkmode         = "0"

    rtw_low_power       = "0"

    rtw_lowrate_two_xmit= "1"

    rtw_max_roaming_times= "2"

    rtw_mc2u_disable    = "0"

    rtw_mp_mode         = "0"

    rtw_network_mode    = "0"

    rtw_power_mgnt      = "1"

    rtw_rf_config       = "5"

    rtw_rfintfs         = "2"

    rtw_rx_stbc         = "1"

    rtw_vcs_type        = "1"

    rtw_vrtl_carrier_sense= "2"

    rtw_wifi_spec       = "0"

    rtw_wmm_enable      = "1"

  Sections:

    .bss                = "0xffffffffa071d300"

    .data               = "0xffffffffa0706540"

    .exit.text          = "0xffffffffa06fa730"

    .gnu.linkonce.this_module= "0xffffffffa071d0e0"

    .init.text          = "0xffffffffa072e000"

    .note.gnu.build-id  = "0xffffffffa06fa770"

    .rodata             = "0xffffffffa06fa7a0"

    .rodata.str1.1      = "0xffffffffa06fe9e5"

    .rodata.str1.8      = "0xffffffffa07012e0"

    .smp_locks          = "0xffffffffa07060a0"

    .strtab             = "0xffffffffa0738578"

    .symtab             = "0xffffffffa072e060"

    .text               = "0xffffffffa06af000"

    __param             = "0xffffffffa0706138"

```

```
# modinfo 8192cu

filename:       /lib/modules/3.6.0-gentoo/kernel/drivers/net/wireless/8192cu.ko

version:        v3.4.4_xxxx.20120730

author:         Realtek Semiconductor Corp.

description:    Realtek Wireless Lan Driver

license:        GPL

srcversion:     66BBB40DB96A36E5822F922

alias:          usb:v0BDAp8186d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0E66p0019d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0846p9021d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0B05p17ABd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0DF6p0061d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v20F4p624Dd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v050Dp2103d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v050Dp2102d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2001p3307d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v4855p0091d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v07AAp0056d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v07B8p8178d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2019pAB2Bd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v7392p7822d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0586p341Fd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2001p3309d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2001p330Ad*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2001p3307d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2019p1201d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v04F2pAFFCd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v04F2pAFFBd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v04F2pAFF8d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v04F2pAFFAd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v04F2pAFF9d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v04F2pAFF7d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v13D3p3358d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v13D3p3359d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp317Fd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2019pAB2Ed*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2019p4902d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v4856p0091d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp5088d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0DF6p005Cd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v13D3p3357d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v4855p0090d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v20F4p648Bd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2019pAB2Ad*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v050Dp1102d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2001p3308d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v103Cp1629d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v06F8pE033d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0EB0p9071d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v07B8p8189d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v7392p7811d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0DF6p0052d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v2019pED17d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp817Cd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp8178d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp8177d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp018Ad*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp818Ad*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp817Fd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp8754d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp817Dd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp817Bd*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp817Ad*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp817Ed*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp8170d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp8176d*dc*dsc*dp*ic*isc*ip*in*

alias:          usb:v0BDAp8191d*dc*dsc*dp*ic*isc*ip*in*

depends:        

vermagic:       3.6.0-gentoo SMP mod_unload modversions 

parm:           rtw_ips_mode:The default IPS mode (int)

parm:           ifname:charp

parm:           rtw_initmac:charp

parm:           rtw_channel_plan:int

parm:           rtw_chip_version:int

parm:           rtw_rfintfs:int

parm:           rtw_lbkmode:int

parm:           rtw_network_mode:int

parm:           rtw_channel:int

parm:           rtw_mp_mode:int

parm:           rtw_wmm_enable:int

parm:           rtw_vrtl_carrier_sense:int

parm:           rtw_vcs_type:int

parm:           rtw_busy_thresh:int

parm:           rtw_ht_enable:int

parm:           rtw_cbw40_enable:int

parm:           rtw_ampdu_enable:int

parm:           rtw_rx_stbc:int

parm:           rtw_ampdu_amsdu:int

parm:           rtw_lowrate_two_xmit:int

parm:           rtw_rf_config:int

parm:           rtw_power_mgnt:int

parm:           rtw_low_power:int

parm:           rtw_wifi_spec:int

parm:           rtw_antdiv_cfg:int

parm:           rtw_enusbss:int

parm:           rtw_hwpdn_mode:int

parm:           rtw_hwpwrp_detect:int

parm:           rtw_max_roaming_times:The max roaming times to try (uint)

parm:           rtw_force_iol:Force to enable IOL (bool)

parm:           rtw_intel_class_mode:The intel class mode [0: off, 1: on] (uint)

parm:           rtw_mc2u_disable:int

```

----------

## khayyam

 *alocacoc wrote:*   

> I'm not sure how to see if my module is now used by my wlan card.

 

alocacoc ...

```
# awk '{RS="\n\n"}/Realtek/' <(lspci -k)
```

The final line should read "Kernel driver in use:" ... but your best bet is to try and connect to an AP.

best ... khay

----------

## alocacoc

if I use

```
# lspci -k
```

It is showing me the kernel driver for devices like my eth0, but not for my usb devices. lsusb doesn't have the -k feature. How to see?

----------

## khayyam

 *alocacoc wrote:*   

> if I use lspci -k it is showing me the kernel driver for devices like my eth0, but not for my usb devices. lsusb doesn't have the -k feature. How to see?

 

alocacoc ... yes, sorry, I'd completely missed it was a USB device. The device registration should appear in /var/log/messages. However, if the device/driver is detected then you should see the network interface in iwconfig/ifconfig/iw.

best ... khay

----------

## waterloo2005

The newest driver 8192cu from realtex site only support Linux Kernel 2.6.18~2.6.38 and Kernel 3.0.8 .

----------

## waterloo2005

I meet the same problem in kernel gentoo-sources 3.6.11 .

Now how to do with it ?

Thanks

----------

## Poincare

I also experience the compile problem.  I am on kernel version  3.15.0.  

Can anyone help to make the 8192cu driver?  The one supplied by the kernel (module) is broken and repeatedly becomes unusable.  :Sad: 

----------

## donald3.heckel

Hello,

I see that you are having difficulty.

If all else fails, try ndiswrapper if necessary.

ndiswrapper uses windows xp .inf files to install windows drivers.

Here are the instructions: https://wiki.archlinux.org/index.php/Wireless_network_configuration#ndiswrapper

Ndiswrapper is available through portage.

run 

```
emerge ndiswrapper
```

then download the windows driver for your hardware at realtek's website.

```

mkdir realtek_windows-driver

mv longrealtekfilename.zip realtek_windows-driver

unzip longrealtekfilename.zip

cd longrealtekfoldername

cd RTWLANE_Driver

cd WinXP

ndiswrapper -i netrtwlane.inf

ndiswrapper -m

ndiswrapper -mi

ndiswrapper -l

(Outputs installed driver)

modprobe ndiswrapper

(if loaded successfully proceed below)

nano /etc/conf.d/modules

=====>modules="ndiswrapper"

reboot

```

Once the above processes have been completed,

you can reboot your system and your wireless internet connection should be working.

I hope this works for you.

Sincerely,

donald3.heckel

----------

