slaphead99
Posts: 1
Joined: Thu Aug 16, 2012 3:11 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Thu Aug 16, 2012 3:21 pm

Brilliant! What a superb effort writing that script (and very amusing in parts :).

Just a few notes:

after trying a *long* time to get the wifi running using the script (no your fault at all), I had instant success when running:

sudo ip link set wlan0 up
&
sudo ip link set wlan1 up

(I had two cards to hedge my bets :)

This page was tremendously helpful too:

https://help.ubuntu.com/community/WifiDocs/WiFiHowTo



So- cheers! Pi Power!

magno23
Posts: 136
Joined: Sun Aug 12, 2012 4:11 pm
Location: Penafiel, Portugal

Re: Automatic setup for RTL8188CUS based wifi adapters

Thu Aug 16, 2012 6:43 pm

in what SO's does this work? does it work in OpenELEC?

hobo4567
Posts: 9
Joined: Fri Aug 17, 2012 12:25 am

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 12:39 am

My Adapter is rtl8188cus 802.11n
This is just what I need but I am a noobe so would you explain the way I can upload this script file and :
what is the one statement to start?
sudo apt-get install-rtl8188cus.sh?
when do I remove the router cable and when do I plug in the wireless adapter?

Victor

ers
Posts: 11
Joined: Mon Jun 11, 2012 9:45 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 1:20 am

for anyone needs the driver for latest version of linux which is currently:

Linux pi2 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux

Here is the compiled driver file: (took ages on my raspi to compile)
https://bitly.com/Ooigu1

just copy it to your modules directory and replace it with the older file.

KayKay
Posts: 2
Joined: Wed Aug 15, 2012 5:50 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 1:55 am

Hey, first of all, thanks a lot for the script. It works like a charm.

The only problem which I can't solve shows a very strage behaviour. I have a interfaces config like this:

Code: Select all

auto lo
iface lo inet loopback

iface eth0 inet static
...

allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
...
Everything works, if I configure my wlan0 interface with:

Code: Select all

wpa-ssid "..."
wpa-psk "..."
As soon as I try to use, wpa-conf and a wpa_supplicant.conf file to configure multiple wireless lan's to choose from, I can't connect to either the eth0, nor the wlan0 interface anymore. As soon as I unplug the wlan adapter, after that I am able to connect to the eth0 interface again (using SSH for example).

Any idea on that one? Thanks a lot in advance & best regards,
Kristian

PS: I am using a EDIMAX EW-7811UN directly plugged into the pi, but because it works with the wpa-ssid variant, power should not be an issue, isn't it?

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 10:54 am

hobo4567 wrote:My Adapter is rtl8188cus 802.11n
This is just what I need but I am a noobe so would you explain the way I can upload this script file and :
what is the one statement to start?
sudo apt-get install-rtl8188cus.sh?
when do I remove the router cable and when do I plug in the wireless adapter?

Victor
Did you read this post http://www.raspberrypi.org/phpBB3/viewt ... 358#p81358[/url]

Look on this wiki page and the links to instructions and the script are in the Micronet SP907NS, 11N Wireless LAN USB Adapter section.

There are pointers to instructions how to make your SD card and copy the script to it then how to run it. The script outputs a lot of information as it runs and will telling you what you need to do.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 11:22 am

KayKay wrote:Hey, first of all, thanks a lot for the script. It works like a charm.

The only problem which I can't solve shows a very strage behaviour. I have a interfaces config like this:

Code: Select all

auto lo
iface lo inet loopback

iface eth0 inet static
...

allow-hotplug wlan0
auto wlan0
iface wlan0 inet static
...
Everything works, if I configure my wlan0 interface with:

Code: Select all

wpa-ssid "..."
wpa-psk "..."
As soon as I try to use, wpa-conf and a wpa_supplicant.conf file to configure multiple wireless lan's to choose from, I can't connect to either the eth0, nor the wlan0 interface anymore. As soon as I unplug the wlan adapter, after that I am able to connect to the eth0 interface again (using SSH for example).

Any idea on that one? Thanks a lot in advance & best regards,
Kristian

PS: I am using a EDIMAX EW-7811UN directly plugged into the pi, but because it works with the wpa-ssid variant, power should not be an issue, isn't it?
May be a problem with configuring wpa_supplicant - its not simple and I had loads of problems to start with. And there are just too many rpi software versions and the setup on each is not consistent. Really doesn't help.

Did you see this http://www.raspberrypi.org/phpBB3/viewt ... 56#p150556

Shows set up with a wpa and an unsecured network. For 2 wpa networks delete the unsecured bit and duplicated the wpa part with it's own ssid and password. This is what I use on squeeze.

Also the line "ctrl_interface=/var/run/wpa_supplicant" may need changing to "ctrl_interface=/run/wpa_supplicant"

Like I said no consistency in different versions.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

GarethD
Posts: 21
Joined: Wed Aug 15, 2012 8:58 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 3:00 pm

I have had this wifi adapter on my Pi now a couple of days and its fab, just got power cable connected and work remotely.
I do have a problem though if you can help; if the router I have reboots the usb wifi adapter stops flashing and I get no wifi connection to my pi. :cry:
The only way to get the wifi reconnected is to reboot the pi or unplug the wifi adapter and plug it back in.
Is something wrong on my pi or is it just a setting I need to do.
Thanks in advance.

Gareth

mwingaa
Posts: 9
Joined: Sun May 13, 2012 7:43 am
Location: Elsinore, Denmark

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 3:05 pm

ers wrote:for anyone needs the driver for latest version of linux which is currently:

Linux pi2 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux

Here is the compiled driver file: (took ages on my raspi to compile)
https://bitly.com/Ooigu1

just copy it to your modules directory and replace it with the older file.
ers,

I owe you a beer!

After apt-get upgrade yesterday my wireless stopped working.
No wlan0 interface after boot.
MrEngman's script brings it up - until a reboot.
a sudo insmod gave this:
sudo insmod 8192cu.ko
Error: could not insert module 8192cu.ko: Invalid parameters

And I can't for my life figure out why MrEngman's script can when I can't do it by hand.

Anyway, I installed your new driver and everything is running again.

Thanks a lot.

Kind regards,

Mikael

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 3:28 pm

ers wrote:for anyone needs the driver for latest version of linux which is currently:

Linux pi2 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux

Here is the compiled driver file: (took ages on my raspi to compile)
https://bitly.com/Ooigu1

just copy it to your modules directory and replace it with the older file.
Latest version of linux?? which one? there are so many. I have not seen that version before. "Linux pi2" but this part "#272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux" is common to most versions after they've been upgrade, although the latest is now #278.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

KayKay
Posts: 2
Joined: Wed Aug 15, 2012 5:50 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 3:43 pm

MrEngman wrote:Also the line "ctrl_interface=/var/run/wpa_supplicant" may need changing to "ctrl_interface=/run/wpa_supplicant"

Like I said no consistency in different versions.
Hey! That one worked perfectly! Thanks a lot for your quick support! :-)

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 5:52 pm

magno23 wrote:in what SO's does this work? does it work in OpenELEC?
Works with most versions of wheezy I've tried and squeeze.

2012-07-15-wheezy-raspbian
raspbian pisces R1
raspbian pisces R2
raspbian pisces R3
raspbian pisces+Mate R1
raspbian hexxeh R3
raspbian_wheezy_20120608 (Darkbasic)
2012-06-18-wheezy-beta
2012_06_10_spindle_wheezy_public_alpha
2012-08-08-wheezy-armel
debian6-19-04-2012
Xbian 0.4.2
Xbian 0.5
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 7:21 pm

GarethD wrote:I have had this wifi adapter on my Pi now a couple of days and its fab, just got power cable connected and work remotely.
I do have a problem though if you can help; if the router I have reboots the usb wifi adapter stops flashing and I get no wifi connection to my pi. :cry:
The only way to get the wifi reconnected is to reboot the pi or unplug the wifi adapter and plug it back in.
Is something wrong on my pi or is it just a setting I need to do.
Thanks in advance.

Gareth
Just tried this on my Pi and I see the same behaviour. Turned of the access point and the wifi looses it's IP address. You can see this using command "ifconfig wlan0". When the access point is reconnected the wifi just sits doing nothing. As I have a keyboard and monitor connected I can use the command "ifup wlan0" or "ifup --force wlan0" to bring it back up.

Really annoying. I've no idea why it happens, or doesn't depending on which way you look at it. Could be some setup issue but I tried with wheezy and also with a squeeze image using wpa_supplicant for the network connections and that behaves the same if the access point is down long enough. Something else to add to my list of things to investigate.

A possible way round it would be to use a script running in the background to monitor wlan0 and check it has an IP address. If the address disappears the script willl attempt to restart wlan0. Something like

Code: Select all

#!/bin/bash

while true; do
# check if wlan0 has an IP address assigned
    if ifconfig wlan0 | grep -q "inet addr:" ; then
# if wlan0 has an IP go to sleep for 60 seconds before checking again
        sleep 60
    else
# wlan0 has no IP. force a reconnect if possible
        ifup --force wlan0  >/dev/null 2>&1
    fi
done
I have just tried this and it appears to work OK. Copy the code into a file - say check-ip.sh. To start the script in the background add & to the end of the command like "sudo ./check-ip.sh&" if not logged in as root. If logged in as root no need for "sudo".

It should be possible to start it automatically when the Pi boots but I'm not sure how to do that.

This will run forever in the background checking that wlan0 has an ip and if it finds it doesn't it will attempt to restart wlan0, by force if necessary.

If you try it let me know how you get on.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

jjones3
Posts: 4
Joined: Fri Aug 17, 2012 7:21 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 7:34 pm

Does anyone have the drivers for:
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Cross-compiled on:
Linux pwnpi 3.2.20-rpi1+ #5 Sun Jun 17 15:59:27 BST 2012 armv6l GNU/Linux

I am not smart enough to figure out all of the issues I ran into trying to learn to cross-compile :-)

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 7:55 pm

jjones3 wrote:Does anyone have the drivers for:
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Cross-compiled on:
Linux pwnpi 3.2.20-rpi1+ #5 Sun Jun 17 15:59:27 BST 2012 armv6l GNU/Linux

I am not smart enough to figure out all of the issues I ran into trying to learn to cross-compile :-)
What is that image? Where does that image come from? And the source. Not seen that one before.

If I can get the source and the config file the image uses then it's pretty straight forward to generate a compatible driver. The config is usually saved in the image at /proc/config.gz but trying to find the source, hmmm.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

jjones3
Posts: 4
Joined: Fri Aug 17, 2012 7:21 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 8:00 pm

What is that image? Where does that image come from? And the source. Not seen that one before.
http://www.pwnpi.net/

Not sure if they provide the source. I was using the git clone model to attempt, but I ran into several challenges.

aptoitos
Posts: 2
Joined: Fri Aug 17, 2012 8:42 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 8:46 pm

Hi,

Will this script work with Raspbian?

mattura
Posts: 20
Joined: Tue Aug 14, 2012 6:51 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 9:26 pm

ers wrote:for anyone needs the driver for latest version of linux which is currently:

Linux pi2 3.1.9+ #272 PREEMPT Tue Aug 7 22:51:44 BST 2012 armv6l GNU/Linux

Here is the compiled driver file: (took ages on my raspi to compile)
https://bitly.com/Ooigu1

just copy it to your modules directory and replace it with the older file.
My version is:

Linux raspberrypi 3.1.9-cutdown-aufs #23 PREEMPT Mon Aug 13 15:20:21 CEST 2012 armv6l GNU/Linux

Due to this, the script fails. Is there a driver file for this distro? If not, how would I go about compiling it?
Thanks

GarethD
Posts: 21
Joined: Wed Aug 15, 2012 8:58 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 10:20 pm

MrEngman wrote:
GarethD wrote:I have had this wifi adapter on my Pi now a couple of days and its fab, just got power cable connected and work remotely.
I do have a problem though if you can help; if the router I have reboots the usb wifi adapter stops flashing and I get no wifi connection to my pi. :cry:
The only way to get the wifi reconnected is to reboot the pi or unplug the wifi adapter and plug it back in.
Is something wrong on my pi or is it just a setting I need to do.
Thanks in advance.

Gareth
Just tried this on my Pi and I see the same behaviour. Turned of the access point and the wifi looses it's IP address. You can see this using command "ifconfig wlan0". When the access point is reconnected the wifi just sits doing nothing. As I have a keyboard and monitor connected I can use the command "ifup wlan0" or "ifup --force wlan0" to bring it back up.

Really annoying. I've no idea why it happens, or doesn't depending on which way you look at it. Could be some setup issue but I tried with wheezy and also with a squeeze image using wpa_supplicant for the network connections and that behaves the same if the access point is down long enough. Something else to add to my list of things to investigate.

A possible way round it would be to use a script running in the background to monitor wlan0 and check it has an IP address. If the address disappears the script willl attempt to restart wlan0. Something like

Code: Select all

#!/bin/bash

while true; do
# check if wlan0 has an IP address assigned
    if ifconfig wlan0 | grep -q "inet addr:" ; then
# if wlan0 has an IP go to sleep for 60 seconds before checking again
        sleep 60
    else
# wlan0 has no IP. force a reconnect if possible
        ifup --force wlan0  >/dev/null 2>&1
    fi
done
I have just tried this and it appears to work OK. Copy the code into a file - say check-ip.sh. To start the script in the background add & to the end of the command like "sudo ./check-ip.sh&" if not logged in as root. If logged in as root no need for "sudo".

It should be possible to start it automatically when the Pi boots but I'm not sure how to do that.

This will run forever in the background checking that wlan0 has an ip and if it finds it doesn't it will attempt to restart wlan0, by force if necessary.

If you try it let me know how you get on.

Being a noob at scripts I just spent an hour getting this script to work
and I must say its been fun..... this is what the PI is all about (for me).

I was amazed to watch the wifi adapter light start flashing 1 minute after I
had rebooted my router; and then I ssh'ed in as normal.

Many thanks Mr Engman for this solution, it works brill.

If you come across a way of reconnecting a wifi connection automatically I would
be grateful if you would let me know.

Gareth :)

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 10:24 pm

GarethD wrote:
MrEngman wrote:
GarethD wrote:I have had this wifi adapter on my Pi now a couple of days and its fab, just got power cable connected and work remotely.
I do have a problem though if you can help; if the router I have reboots the usb wifi adapter stops flashing and I get no wifi connection to my pi. :cry:
The only way to get the wifi reconnected is to reboot the pi or unplug the wifi adapter and plug it back in.
Is something wrong on my pi or is it just a setting I need to do.
Thanks in advance.

Gareth
Just tried this on my Pi and I see the same behaviour. Turned of the access point and the wifi looses it's IP address. You can see this using command "ifconfig wlan0". When the access point is reconnected the wifi just sits doing nothing. As I have a keyboard and monitor connected I can use the command "ifup wlan0" or "ifup --force wlan0" to bring it back up.

Really annoying. I've no idea why it happens, or doesn't depending on which way you look at it. Could be some setup issue but I tried with wheezy and also with a squeeze image using wpa_supplicant for the network connections and that behaves the same if the access point is down long enough. Something else to add to my list of things to investigate.

A possible way round it would be to use a script running in the background to monitor wlan0 and check it has an IP address. If the address disappears the script willl attempt to restart wlan0. Something like

Code: Select all

#!/bin/bash

while true; do
# check if wlan0 has an IP address assigned
    if ifconfig wlan0 | grep -q "inet addr:" ; then
# if wlan0 has an IP go to sleep for 60 seconds before checking again
        sleep 60
    else
# wlan0 has no IP. force a reconnect if possible
        ifup --force wlan0  >/dev/null 2>&1
    fi
done
I have just tried this and it appears to work OK. Copy the code into a file - say check-ip.sh. To start the script in the background add & to the end of the command like "sudo ./check-ip.sh&" if not logged in as root. If logged in as root no need for "sudo".

It should be possible to start it automatically when the Pi boots but I'm not sure how to do that.

This will run forever in the background checking that wlan0 has an ip and if it finds it doesn't it will attempt to restart wlan0, by force if necessary.

If you try it let me know how you get on.

Being a noob at scripts I just spent an hour getting this script to work
and I must say its been fun..... this is what the PI is all about (for me).

I was amazed to watch the wifi adapter light start flashing 1 minute after I
had rebooted my router; and then I ssh'ed in as normal.

Many thanks Mr Engman for this solution, it works brill.

If you come across a way of reconnecting a wifi connection automatically I would
be grateful if you would let me know.

Gareth :)
I certainly will. Anyway really good to see it works for you as well.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 10:29 pm

jjones3 wrote:
What is that image? Where does that image come from? And the source. Not seen that one before.
http://www.pwnpi.net/

Not sure if they provide the source. I was using the git clone model to attempt, but I ran into several challenges.
Having seen what it is all about I'm not supplying a driver for that image.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 10:41 pm

aptoitos wrote:Hi,

Will this script work with Raspbian?
Works with a number of raspbian images. Check out the documentation. It includes a list of images it works with. Look here.
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

MrEngman
Posts: 4032
Joined: Fri Feb 03, 2012 2:17 pm
Location: Southampton, UK

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 10:44 pm

mattura wrote:
My version is:

Linux raspberrypi 3.1.9-cutdown-aufs #23 PREEMPT Mon Aug 13 15:20:21 CEST 2012 armv6l GNU/Linux

Due to this, the script fails. Is there a driver file for this distro? If not, how would I go about compiling it?
Thanks
Where can I find this image?
Simplicity is a prerequisite for reliability. Edsger W. Dijkstra

Please post ALL technical questions on the forum. Please Do Not send private messages.

MarkDavies
Posts: 7
Joined: Mon Jul 30, 2012 11:56 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Fri Aug 17, 2012 10:45 pm

All worked well after running the script and the wifi connection was working to my router with the blue light flashing however on restarting the pi the wlan0 will not come up. Getting the error :-
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1


The wpa-ssid and wpa-psk entries are configured in /etc/network/interfaces (as done by installer script)
Any ideas appreciated
Cheers

jjones3
Posts: 4
Joined: Fri Aug 17, 2012 7:21 pm

Re: Automatic setup for RTL8188CUS based wifi adapters

Sat Aug 18, 2012 3:00 am

Report this postReply with quotePermalink
by MrEngman » Fri Aug 17, 2012 11:29 pm
jjones3 wrote:
What is that image? Where does that image come from? And the source. Not seen that one before.


http://www.pwnpi.net/

Not sure if they provide the source. I was using the git clone model to attempt, but I ran into several challenges.

Having seen what it is all about I'm not supplying a driver for that image.
Posts: 348
Joined: Fri Feb 03, 2012 3:17 pm
Really? Do you have something against pen testing professionals?
I will respect your opinion, but that did surprise me to read.

Also, for others that read this, occidentalis image works with this wifi adapter, but you gotta build all the other apps by hand.

Return to “Beginners”