raspberry and wifi dongle with rtl8192cu chip

If like me you bought a wifi dongle based on Realtek rtl8192cu chip, this post will resolve kernel panics, or freeze problems

I bought the wifi dongle TRENDnet TEW-648UBM, and looking for a wifi driver which support him.

After some research, i found wifi usb driver called rtl8192cu.

The reason of this name is like many usb wifi dongle, my wifi adapter use a Realtek rtl8192cu chip.

So modified my .config in order to compil and use this driver :

CONFIG_MAC80211=Y
CONFIG_USB=Y
CONFIG_RTL8192CU=m

This will create a module calla rtl8192cu.ko . I Power on my raspberry, plug my wiif adapter, and load his driver :

$insmod ./rtl8192cu.ko

Aftew few seconds a obtained a kernel panic, and a system who freeze with the command lsusb

[ 241.380215] INFO: task modprobe:558 blocked for more than 120 seconds.
[ 241.388878] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
[ 241.400929] modprobe D c03beaa4 4340 558 1 0x00000000
[ 241.409652] [<c03beaa4>] (__schedule+0x3d8/0x564) from [<c03bed54>] (schedule+0x50/0x68)
[ 241.422317] [<c03bed54>] (schedule+0x50/0x68) from [<c03bf15c>] (schedule_timeout+0x228/0x284)
[ 241.435853] [<c03bf15c>] (schedule_timeout+0x228/0x284) from [<c03be534>] (wait_for_common+0x110/0x14c)
[ 241.450569] [<c03be534>] (wait_for_common+0x110/0x14c) from [<c03be610>] (wait_for_completion_timeout+0x18/0x1c)
[ 241.466332] [<c03be610>] (wait_for_completion_timeout+0x18/0x1c) from [<c02b9b00>] (usb_start_wait_urb+0x68/0xd0)
[ 241.482517] [<c02b9b00>] (usb_start_wait_urb+0x68/0xd0) from [<c02b9d68>] (usb_control_msg+0xd0/0xf4)

Is a problem with my raspberry (usb bus), my dongle or his driver?

I insert usb storage key, usb webcam, no error detected. It’s not a usb issue.

I insert my dongle, on my Debian squeeze desktop, no problem.

This kernel panic was due to driver or environment (udev,…) failure.

After few minutes “googleling”, i discover .zip archive developped by TRENDnet, contained the “good” driver for rtl8192cu chip.

Download it and uses this Makefile :

CROSS_COMPILE=arm-linux-gnueabi-
WIRELESS_SOURCES_VERSION=RTL8192xC_USB_linux_v3.4.4_4749.20121105
WIRELESS_DIR=./wireless
KERNEL_DIR=../kernel
KERNEL_VERSION=rpi-3.2.23
DESTDIR= #your raspberry filesystem

all: extract compil install

extract:
@(unzip $(WIRELESS_DIR)/$(WIRELESS_SOURCES_VERSION).zip -d $(WIRELESS_DIR))
@(cd $(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/driver/ ; tar xf rtl8188C_8192C_usb_linux_v3.4.4_4749.20121105.tar.gz \
--directory ../../$(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/driver/)

compil:
@(make -C $(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/driver/rtl8188C_8192C_usb_linux_v3.4.4_4749.20121105/ \
ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) \
KSRC=../../../$(KERNEL_DIR)/linux-$(KERNEL_VERSION) )

install:
@(make -C $(WIRELESS_DIR)/RTL8188C_8192C_USB_linux_v3.4.4_4749.20121105/driver/rtl8188C_8192C_usb_linux_v3.4.4_4749.20121105/ \
MODDESTDIR=$(DESTDIR) \
KVER=3.2.23 \
install)

.PHONY: extract compil install

$make all

will generate a module called 8192cu.ko. It will be installed in the /lib/modules/$(uname -r)/ directory on your rpi filesystem.

Use ‘chroot’ command or reboot your raspberry for update modules dependancy file /lib/modules/$(uname -r)/modules.dep like that :

$depmod -q

you can verifiy this with the command :


$tail /lib/modules/3.2.23/modules.dep
[…]
kernel/drivers/net/wireless/8192cu.ko:

Now you need to indicate to kernel that you absolutely want to use this driver (8192cu) instead standard one (rtl8192cu).

This can be done in 2 steps:

  1. blacklist rtl8192cu driver

$echo « # replaced by 8192cu (Realtek driver) » >> /etc/modprobe.d/blacklist.conf
$echo « blacklist rtl8192cu » >> /etc/modprobe.d/blacklist.conf 
  1. Update /etc/modules file in order to load this module at boot time
$echo «#wifi realtek driver instead of rtl8192cu kernel driver » >> /etc/modules
$echo «8192cu » >> /etc/modules

reboot your rpi or load the driver

modprobre rtl8192cu

Now enjoy :

$iwconfig
lo no wireless extensions.
wlan0 unassociated Nickname:"<WIFI@REALTEK>"
 Mode:Auto Frequency=2.412 GHz Access Point: Not-Associated
 Sensitivity:0/0
 Retry:off RTS thr:off Fragment thr:off
 Encryption key:off
 Power Management:off
 Link Quality:0 Signal level:0 Noise level:0
 Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
 Tx excessive retries:0 Invalid misc:0 Missed beacon:0
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *