Skip navigation.

exploreopera

| Help

Sign up | Help

Linux USB 2.0 (ehci_hcd); Encore ENUWI-G2 Wi-Fi USB; rtl8187

, , , , ,

Last friday I've bought an Encore ENUWI-G2 802.11g Wi-Fi USB adapter. I've choosen it because it was one of the cheapest available (R$ 33.00, about US$ 20.00).

My objective with this device is to add wi-fi support to my desktop, which already works as a personal (wired) router and as a web server. Actually, I want to transform my desktop into a wireless access point, but if I fail for some reason, a basic ad-hoc network will be enough for my needs.



Flawed Linux USB 2.0 implementation

First of all, Linux USB 2.0 implementation sucks. I say so because it does not work well, or might even not work at all.

Every time I try to access any USB mass storage device, bugs get into the way and the transfer (either reading or writing) fails sooner or later. This happens with all types of mass storage devices, including flash drives, external hard disks and card readers.

A simple workaround is to disable USB 2.0 support, by removing ehci_hcd module (run: modprobe -r ehci_hcd). This works, I have no problems at all if this module is not loaded. The main drawback, of course, is the lower maximum speed.

Sometimes I wonder if this is a problem with Linux USB 2.0 implementation or with flawed hardware, but on the other hand, all of them work (or should) on Windows (and I hate to make this comparison).

There are lots of bug reports on Ubuntu about this problem (61235, 88746, and many duplicates). Maybe not all of them are actually the same problem, but different problems that have in common the USB 2.0 module.

My System

Before continuing, I need to document what is my system now.

My system is still a Pentium III 800MHz running on Asus CUV4X motherboard, with 768MB of RAM divided in 3 modules. The CPU cooler has been replaced once.

I have two Ethernet 10/100 Realtek 8139 PCI cards: one is connected to my DSL modem, and the other is connected to my LAN cable (which is connected to... nothing).

This motherboard came with 4 on-board USB 1.1 ports, connected to a Via UHCI controller. Then, some time ago, I bought a PCI card with 4 "external" USB 2.0 ports and 2 "internal" ports. This card has an ALi chip, and works with OHCI USB 1.1 and EHCI USB 2.0.

It is not relevant, but I also have a Sound Blaster Live! 5.1 (emu10k1) PCI sound card and a nVidia GeForce FX 5500 AGP video card.

At software, I have Gentoo/Linux (x86) and I use vanilla kernel. My system is rock-solid stable, and my current uptime is was 81 days. <off-topic>My personal record, however, is 120 days, long time ago, when I was still using Slackware 9.0. By the way, you can track your best uptimes using uptimed.</off-topic>

I'm currently running Linux vanilla 2.6.23.9. I plan to upgrade to 2.6.25 as soon as I need to reboot (which should happen in a few weeks). This version changelog (warning! huge file! 7.4MB) cites many small fixes in ehci-related code. While I hope it will behave a little better, I don't think the problems mentioned above have been really fixed.

Plugging the Wi-Fi USB

Ok, so the first thing I've tried to do was to plug this device and run lsusb. But... lsusb hangs. Yep, it hangs. I press enter and wait, wait, wait... Maybe it will finally print some info, or maybe it will just hang there forever (or until some USB modules are unloaded).

I could reproduce this on both my system and on a Ubuntu Gutsy (7.x, running 2.6.22-14).

On the other hand, if I remove the USB 2.0 module (modprobe -r ehci_hcd), then lsusb works as expected and prints:
Bus 003 Device 023: ID 0bda:8187 Realtek Semiconductor Corp.


Configuring the kernel

According to many sources on the internet, this device works fine if you use NdisWrapper. According to Gentoo-Wiki, recent kernels (2.6.23 and above) come with rtl8187 driver, which should work fine with this device.

To add support to it, enable this:
Networking  --->
  [*] Networking support
    Wireless  --->
      <M> Improved wireless configuration API
      <M> Generic IEEE 802.11 Networking Stack (mac80211)
      < > Generic IEEE 802.11 Networking Stack
Device Drivers  --->
  [*] Network device support  --->
    Wireless LAN  --->
      [*] Wireless LAN (IEEE 802.11)
      <M> Realtek 8187 USB support

This should automatically also enable EEPROM 93CX6 support and ARC4 cipher algorithm.

Q: Why use mac80211 version of Generic IEEE 802.11 Networking Stack?
A: AFAIK, is that this is the newer "version", compatible with newer drivers. And that Gentoo-Wiki guide tells me to do so.

I also enable 802.1d Ethernet Bridging support to my kernel, since I might probably want to bridge my LAN ethernet with the wi-fi interface.

After saving the configuration, I ran:
make
make modules
make modules_install
module-rebuild rebuild
/etc/init.d/vmware restart

Then I got a kernel oops. Well, so long since my previous reboot... So many changes in kernel modules... I think that (unfortunately) this is a good time to reboot, just to make sure the system is stable again.

After reboot, some fsck runs (my root partition had not been checked for 201 days!), one more reboot... Well, finally my shell again.

Then I connect the device. Hum... frozen? I'm impatient, so I ran rmmod ehci_hcd (or modprobe -r ehci). Trying again... Hum, /var/log/messages says it has been detected... and the rtl8187 module has been loaded... and ifconfig -a now shows two new interfaces! Wow, I guess this thing will work without too much pain!
wlan0     Link encap:Ethernet  HWaddr 00:08:54:86:D0:1F  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

wmaster0  Link encap:UNSPEC  HWaddr 00-08-54-86-D0-1F-80-2B-00-00-00-00-00-00-00-00  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)


Testing the interface

My first question is "why two interfaces?". Of course, I'm not the only one. I like this explanation:
The wmaster0 device is what we call the master device. The master device is an internal master device used only by mac80211. It should be ignored by users. If possible we will try to hide it from users later.[1]
The wlan%d devices (interfaces) are the devices you would use to configure your wireless settings. [2]

Ok, then I will believe in you.

Let's try some tests...
# iwconfig
[...]
wmaster0  no wireless extensions.

wlan0     IEEE 802.11g  ESSID:""  
          Mode:Managed  Channel:0  Access Point: Not-Associated   
          Retry min limit:7   RTS thr:off   Fragment thr=2346 B   
          Encryption key: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
# iwlist wlan0 scan
wlan0     Interface doesn't support scanning : Network is down
# ifconfig wlan0 up
(this took a lot of time, and I had thought it has hung, but fortunately it haven't)
# iwlist wlan0 scan
wlan0     No scan results
# ifconfig wlan0 down
# iwconfig wlan0 mode master
Error for wireless request "Set Mode" (8B06) :
    SET failed on device wlan0 ; Invalid argument.

Hum... I don't like this. Looks like this driver/device does not support master mode, which is required to make it work as an AP. Damn it...

I've also tried setting mode ad-hoc and and then using ifconfig, but also it failed to work. Oh, well. Remember I previously said I wanted to upgrade the kernel? I think now it is a good time to do it.

Kernel 2.6.25.2 - A New Hope

skipping really boring details about recompiling the kernel

Ok, now I have my system with the latest available kernel: 2.6.25.2. But then media-video/gspcav1-20070508 failed to compile. Fortunately, media-video/gspcav1-20071224 compiled fine. But then app-emulation/vmware-modules-1.0.0.15-r1 had problems being loaded (bug 218250).

*Sigh* I guess I won't be able to use VMware for some time. Anyway, let's try using this wi-fi USB again.

I plug the device, then run lsusb, and... it works! It does not hang! Nice! Will it finally work?
# iwconfig wlan0 mode ad-hoc essid house
/var/log/messages: wlan0: Trigger new scan to find an IBSS to join
# ifconfig wlan0 up
SIOCSIFFLAGS: Operation not supported
/var/log/messages: phy0: RF Calibration Failed! 0

Well, this is a problem. I've also tried removing the ehci_hcd, but I got the same non-working behavior.

Did I say that maybe it could work without too much pain? Forget it!

My next try will be NdisWrapper.

NdisWrapper

Of course, the first thing I need to do is to blacklist the current rtl8187 module. Maybe this isn't needed, but I want to avoid even more problems. According to Gentoo-Wiki, I just need to add blacklist rtl8187 to /etc/modprobe.d/blacklist and then run update-modules.

These are the messages printed by net-wireless/ndiswrapper ebuild:
NDISwrapper requires .inf and .sys files from a Windows(tm) driver
to function. Download these to /root for example, then
run 'ndiswrapper -i /root/foo.inf'. After that you can delete them.
They will be copied to /etc/ndiswrapper/.
Once done, please run 'update-modules'.

Please look at http://ndiswrapper.sourceforge.net/
for the FAQ, HowTos, tips, configuration, and installation
information.

According to NdisWrapper homepage (damn ugly URL!), I should try the XP driver first, then 2000/2003. Running fdupes -r . at the place where I've uncompressed the drivers, I find that XP and 2000 versions are exactly the equal.
# cd ENUWI-G2_XP_Driver/Windows\ XP\ 8187L/
# ndiswrapper -i Netrtuw.inf
installing netrtuw ...
# modprobe ndiswrapper

Then I got this at /var/log/messages:
ndiswrapper: driver netrtuw (OEM,04/04/2006,5.1221.0412.2006) loaded
ndiswrapper (mp_init:216): couldn't initialize device: C0010006
ndiswrapper (pnp_start_device:439): Windows driver couldn't initialize the device (C0000001)
ndiswrapper (mp_halt:259): device d3c8d360 is not initialized - not halting
ndiswrapper: device eth%d removed
ndiswrapper: probe of 3-2:1.0 failed with error -22

And this happens with or without ehci_hcd module loaded. Hum... Maybe it needs 8187B driver, instead/in addition to 8187L? Let me try:
# modprobe -r ndiswrapper
# cd ../Windows\ XP\ 8187B/
# ndiswrapper -i net8187b.inf 
installing net8187b ...
# modprobe ndiswrapper

And then I got this at /var/log/messages:
ndiswrapper: driver net8187b (Realtek Semiconductor Corp.,05/04/2007,5.1082.0504.2007) loaded
wlan0: ethernet device 00:08:54:86:d0:1f using NDIS driver: net8187b, version: 0x1, NDIS version: 0x500, vendor: 'Realtek RTL8187 Wireless LAN USB NIC                                     ', 0BDA:8187.F.conf
wlan0: encryption modes supported: WEP; TKIP with WPA, WPA2, WPA2PSK; AES/CCMP with WPA, WPA2, WPA2PSK


:yikes: Wow! Finally! The device LED is finally blinking! :yes: :hat: :sherlock: :headbang:

Configuring the ad-hoc network

According to NdisWrapper FAQ, master mode (required for working in AP mode) is not supported. Well, I would love to transform my desktop into an AP, but, as I said, an ad-hoc network will be good enough for me.

Let me configure it right now!
# iwconfig wlan0 mode ad-hoc essid house
# ifconfig wlan0 10.0.1.1 broadcast 10.0.1.255 netmask 255.255.255.0 up
# vim /etc/dhcp/dhcpd.conf
(configuring another subnet, because I've not bridged my wired and wireless interfaces yet)
# vim /etc/conf.d/dhcpd
(adding wlan0 to my dhcp server daemon)
# /etc/init.d/dhcpd restart


Hum... Does not work yet... :cry:

That's enough for now. Later I will try again. Wish me luck!

First contact with ATmega8 microcontroller - part 4Linux 2.6.25.2; Encore ENUWI-G2 Wi-Fi USB - the end...?

Comments

avatar
stockrt writes:

Hey, did you got it working?

stockrt@gmail.com

By anonymous user, # 6. August 2008, 20:07:20

avatar
As you can read on my post from 2008-05-16, no I couldn't get it working. I gave up on that device and bought a PCI card.

By CrazyTerabyte, # 6. August 2008, 21:37:37

avatar
stockrt writes:

Right! Thank you!

By anonymous user, # 16. August 2008, 00:49:16

avatar
stockrt writes:

Bah, agora que fui ver que você é brasileiro :smile: e nós falandos inglês aqui né!! Hehehe

By anonymous user, # 16. August 2008, 00:50:56

avatar
Sim, sou brasileiro. Mas escrever em inglês torna o conteúdo mais acessível mundialmente. :smile:

Yes, I am brazillian. But writing in English makes the content more accessible worldwide. :smile:

By CrazyTerabyte, # 16. August 2008, 01:13:40

Write a comment

Comment
(BBcode and HTML is turned off for anonymous user comments.)

Please type this security code : 0d3412

Smilies

October 2008
SMTWTFS
September 2008November 2008
1234
567891011
12131415161718
19202122232425
262728293031