Wifi adapter


98 posts   Page 1 of 4   1, 2, 3, 4
by ScoobyDoo » Mon May 28, 2012 10:32 am
Has anyone got a wifi adapter working with raspbian?

I've got raspbian working fine off Ethernet but I'm trying to install a wifi adapter rtl8188cus.
I've successfully got this working on the official Debian image but when I'm tryi g it on raspbian it's failing to bring up the adapter. It's installed the drivers correctly and detects when the device plugs in but the network fails to come up for it

Any ideas?
User avatar
Posts: 65
Joined: Wed Apr 04, 2012 2:52 pm
Location: Staffordshire, UK
by shawnanastasio » Mon May 28, 2012 7:51 pm
Can you please post an output of the command "iwconfig"
Posts: 19
Joined: Mon May 28, 2012 7:44 pm
by MrEngman » Mon May 28, 2012 11:26 pm
ScoobyDoo wrote:Has anyone got a wifi adapter working with raspbian?


Yes. :lol: Just running through the install again to make sure I've noted all the steps necessary. Will post the setup when I'm done.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1855
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by Jimmer » Tue May 29, 2012 1:17 pm
Hi, I have the wna1000m working with raspbian (hexxeh's r3 image). I've seen other methods, but this is how I did it:

Get necessary packages:
Code: Select all
apt-get install wget unzip wireless-tools wpasupplicant


Grab the files (firmware and kernel module):
Code: Select all
wget http://www.electrictea.co.uk/rpi/8192cu.ko
wget ftp://ftp.dlink.com/Wireless/dwa130_revC/Drivers/dwa130_revC_drivers_linux_006.zip


Unzip firmware:
Code: Select all
unzip dwa130_revC_drivers_linux_006.zip


install the 8192cu kernel module:
Code: Select all
install -m 644 ./8192cu.ko /lib/modules/3.1.9+/kernel/drivers/net/wireless/
depmod -a


make firmware dir and move firmware to it:
Code: Select all
mkdir -p /usr/local/lib/firmware/RTL8192U
mv rtl8192u_linux_2.6.0006.1031.2008/firmware/RTL8192U/* /usr/local/lib/firmware/RTL8192U/


put your config into wpa_supplicant.conf:
Code: Select all
nano /etc/wpa_supplicant/wpa_supplicant.conf


whack the following in (edit ssid, psk and id_str (network name, password and nickname respectively) for your values, leave the rest as written below (alter proto to WPA if using WPA1, keep as RSN if using WPA2):

Code: Select all
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=2

network={
  ssid="My Network"
  proto=RSN
  key_mgmt=WPA-PSK
  pairwise=CCMP TKIP
  group=CCMP TKIP
  psk="My Password"
  id_str="Nickname"
}


If you have more than one network (I've been taking my pi to work and using my SGS2 as a portable hotspot) then add another network={ } stanza changing the ssid, proto, psk and id_str values for this second (or third, or forth) network.

finally edit the /etc/network/interfaces file:
Code: Select all
nano /etc/network/interfaces


and add an entry for wlan0 at the bottom:

Code: Select all
auto wlan0
  iface wlan0 inet dhcp
  wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf


finally restart networking:
/etc/init.d/networking restart

couple of notes:
1) to save and exit in nano, type ctrl-x, then y, then enter
2) got the locations of the firmware and kernel module from Mr EngMan's excellent script, but wanted to show that using the wpa_supplicant route allows you to automatically save and join multiple wireless networks (useful for us pi-ers on the go!)
The original script and instructions (for the official debian image) can be found here:
viewtopic.php?t=6256&p=83269
3) as the default user in Hexxeh's image is root, there are no sudo's in the above guide. If you use it on a non-root account, most of the moves above need to be preceeded with a sudo
4) some of the above might be useful to get a flavour of using the commandline for some people - if you're one of them I hope it helps (and doesn't contain any omissions or errors!)
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by Jimmer » Tue May 29, 2012 1:51 pm
oops forgot to blacklist old module and include new module:

Code: Select all
touch /etc/modprobe.d/blacklist.conf
echo "blacklist rtl8192cu" >> /etc/modprobe.d/blacklist.conf
touch /etc/modules
echo "8192cu" >> /etc/modules


do this step before the

Code: Select all
/etc/init.d/networking restart


step!

I would edit the above post, but the forum won't let me!
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by bob_binz » Tue May 29, 2012 1:53 pm
Jimmer wrote:3) as the default user in Hexxeh's image is root, there are no sudo's in the above guide. If you use it on a non-root account, most of the moves above need to be preceeded with a sudo


Which needs installing with
Code: Select all
 apt-get install sudo
as root, in the R3 image, IIRC
User avatar
Posts: 367
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK
by ScoobyDoo » Tue May 29, 2012 6:45 pm
Thanks Jimmer, ive got it working :)

I basically used the following to install the missing packages
Code: Select all
apt-get install wget unzip wireless-tools wpasupplicant


and then used the script by MrEngMan modded slightly to ignore the dchp downloads and it ran through perfectly and installed the wifi adapter.
User avatar
Posts: 65
Joined: Wed Apr 04, 2012 2:52 pm
Location: Staffordshire, UK
by Jimmer » Tue May 29, 2012 10:27 pm
Good stuff,

just a heads-up, I used hexxeh's rpi-update tool, and this has resulted in the posted module no longer wanting to load (crap's out with an exec error).

I am currently in the process of trying to build the module (have the kernel source mounted due to lack of space and going is slow). If I have success, I'll post the method....
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by bob_binz » Wed May 30, 2012 7:20 am
Jimmer wrote:Good stuff,

just a heads-up, I used hexxeh's rpi-update tool, and this has resulted in the posted module no longer wanting to load (crap's out with an exec error).

I am currently in the process of trying to build the module (have the kernel source mounted due to lack of space and going is slow). If I have success, I'll post the method....


Yes, please report back - I'm struggling to get the ralink 3070 drivers to build at the moment - they seem to depend on kernel source configuration (which I too have mounted via nfs!) I did get the default driver (3750?) to build, but got the exec error you mentioned. I assumed it was due not being the correct hardware. I last used rpi-update about 4 days ago, so I'm not sure whether it's the latest version. I've never been able to get the standard ra2800usb driver to detect the device, although I did all the updating prior to trying.
User avatar
Posts: 367
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK
by Jimmer » Wed May 30, 2012 7:41 am
I can report that I managed to use realtek's install.sh to build the kernel module against the mounted kernel source (after a bit of messing around!) but modprobe still gives an exec error. I tried loading the module using insmod instead and the module actually loads (ie shows up with lsmod) but that's as far as it goes. It doesn't associate the adapter with wlan0.

when I try to modprobe it, I get:

8192cu: disagrees about version of symbol module_layout

in dmesg
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by Jimmer » Wed May 30, 2012 8:18 am
I have found more than one 8192cu.ko in the /lib/modules/.... subdirs. I deleted them all and removed my compiled module into place, ran depmod -a and now have a module that loads via modprobe (and also on boot through /etc/modules) however I still can't get wlan0 to come up.... I wonder if it's correctly loading the firmware? I will try the firmware in other locations and see what gives...
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by bob_binz » Wed May 30, 2012 11:28 am
Jimmer wrote:I wonder if it's correctly loading the firmware? I will try the firmware in other locations and see what gives...


I tried (again, with a ralink driver/firmware) /lib/firmware, /lib/firmware/ralink, /usr/local/lib/firmware & /usr/local/lib/firmware/ralink, all without success. I'm not sure where [un]successful loading of the firmware would be logged though, certainly couldn't see it in dmesg or /var/log/... keep us posted.
User avatar
Posts: 367
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK
by MrEngman » Wed May 30, 2012 4:03 pm
For anyone trying to add a wifi adapter using the Realtek rtl8188cus device there is a script available here.

This is for the hexxeh image only and you will need a wired network connection to be able to use it.. To use it grab the script, copy the hexxeh image to your SD card and then copy the script to the SD card. Using Windows view the SD card with Windows Explorer. You will see the disk with a partition of 74.4MB. Copy the script to the disk.

Plug your SD card into the Pi and power on. At the login prompt login as root, password hexxeh. Now run the script - just type "/boot/raspbian-hexxeh-install-rtl8188cus.sh". The script will run and when needed it will ask for your SSID and PASSWORD for your wirless network access point. Follow the remaining instructions on screen.

Hopefully you will have a running wifi when it is done.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1855
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by MrEngman » Wed May 30, 2012 4:35 pm
Jimmer wrote:2) got the locations of the firmware and kernel module from Mr EngMan's excellent script, but wanted to show that using the wpa_supplicant route allows you to automatically save and join multiple wireless networks (useful for us pi-ers on the go!)
The original script and instructions (for the official debian image) can be found here:
viewtopic.php?t=6256&p=83269


Hi Jimmer,

Thanks.

Wondered what wpa-supplicant was all about. Very useful. Just off to have a play and see what I can do with it.

And one in return. Instead of adding line "auto wlan0" to /etc/network/interfaces, you can use "allow-hotplug wlan0".

This should autostart wlan0 without needing the command "/etc/init.d/networking restart". It also means you can remove the wifi adapter from a powered on Pi and then plug it back in later and it should again autostart if for any reason you need to.

MrEngman
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1855
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by Jimmer » Wed May 30, 2012 4:47 pm
Just a heads-up, after updating to the newest firmware/kernel using rpi-updater, it appears that wpa_supplicant is the issue. If I re-install the kernel module from electrictea on the newer kernel rev, I can get it to work if I put my credentials in /etc/network/interfaces, but I loose the ability to "roam" with my rpi.

I'm going to have a dig around to see if there's something to be done for wpa_supplicant, because I find it incredibly useful.

@MrEngMan thanks for the hotplug tip! Works like a charm...
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by Jimmer » Wed May 30, 2012 6:19 pm
Well, I feel like a right charlie! One of my stanzas in my wpa_supplicant.conf had netwowk={
typed it out on a 1080i screen so couldn't catch the typo. Altered my resolution to 720p and finally I could see it.....

So, after all that the 8192cu works on the newer kernel with both the Hexxeh and Piscies hard float images with wi-fi roaming handled by wpa_supplicant. What a relief!
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by MrEngman » Wed May 30, 2012 7:56 pm
Jimmer wrote:Well, I feel like a right charlie! One of my stanzas in my wpa_supplicant.conf had netwowk={
typed it out on a 1080i screen so couldn't catch the typo. Altered my resolution to 720p and finally I could see it.....

So, after all that the 8192cu works on the newer kernel with both the Hexxeh and Piscies hard float images with wi-fi roaming handled by wpa_supplicant. What a relief!


That's good to hear.

I looked at the Pisces image but didn't get very far although I didn't spend much time on it. Is the wifi install similar to the hexxeh image? It looked to me as though there might be some sort of network manager installed that was screwing things up for me. Or do I need to use wpa-supplicant to set things up. I've never troubled myself with wpa-supplicant up to now.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1855
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by Jimmer » Thu May 31, 2012 12:01 am
wpa_supplicant isn't necessary, just easier for me because I'm taking my pi with me on the go!

I think the pisces image doesn't have wireless-tools installed by default? apt-getting that is probably the thing that will get you flying. After that, it's the same module, same firmware, same locations, same install commands. Only thing that can stop you is crappy typing in config files (at least in my experience!)
Posts: 20
Joined: Tue Jan 10, 2012 5:34 pm
by Lorian » Fri Jun 01, 2012 6:35 pm
I used the script to set up, and checked all by hand.
I still get from dmesg:

Code: Select all
usb 1-1.2: new high speed USB device number 4 using dwc_otg
usb 1-1.2: New USB device found, idVendor=7392, idProduct=7811
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.2: Product: 802.11n WLAN Adapter
usb 1-1.2: Manufacturer: Realtek
usb 1-1.2: SerialNumber: 00e04c000001
8192cu: disagrees about version of symbol module_layout


And no Wlan0 from ifconfig

This is on Hex's image with latest kernel.
Posts: 112
Joined: Sun Mar 11, 2012 10:09 am
by dom » Fri Jun 01, 2012 6:40 pm
How did you update to latest kernel? You probably also need the latest /lib/modules. Using Hexxeh's updater tool should get you everything together.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 4042
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge
by Lorian » Fri Jun 01, 2012 6:50 pm
I used rpi-update

I continue to try and figure what's up:
Code: Select all
root@raspbian:/usr/local/lib/firmware/RTL8192U# modinfo 8192cu|grep ARM
vermagic:       3.1.9+ mod_unload modversions ARMv6


Code: Select all
root@raspbian:/usr/local/lib/firmware/RTL8192U# modprobe 8192cu
ERROR: could not insert '8192cu': Exec format error
root@raspbian:/usr/local/lib/firmware/RTL8192U#
root@raspbian:/usr/local/lib/firmware/RTL8192U# iwconfig
lo        no wireless extensions.

eth0      no wireless extensions.


Old module is blacklisted
Posts: 112
Joined: Sun Mar 11, 2012 10:09 am
by Lorian » Sat Jun 02, 2012 9:18 am
Switched to the Pieces image and used hexxeh's script to setu the wifi and its worked fine.

Soon as I did rpi-update and rebooted it fails again, same message.

There were a few error messages, possibly write errors (soemthing about mmc0....IRQ6 being ignored) during the firmware update.
Posts: 112
Joined: Sun Mar 11, 2012 10:09 am
by MrEngman » Sat Jun 02, 2012 9:32 am
Lorian wrote:Switched to the Pieces image and used hexxeh's script to setu the wifi and its worked fine.

Soon as I did rpi-update and rebooted it fails again, same message.

There were a few error messages, possibly write errors (soemthing about mmc0....IRQ6 being ignored) during the firmware update.


Hi Lorian,

Where can I find the script you used?

Thanks
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1855
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK
by Lorian » Sat Jun 02, 2012 12:44 pm
I meant the one you posted a link to, apologies if I got the aurhor wrong.
Posts: 112
Joined: Sun Mar 11, 2012 10:09 am
by MrEngman » Sat Jun 02, 2012 2:12 pm
Lorian wrote:I meant the one you posted a link to, apologies if I got the aurhor wrong.


That's no problem. I was just curious about using it on Pisces. Did you need to install anything else? Maybe wireless-tools and wpasupplicant?

The lastest images loaded by rpi-update stop the wireless working which is a real pain and I'm trying to find out why but haven't heard anything up till now.

I've updated the script so running rpi-update is now optional to get round the problem for the moment.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra
Posts: 1855
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK