wimble
Posts: 34
Joined: Tue Feb 05, 2013 9:52 am

Wifi: fallback to access point if no available networks

Thu Feb 07, 2013 10:02 am

I've got my Pi wifi'd up, with a couple of network connections configured (as per the instructions at http://elinux.org/RPi_Peripherals). This connects the Pi to the appropriate network when the interface is brought up.

But what happens if there's no appropriate wifi available? Does anybody know if there's a way to start the wifi, with a pre-configured SID, so that at least I'd be able to have a private connection into the Pi, and could then SSH in, and continue work?

If it's not obvious, I'm intending this for completely headless access, so I don't have to take a keyboard or screen with me: I can just SSH across from my phone.

lukeguk
Posts: 1
Joined: Tue Feb 12, 2013 11:28 am

Re: Wifi: fallback to access point if no available networks

Tue Feb 12, 2013 11:31 am

I am very interested in doing this too.

Would setting the pi up as an access point (there are a few tutorials on this) work? I want to be able to SSH into my pi from an app on my phone when out and about without wifi. If seems that I would need a wifi adapter that supports AP mode, which my current Edimax one doesn't.

adigraham
Posts: 3
Joined: Wed Mar 07, 2012 12:22 pm

Re: Wifi: fallback to access point if no available networks

Tue Feb 12, 2013 12:42 pm

I too am looking into how this could be done, basically I want this:-

RPI with Openelec installed hidden in the car dash and connected to my car stereo with ad-hoc wifi network and XBMC Commander app on my iphone controlling what i play.

When the car is outside my house to have the wifi change to normal wifi to then allow a rsync with my home nas to check for updated music etc.

All help appreciated!

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Wifi: fallback to access point if no available networks

Tue Feb 12, 2013 4:05 pm

Something like this ?
http://sirlagz.net/2013/01/22/script-st ... goes-down/

You could potentially use this script to bring up the wifi connection and run an rsync as well when you get back home, though I haven't coded that bit yet.
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

adigraham
Posts: 3
Joined: Wed Mar 07, 2012 12:22 pm

Re: Wifi: fallback to access point if no available networks

Tue Feb 12, 2013 4:31 pm

hey, lol was bookmarking your site earlier!

Yeah thats what we want (friend of mine too wants a raspcarputer :)

Do you think a script will suffice?

wimble
Posts: 34
Joined: Tue Feb 05, 2013 9:52 am

Re: Wifi: fallback to access point if no available networks

Tue Feb 12, 2013 4:51 pm

Yup, that looks very much like the sort of thing I was after. Hmm... I wonder whether it's possible to integrate it with ifup and ifdown to avoid the polling. I'll give it a go this evening.

Integrating it with ifup is probably a bad idea: it would drop the access point just because a better external network appeared, and it may not be possible to detect the external network in such cases, anyway. But hooking it into ifdown would be nice.

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Wifi: fallback to access point if no available networks

Wed Feb 13, 2013 12:35 am

That script actually needs some improvements.
I'm not sure how you would integrate it into ifup or ifdown...I don't really see a reason why you would want to either.

At the moment, I don't think that script will reconnect to a network when it comes back into range, purely because it can't poll for networks when hostapd is running as far as I can recall. I need to do some more testing with that aspect of it though.
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

wimble
Posts: 34
Joined: Tue Feb 05, 2013 9:52 am

Re: Wifi: fallback to access point if no available networks

Wed Feb 13, 2013 10:44 am

SirLagz wrote:I'm not sure how you would integrate it into ifup or ifdown...I don't really see a reason why you would want to either.
Simply because I dislike having to constantly poll to see whether an action needs to be performed. 99% of the time there's nothing to be done (the wifi is connected), and on the occasions where it is needed, it would have been useful to have it done *sooner* (eg. with cron, the finest resolution is a minute, so, on average, you're going to have 30 seconds before the access point is brought up). Tying it into the existing networking scripts means that the work will be done as soon as it's needed, and there are no unnecessary tests.

I didn't get around to resolving this last night, but I did find enough about wpa_supplicant to find out that I need to find out more. Hi-ho! It's off to read the internet I go!

SirLagz
Posts: 1705
Joined: Mon Feb 20, 2012 8:53 am
Location: Perth, Australia
Contact: Website

Re: Wifi: fallback to access point if no available networks

Wed Feb 13, 2013 12:22 pm

Probably best putting the script into /etc/network/if-down.d/ then, in which scripts run when ifdown is run.
My Blog - http://www.sirlagz.net
Visit my blog for Tips, Tricks, Guides and More !
WiFi Issues ? Have a look at this post ! http://www.raspberrypi.org/phpBB3/viewtopic.php?f=28&t=44044

adigraham
Posts: 3
Joined: Wed Mar 07, 2012 12:22 pm

Re: Wifi: fallback to access point if no available networks

Wed Feb 13, 2013 12:28 pm

Great work guys!

A friend and myself are going to build Openelec RPis this weekend, so if we can help you guys then shout.

Return to “Networking and servers”