2011-04-25 02:16:13

by Jeff Chua

[permalink] [raw]
Subject: r8712u cannot set essid

I'm having problem trying to set essid on the "Realtek RTL8188S WLAN
Adapter" with the r8172u module on 2.6.39-rc4. There's no error. Just
can't set.


# dmesg ...
r8712u: module is from the staging directory, the quality is unknown,
you have been warned.
r8712u: DriverVersion: v7_0.20100831
r8712u: register rtl8712_netdev_ops to netdev_ops
r8712u: USB_SPEED_HIGH with 4 endpoints
r8712u: Boot from EFUSE: Autoload OK
r8712u: CustomerID = 0x0000
r8712u: MAC Address from efuse = 90:61:0c:01:8f:b0
usbcore: registered new interface driver r8712u
r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
r8712u: 1 RCR=0x153f00e
r8712u: 2 RCR=0x553f00e

# iwconfig wlan1 essid "tryanything"
# iwconfig wlan1
wlan1 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



Thanks,
Jeff


2011-04-25 03:24:01

by Larry Finger

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On 04/24/2011 09:16 PM, Jeff Chua wrote:
> I'm having problem trying to set essid on the "Realtek RTL8188S WLAN
> Adapter" with the r8172u module on 2.6.39-rc4. There's no error. Just
> can't set.
>
>
> # dmesg ...
> r8712u: module is from the staging directory, the quality is unknown,
> you have been warned.
> r8712u: DriverVersion: v7_0.20100831
> r8712u: register rtl8712_netdev_ops to netdev_ops
> r8712u: USB_SPEED_HIGH with 4 endpoints
> r8712u: Boot from EFUSE: Autoload OK
> r8712u: CustomerID = 0x0000
> r8712u: MAC Address from efuse = 90:61:0c:01:8f:b0
> usbcore: registered new interface driver r8712u
> r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
> r8712u: 1 RCR=0x153f00e
> r8712u: 2 RCR=0x553f00e
>
> # iwconfig wlan1 essid "tryanything"
> # iwconfig wlan1
> wlan1 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

The code requires the interface to be up before the essid can be set. If you do
it with the iwconfig command, you will see an error message.

I'm not sure if this is a reasonable requirement before allowing the essid to be
set. Any thoughts?

Larry

2011-04-25 04:32:13

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Mon, Apr 25, 2011 at 11:23 AM, Larry Finger
<[email protected]> wrote:
> On 04/24/2011 09:16 PM, Jeff Chua wrote:
> The code requires the interface to be up before the essid can be set. If you
> do it with the iwconfig command, you will see an error message.

I did that. Setting ssid works fine with iwlagn on the same system.


# modprobe r8712u
r8712u: module is from the staging directory, the quality is unknown,
you have been warned.
r8712u: DriverVersion: v7_0.20100831
r8712u: register rtl8712_netdev_ops to netdev_ops
r8712u: USB_SPEED_HIGH with 4 endpoints
r8712u: Boot from EFUSE: Autoload OK
r8712u: CustomerID = 0x0000
r8712u: MAC Address from efuse = 90:61:0c:01:8f:b0
usbcore: registered new interface driver r8712u


# ifconfig wlan0 up
r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
r8712u: 1 RCR=0x153f00e
r8712u: 2 RCR=0x553f00e

# iwconfig wlan0 essid "123"
# iwconfig wlan0
wlan0 unassociated Nickname:"rtl_wifi"
Mode:Auto 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




> I'm not sure if this is a reasonable requirement before allowing the essid
> to be set. Any thoughts?

As long as it works, I don't mind. But it's not working. I've tried
all sorts of combination of "ifconfig up/down" + "iwconfig essid" but
still not working.


Here's more info if it helps.

# cat /proc/bus/usb/devices
T: Bus=01 Lev=02 Prnt=02 Port=00 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=07b8 ProdID=8188 Rev= 2.00
S: Manufacturer=Manufacturer Realtek
S: Product=RTL8188S 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=r8712u
E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=0d(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms

# grep /usr/src/linux/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
{RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/

I also tried this ...

# modprobe rtl8192cu
# ifconfig wlan1 up # hangs here!

usbcore: registered new interface driver rtl8192cu
rtl8192cu:_rtl92cu_init_power_on():<0-0> Failed to polling
REG_APS_FSMCO[APFM_ONMAC] done!
rtl8192cu:_rtl92cu_init_mac():<0-0> Failed to init power on!
rtl8192cu:rtl92cu_hw_init():<0-0> init mac failed!


The device is really nice and small, and would really like to make it work.

Thanks,
Jeff

2011-04-25 11:14:19

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Mon, Apr 25, 2011 at 12:32 PM, Jeff Chua <[email protected]> wrote:

Larry,

Saw this post from you about putting the r8712u into "ap mode" below ...

Larry Finger | 27 Jan 15:39
> Re: unable to put RTL8192SU in master mode
> Master mode with r8712u has not been tested. The driver I started with has a
> configuration parameter that enables "AP mode". I kept that in, but I do not
> know if it works.

Here's what I tried, but not sure if this is the correct way to put
into AP mode ...

# modprobe r8712u network_mode=4

Then, I ran ...

# wpa_supplicant -d -D hostap -i wlan0 -c /etc/wpa42.conf

wpa_driver_hostap_set_wpa: enabled=1
...
wpa_driver_hostap_set_key: alg=none key_idx=0 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
wpa_driver_hostap_set_key: alg=none key_idx=1 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
wpa_driver_hostap_set_key: alg=none key_idx=2 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
wpa_driver_hostap_set_key: alg=none key_idx=3 set_tx=0 seq_len=0 key_len=0
ioctl[PRISM2_IOCTL_HOSTAPD]: Operation not supported
Failed to set encryption.
...
wlan0: AP mode support not included in the build


Is wpa_supplicant saying the r8172u is not in AP mode?

Regarding setting essid I posted earlier, it seems the ssid can be set
when wlan0 is "associated" to an AP. But, not set if not associated.
With IBSS mode, there's no association to begin with, so the SSID
can't be set. Make sense?


Jeff

2011-04-25 12:10:15

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Mon, Apr 25, 2011 at 7:14 PM, Jeff Chua <[email protected]> wrote:
> On Mon, Apr 25, 2011 at 12:32 PM, Jeff Chua <[email protected]> wrote:


> wlan0: AP mode support not included in the build

Ok, fixed tihat with CONFIG_AP=y. But now, I get

wlan0: Driver does not support AP mode

I've tried "modprobe r8712u network_mode=4" but looks like it's not
putting in AP mode.


Jeff

2011-04-25 19:18:27

by Larry Finger

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On 04/24/2011 11:32 PM, Jeff Chua wrote:
> On Mon, Apr 25, 2011 at 11:23 AM, Larry Finger
> <[email protected]> wrote:
>> On 04/24/2011 09:16 PM, Jeff Chua wrote:
>> The code requires the interface to be up before the essid can be set. If you
>> do it with the iwconfig command, you will see an error message.
>
> I did that. Setting ssid works fine with iwlagn on the same system.

That is a different driver.

> # modprobe r8712u
> r8712u: module is from the staging directory, the quality is unknown,
> you have been warned.
> r8712u: DriverVersion: v7_0.20100831
> r8712u: register rtl8712_netdev_ops to netdev_ops
> r8712u: USB_SPEED_HIGH with 4 endpoints
> r8712u: Boot from EFUSE: Autoload OK
> r8712u: CustomerID = 0x0000
> r8712u: MAC Address from efuse = 90:61:0c:01:8f:b0
> usbcore: registered new interface driver r8712u
>
>
> # ifconfig wlan0 up
> r8712u: Loading firmware from "rtlwifi/rtl8712u.bin"
> r8712u: 1 RCR=0x153f00e
> r8712u: 2 RCR=0x553f00e
>
> # iwconfig wlan0 essid "123"
> # iwconfig wlan0
> wlan0 unassociated Nickname:"rtl_wifi"
> Mode:Auto 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
>
>
>
>
>> I'm not sure if this is a reasonable requirement before allowing the essid
>> to be set. Any thoughts?
>
> As long as it works, I don't mind. But it's not working. I've tried
> all sorts of combination of "ifconfig up/down" + "iwconfig essid" but
> still not working.
>
>
> Here's more info if it helps.
>
> # cat /proc/bus/usb/devices
> T: Bus=01 Lev=02 Prnt=02 Port=00 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=07b8 ProdID=8188 Rev= 2.00
> S: Manufacturer=Manufacturer Realtek
> S: Product=RTL8188S 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=r8712u
> E: Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
> E: Ad=0d(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
>
> # grep /usr/src/linux/drivers/net/wireless/rtlwifi/rtl8192cu/sw.c
> {RTL_USB_DEVICE(0x07b8, 0x8188, rtl92cu_hal_cfg)}, /*Abocom - Abocom*/
>
> I also tried this ...
>
> # modprobe rtl8192cu
> # ifconfig wlan1 up # hangs here!
>
> usbcore: registered new interface driver rtl8192cu
> rtl8192cu:_rtl92cu_init_power_on():<0-0> Failed to polling
> REG_APS_FSMCO[APFM_ONMAC] done!
> rtl8192cu:_rtl92cu_init_mac():<0-0> Failed to init power on!
> rtl8192cu:rtl92cu_hw_init():<0-0> init mac failed!

There is a problem here. Driver r8712u is for the RTL8192SU/RTL8188SU devices
and rtl8192cu is for the RTL8192CU/RTL8188CU. The chips are very different.
Having the same USB ID in both is clearly wrong. Unfortunately, that ID is not
listed at http://www.linux-usb.org/usb.ids. I'll check with Realtek to be sure,
but I think it needs to be deleted from rtl8192cu.

Please send me the commands that you want to use, and I'll try to get r8712u to
support them. AP mode may not be possible.

Larry

2011-04-26 00:21:55

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Tue, Apr 26, 2011 at 3:18 AM, Larry Finger <[email protected]> wrote:
> Please send me the commands that you want to use, and I'll try to get r8712u
> to support them.

Larry,

All I want is for my iPhone to connect to me notebook, and I use this
command ...

# iwconfig wlan0 mode ad-hoc essid "123"

A little bit of good news is that I got adhoc to work 2 out of 100
tries (with wpa_supplicant on another sreen, and the above iwconfig
command). So, it's working "partially". Once it has an SSID, I could
change it and it'll still work.


> AP mode may not be possible.

So perhaps "CONFIG_R8712_AP=y" should be removed from the kernel if it
does nothing.


Thanks,
Jeff

2011-04-26 00:48:12

by Larry Finger

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On 04/25/2011 07:21 PM, Jeff Chua wrote:
> On Tue, Apr 26, 2011 at 3:18 AM, Larry Finger<[email protected]> wrote:
>> Please send me the commands that you want to use, and I'll try to get r8712u
>> to support them.
>
> Larry,
>
> All I want is for my iPhone to connect to me notebook, and I use this
> command ...
>
> # iwconfig wlan0 mode ad-hoc essid "123"
>
> A little bit of good news is that I got adhoc to work 2 out of 100
> tries (with wpa_supplicant on another sreen, and the above iwconfig
> command). So, it's working "partially". Once it has an SSID, I could
> change it and it'll still work.

Please try the attached patch.

Larry


Attachments:
r8712u_set_essid (583.00 B)

2011-04-26 03:26:13

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Tue, Apr 26, 2011 at 8:48 AM, Larry Finger <[email protected]> wrote:
> On 04/25/2011 07:21 PM, Jeff Chua wrote:
>> A little bit of good news is that I got adhoc to work 2 out of 100
>> tries (with wpa_supplicant on another sreen, and the above iwconfig
>> command). So, it's working "partially". Once it has an SSID, I could
>> change it and it'll still work.
>
> Please try the attached patch.

Tried, but didn't make any difference.

Now I can make adhoc work 100% if I first put the device in wpa2
infrastructure and associates it with an AP. Then kill the
wpa_supplicant process, and start a new wpa_supplicant with adhoc
config.

If I just start with the wpa_supplicant adhoc config, it'll never set the ssid.

So, something is not right in the r8712u module or may be the firmware?

Thanks,
Jeff

2011-04-26 15:32:27

by Larry Finger

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On 04/25/2011 10:26 PM, Jeff Chua wrote:
> On Tue, Apr 26, 2011 at 8:48 AM, Larry Finger<[email protected]> wrote:
>> On 04/25/2011 07:21 PM, Jeff Chua wrote:
>>> A little bit of good news is that I got adhoc to work 2 out of 100
>>> tries (with wpa_supplicant on another sreen, and the above iwconfig
>>> command). So, it's working "partially". Once it has an SSID, I could
>>> change it and it'll still work.
>>
>> Please try the attached patch.
>
> Tried, but didn't make any difference.
>
> Now I can make adhoc work 100% if I first put the device in wpa2
> infrastructure and associates it with an AP. Then kill the
> wpa_supplicant process, and start a new wpa_supplicant with adhoc
> config.
>
> If I just start with the wpa_supplicant adhoc config, it'll never set the ssid.
>
> So, something is not right in the r8712u module or may be the firmware?

I must have something wrong in my setup, thus my testing did not work. There is
another place in the code where the setting of parameters requires the interface
to be connected. Please try the attached patch.

Larry


Attachments:
r8712u_set_essid (845.00 B)

2011-04-26 16:24:43

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Tue, Apr 26, 2011 at 11:32 PM, Larry Finger
<[email protected]> wrote:
> On 04/25/2011 10:26 PM, Jeff Chua wrote:
>>
>> On Tue, Apr 26, 2011 at 8:48 AM, Larry Finger<[email protected]>
>> ?wrote:
>>>
>>> On 04/25/2011 07:21 PM, Jeff Chua wrote:
>>>>
>>>> A little bit of good news is that I got adhoc to work 2 out of 100
>>>> tries (with wpa_supplicant on another sreen, and the above iwconfig
>>>> command). So, it's working "partially". Once it has an SSID, I could
>>>> change it and it'll still work.
>>>
>>> Please try the attached patch.
>>
>> Tried, but didn't make any difference.
>>
>> Now I can make adhoc work 100% if I first put the device in wpa2
>> infrastructure and associates it with an AP. Then kill the
>> wpa_supplicant process, and start a new wpa_supplicant with adhoc
>> config.
>>
>> If I just start with the wpa_supplicant adhoc config, it'll never set the
>> ssid.
>>
>> So, something is not right in the r8712u module or may be the firmware?
>
> I must have something wrong in my setup, thus my testing did not work. There
> is another place in the code where the setting of parameters requires the
> interface to be connected. Please try the attached patch.

Larry,

I hacked it a bit more, and now, it's all working. I'll send you the
patch shortly. Adhoc mode works now, and I've confirmed that my iPhone
can connect to it, get an IP and surf the net! The device is so tiny
and was contemplating on trying another brand.

Thanks,
Jeff

2011-04-26 19:30:24

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Wed, Apr 27, 2011 at 12:24 AM, Jeff Chua <[email protected]> wrote:
> I hacked it a bit more, and now, it's all working. I'll send you the
> patch shortly. Adhoc mode works now, and I've confirmed that my iPhone
> can connect to it, get an IP and surf the net! The device is so tiny
> and was contemplating on trying another brand.

Larry,

Here's the patch for adhoc mode. This should work. Just remember to
set wpa_supplicant's ap_scan to either 1 or 2 (faster association). 0
does not seem to work.

Thanks,
Jeff


Attachments:
patch-adhoc (660.00 B)

2011-04-26 20:12:28

by Larry Finger

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On 04/26/2011 02:30 PM, Jeff Chua wrote:
> On Wed, Apr 27, 2011 at 12:24 AM, Jeff Chua<[email protected]> wrote:
>> I hacked it a bit more, and now, it's all working. I'll send you the
>> patch shortly. Adhoc mode works now, and I've confirmed that my iPhone
>> can connect to it, get an IP and surf the net! The device is so tiny
>> and was contemplating on trying another brand.
>
> Larry,
>
> Here's the patch for adhoc mode. This should work. Just remember to
> set wpa_supplicant's ap_scan to either 1 or 2 (faster association). 0
> does not seem to work.

Thanks. Is this in addition to my previous patch, or is this one enough by itself?

Larry

2011-04-27 15:45:55

by Jeff Chua

[permalink] [raw]
Subject: Re: r8712u cannot set essid

On Wed, Apr 27, 2011 at 4:12 AM, Larry Finger <[email protected]> wrote:
>> On Wed, Apr 27, 2011 at 12:24 AM, Jeff Chua<[email protected]>
>> ?wrote:
>>>
>>> I hacked it a bit more, and now, it's all working. I'll send you the
>>> patch shortly. Adhoc mode works now, and I've confirmed that my iPhone
>>> can connect to it, get an IP and surf the net! The device is so tiny
>>> and was contemplating on trying another brand.
>>
>> Larry,
>>
>> Here's the patch for adhoc mode. This should work. Just remember to
>> set wpa_supplicant's ap_scan to either 1 or 2 (faster association). 0
>> does not seem to work.
>
> Thanks. Is this in addition to my previous patch, or is this one enough by
> itself?

I just re-verify it, applying your patch alone does not solve the problem.

The issue is with adhoc mode and when it first starts, there is
no SSID to associate with if the SSID is an unique one. The patch
basically bypass the "sitesurvey" as it could never find another site
with the wanted SSID, so that's why adhoc didn't work before. It
worked if the module has some associations before starting adhoc mode
because now it won't do another sitesurvey. ... this is how I
interpreted the logic. I've been testing it for the past few hours and
wpa2, adhoc all works well with the r7812u driver now.

Thanks for your help. Will you send this to patch to Linus?


Jeff


Attachments:
patch-adhoc (717.00 B)