Saving schemes
Opened this issue · 6 comments
Howdy @rockymeza!
In trying to setup automatic wifi connection with the Raspberry Pi, I noticed that wifi
will add a line like this to /etc/network/interfaces
:
iface wlan0-W7DC7 inet dhcp
Is this solely so that wifi
can find the configuration again for that wifi network? Because if I remove the -W7DC7
my wifi card will reconnect automatically on reboot, but with the dash ssid name it will not automatically try to reconnect.
Would it be possible to change it to something like:
iface wlan0 inet dhcp #W7DC7
So that wifi can still find the config but it will try to connect automatically? Or would have multiple entries like that just make everything messed up? /etc/network/interfaces
is not my forté 😢
Just found your lib the other day, great work!
Hi @dalanmiller,
Thanks for trying out the wifi library!
Wifi uses the wlan0-scheme
syntax in order to store different configurations of networks. Like you said, having multiple entries like that would probably just mess everything up. I think it's possible to still have the scheme names and have what you want as well. Can you please post your /etc/network/interfaces
file? You should probably remove the passwords (lines starting with wpa-psk
and wireless-key
) before posting it. If you don't feel comfortable posting it on GitHub, you can email it to me as well. My email address is my GitHub username at gmail.
Sure thing, here's what I got ssid and pw have been changed 😄
Commented out is an example of what wifi
creates (as you well know) but uncommented I have just removed the -A_NAME
part as I mentioned before.
Overall, there just has to be a better way to autoconfigure WiFi via the command line and I think your wifi
is the closest thing to it!
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcp
auto wlan0
allow-hotplug wlan0
#iface wlan0-A_NAME inet dhcp
# wpa-psk A_PW
# wpa-ssid A_NAME
# wireless-channel auto
iface wlan0 inet dhcp
wpa-psk A_PW
wpa-ssid A_NAME
wireless-channel auto
iface default inet dhcp
You have a line in there that says "auto wlan0". Can you try changing it to
"auto wlan0=wlan0-A_NAME".
I don't know if that is what you want though, because it only allows you to
connect to one network by default. Wifi also has an "autoconnect" command,
but three is a big with it. I actually recently figured out how to fix
that, so I will get onto fixing it.
Let me know if changing that auto line works.
-rocky
2014年9月22日 上午2:30于 "Daniel Alan Miller" notifications@github.com写道:
Sure thing, here's what I got ssid and pw have been changed [image:
😄]Commented out is an example of what wifi creates (as you well know) but
uncommented I have just removed the -A_NAME part as I mentioned before.Overall, there just has to be a better way to autoconfigure WiFi via the
command line and I think your wifi is the closest thing to it!auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet dhcpauto wlan0
allow-hotplug wlan0#iface wlan0-A_NAME inet dhcp
wpa-psk A_PW
wpa-ssid A_NAME
wireless-channel auto
iface wlan0 inet dhcp
wpa-psk A_PW
wpa-ssid A_NAME
wireless-channel autoiface default inet dhcp
—
Reply to this email directly or view it on GitHub
#50 (comment).
Right now I just want the Raspberry Pi to connect and reconnect to a WiFi network automatically. Using the wifi autoconnect
command is helpful but it requires someone to be connected to the Pi at the command prompt and issuing commands. What I'm looking for is complete automation on the RBPi's part.
wifi
can almost create the config that is required to connect automatically which is why I'm wondering if there's an alternate. The config I posted in its current state will connect to WiFi automatically upon start but I had to edit the config that wifi
added in order to get it to work. I think the config wifi
adds should also support automatic connection/reconnection, no?
Hi @dalanmiller,
Did you try changing the auto
line in the /etc/network/interfaces
file?
Regarding the wifi autoconnect
command. I had imagined that you would put it in the start up scripts so that it would run automatically. That way nobody has to login and run anything. I think you can put a script in the /etc/init.d
directory for handling this 0.
As for handling reconnecting, I don't really have a solution for that. I was searching for some sort of event that is fired on disconnect--that way you could do something with that. I was thinking that we could add some sort of syntax for running until the connection is broken.
while true; do
wifi autoconnect --stay-open
done
Which hopefully would just wait and listen until the disconnect event is fired and then exit, which would cause the while loop to run again. This of course is not a great manager, but if wifi supported this then I don't see why it wouldn't support something like supervisor.
I'm a little pessimistic as to whether or not this event actually exists. So maybe we would have to back down to something less elegant like polling every second to find out if the connection has failed.
Would something like this be what you wanted? Do you have a better solution?
@rockymeza have you looked into ifupdown?
I think this might be something we could aim towards.
Or perhaps for the autoconnection part of wifi
, perhaps you should encourage people to install wicd
and then manipulate it via the command line?
My thinking of use case always go back to the Raspberry Pi and doing this in the most automated way possible that makes it work for most people and you just have to set it up once. Creating a start up script seems too manually for something that should be automatic like networking. What do you think?