Bug 33352 - r8712u wlan driver cannot be configured with wireless_tools/iwconfig(8)
Summary: r8712u wlan driver cannot be configured with wireless_tools/iwconfig(8)
Status: CLOSED INVALID
Alias: None
Product: Drivers
Classification: Unclassified
Component: network-wireless (show other bugs)
Hardware: i386 Linux
: P1 high
Assignee: Larry Finger
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-15 21:58 UTC by clemens fischer
Modified: 2011-04-22 13:25 UTC (History)
3 users (show)

See Also:
Kernel Version: 2.6.37.x and 2.6.38.x all versions
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
Patch to add rtl8192su driver (311.38 KB, patch)
2011-04-20 00:38 UTC, Larry Finger
Details | Diff

Description clemens fischer 2011-04-15 21:58:21 UTC
I am using an USB wlan adapter in ad-hoc mode.  The product with the
working driver is listed by "usb-devices(1)" from the "usbutils" package
as:

T:  Bus=01 Lev=01 Prnt=01 Port=06 Cnt=01 Dev#=  3 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=0bda ProdID=8172 Rev=02.00
S:  Manufacturer=Manufacturer Realtek
S:  Product=RTL8191S WLAN Adapter
S:  SerialNumber=00e04c000001
C:  #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 4 Cls=ff(vend.) Sub=ff Prot=ff Driver=rtl819xU

I am marking this bug as a regression, because the driver assigned to
this product works in all kernel versions 2.6.36.x right from the
beginning, but stopped once 2.6.37+ came out, and the matching drivers
were reorganized.

Here's what I want the iwconfig(8) output to look like:

0 3 # iwconfig wlan0
wlan0     802.11b/g  link  ESSID:"yyyyyy"
          Mode:Ad-Hoc  Frequency=2.412 GHz  Cell: 12:7D:42:55:8D:38
          Bit Rate=54 Mb/s
          Retry min limit:7   RTS thr:off   Fragment thr:off
          Encryption key:xxxx-xxxx-xx   Security mode:restricted
          Power Management period:5s  mode:All packets received
          Link Quality=0/100  Signal level=0 dBm  Noise level=0 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

The wlan adapter is connected to the main PC, it acts as a simple wlan
station providing internet to the neighbours notebook and a mobile
phone.  The module "r8192s_usb" from the 2.6.36 series worked without
problems while the corresponding module "r8712u" from 2.6.37 and 2.6.38
(all versions) do not.  "r8712u" cannot be configured using iwconfig(8)
from the "wireless_tools" package and it doesn't work in Ad-hoc mode.
Example:

0 4 # /usr/sbin/iwconfig wlan0
wlan0     IEEE 802.11b  ESSID:""  Nickname:"rtl_wifi"
          Mode:Ad-Hoc  Cell: Not-Associated   Bit Rate:0 kb/s
          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 4 # iwconfig wlan0 essid mana
~
0 4 # /usr/sbin/iwconfig wlan0
wlan0     IEEE 802.11b  ESSID:""  Nickname:"rtl_wifi"
          Mode:Ad-Hoc  Cell: Not-Associated   Bit Rate:0 kb/s
          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

Here's "dmesg" output from the working driver:

2011-03-17_18:21:16 kern.info: usb 1-7: Product: RTL8191S WLAN Adapter
2011-03-17_18:21:16 kern.info: usb 1-7: Manufacturer: Manufacturer Realtek
2011-03-17_18:21:16 kern.info: usb 1-7: SerialNumber: 00e04c000001
2011-03-17_18:21:16 kern.warn: r8192s_usb: module is from the staging directory, the quality is unknown, you hav
e been warned.
2011-03-17_18:21:16 kern.debug: ieee80211_crypt: registered algorithm 'NULL'
2011-03-17_18:21:16 kern.debug: ieee80211_crypt: registered algorithm 'TKIP'
2011-03-17_18:21:16 kern.debug: ieee80211_crypt: registered algorithm 'CCMP'
2011-03-17_18:21:16 kern.debug: ieee80211_crypt: registered algorithm 'WEP'
2011-03-17_18:21:16 kern.info: Linux kernel driver for RTL8192 based WLAN cards
2011-03-17_18:21:16 kern.info: Copyright (c) 2007-2008, Realsil Wlan
2011-03-17_18:21:16 kern.debug: rtl819xU 1-7:1.0: usb_probe_interface
2011-03-17_18:21:16 kern.debug: rtl819xU 1-7:1.0: usb_probe_interface - got id
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareRequest92S(): signature: 8192, version: 902b, size: 30, imemsiz
e: 7408, sram size: 9688
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareCheckReady(): LoadFWStatus(1), success
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareCheckReady(): LoadFWStatus(2), success
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareCheckReady(): DMEM code download success, CPUStatus(0x3f)
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareCheckReady(): polling load firmware ready, CPUStatus(ff)
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareCheckReady(): Current RCR settings(0x157e20e)
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareCheckReady(): LoadFWStatus(3), success
2011-03-17_18:21:34 kern.debug: rtl819xU:FirmwareDownload92S(): Firmware Download Success
2011-03-17_18:21:36 kern.info: ADDRCONF(NETDEV_UP): wlan0: link is not ready
2011-03-17_18:22:08 kern.debug: rtl819xU:Setting SW wep key
2011-03-17_18:22:09 kern.debug: rtl819xU:SetBWModeCallback8192SUsbWorkItem(): Switch to 20MHz bandwidth
2011-03-17_18:22:10 kern.warn: creating new IBSS cell
2011-03-17_18:22:10 kern.debug: rtl819xU:EnableHWSecurityConfig8192(): hwsec: 1, pairwise_key: 1, SECR_value: f
2011-03-17_18:22:10 kern.debug: rtl819xU:setKey(): dev: f6a00000, EntryNo: 0, KeyIndex: 0, KeyType: 1, MacAddr: 00:00:00:00:00:00
2011-03-17_18:22:10 kern.warn: =============>ARFR0+rate_index*4:0xff5
2011-03-17_18:22:10 kern.info: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
2011-03-17_18:22:10 kern.warn: dm_check_edca_turbo():iot peer is 0x0:unknown, bssid:1e:7f:0f:8a:5e:75
2011-03-17_18:22:16 kern.info: device wlan0 entered promiscuous mode

and this is from the broken driver:

2011-03-17_19:18:47 kern.info: usb 1-7: Product: RTL8191S WLAN Adapter
2011-03-17_19:18:47 kern.info: usb 1-7: Manufacturer: Manufacturer Realtek
2011-03-17_19:18:47 kern.info: usb 1-7: SerialNumber: 00e04c000001
2011-03-17_19:18:47 kern.warn: r8712u: module is from the staging directory, the quality is unknown, you have been warned.
2011-03-17_19:18:47 kern.info: r8712u: DriverVersion: v7_0.20100831
2011-03-17_19:18:47 kern.info: r8712u: register rtl8712_netdev_ops to netdev_ops
2011-03-17_19:18:47 kern.info: r8712u: USB_SPEED_HIGH with 4 endpoints
2011-03-17_19:18:47 kern.info: r8712u: Boot from EFUSE: Autoload OK
2011-03-17_19:18:47 kern.info: r8712u: CustomerID = 0x0000
2011-03-17_19:18:47 kern.info: r8712u: MAC Address from efuse = 00:1f:1f:52:9d:bd
2011-03-17_19:18:47 kern.info: usbcore: registered new interface driver r8712u
2011-03-17_19:19:07 kern.info: r8712u: 1 RCR=0x153f00e
2011-03-17_19:19:07 kern.info: r8712u: 2 RCR=0x553f00e
2011-03-17_19:19:07 kern.info: ADDRCONF(NETDEV_UP): wlan0: link is not ready

regards, clemens
Comment 1 Larry Finger 2011-04-19 16:15:01 UTC
This is not a regression. The driver you used previously was not in the kernel. I don't know the details, but it must have been supplied by your distro.

The code to generate beacons in r8712u is not present, thus it cannot handle ad-hoc or AP mode. It could be added, but the effort for a driver that does not use mac80211 does not seem to be warranted. The fact that the driver incorporates its own MAC layer is the reason it is in staging with the accompanying warning.

Writing a mac80211-based driver for the RTL8192SU devices is on my list of things to do, but it does not have a high priority. At the moment, I'm trying to get drivers for two PCI devices into the kernel. One of them is for the RTL8192SE, thus a lot of the code will be common.

If you must use ad-hoc mode, then you will need to find the sources for that other driver and build it yourself. Sorry, but that is the best I can suggest.
Comment 2 clemens fischer 2011-04-19 18:19:55 UTC
> This is not a regression. The driver you used previously was not in the
> kernel.  I don't know the details, but it must have been supplied by
> your distro.

I don't understand:

$ locate -i rtl8192

...
/rest/no-backup/usr/src/linux-2.6.36.y.git/drivers/staging/rtl8192su/Kconfig
/rest/no-backup/usr/src/linux-2.6.36.y.git/drivers/staging/rtl8192su/Makefile
...
/rest/no-backup/usr/src/linux-2.6.37.y/drivers/staging/rtl8192u/Kconfig
/rest/no-backup/usr/src/linux-2.6.37.y/drivers/staging/rtl8192u/Makefile
...
/rest/no-backup/usr/src/linux-2.6.38.y/drivers/staging/rtl8192u/Kconfig
/rest/no-backup/usr/src/linux-2.6.38.y/drivers/staging/rtl8192u/Makefile
...
/rest/no-backup/usr/src/linux-torvalds-2.6.git/drivers/staging/rtl8192u/Kconfig
/rest/no-backup/usr/src/linux-torvalds-2.6.git/drivers/staging/rtl8192u/Makefile
...

AFAICS the driver may have changed name, and I meantioned this.

> Writing a mac80211-based driver for the RTL8192SU devices is on my list
> of things to do, but it does not have a high priority. At the moment,
> I'm trying to get drivers for two PCI devices into the kernel. One of
> them is for the RTL8192SE, thus a lot of the code will be common.

Does this mean a driver for RTL8192SU is in the foreseeable future?
I had already contacted "Realtek" months ago, but it was a pain to get
source, and I wouldn't want to do this again for every new linux
version, because the developer seemed reluctant to help and didn't
answer followup questions.

The alternative would be to pick my own (shallow) pocket again and buy
some other preferably USB-connected wlan device allowing at least ad-hoc
mode.  Do you know of a resource matching products and in-kernel linux
drivers?  --clemens fischer
Comment 3 Larry Finger 2011-04-20 00:38:47 UTC
Created attachment 54762 [details]
Patch to add rtl8192su driver

My only previous contact with this driver was an E-mail that I got when it was deleted and I had forgotten about that.

I took the driver source from 2.6.36 and converted it into a patch that can be added to the source for any 2.6.37, 38, or 39 kernel.

Good luck with this one.
Comment 4 clemens fischer 2011-04-21 18:49:34 UTC
> I took the driver source from 2.6.36 and converted it into a patch that
> can be added to the source for any 2.6.37, 38, or 39 kernel.

Thanks, that really helps!  It is unfortunate that this driver is the
only one allowing IBSS/ad-hoc mode for my device.  --clemens fischer
Comment 5 clemens fischer 2011-04-22 13:25:15 UTC
For the benefit of new readers and with skill levels similiar to mine,
here's what you have to do:

- save the patch to <patch-location>
- gunzip <patch-location>
- cd to the linux kernel source

<optional, with source from git>
- git co -b wlan-old-rtl8192su origin/master
</optional>

- patch -p1 < <patch-location>

The patch applies cleanly and a new driver appears in
drivers/staging/rtl8192su/, it is the old one from 2.6.36.

<optional>
- git add drivers/staging/rtl8192su/
- git ci -a -m '[a] re-add old wlan driver rtl8192su'
</optional>

- configure as usual.  The menu entry for rtl8192su is
  "RealTek RTL8192SU Wireless LAN NIC driver" in drivers/staging, works
  builtin or as a module.
- make and install as usual.
- add the following entry to /etc/modprobe.d/modprobe.conf
  blacklist r8712u
  This prohibits the r8712u driver from attaching to the USB wlan
  device.  Mine has USB-ID 0BDA:8172 "Realtek Semiconductor Corp.
  RTL8191S WLAN Adapter".

This is all I had to do, after reboot udevd(8) attaches the old driver
and the wlan stick is ready for use.  --clemens fischer

Note You need to log in before you can comment on or make changes to this bug.