joshvillbrandt / wireless

A dead simple, cross-platform Python library to connect to wireless networks.
https://pypi.org/project/wireless/
Apache License 2.0
83 stars 42 forks source link

Nmcli0990Wireless - connect() - set interface #13

Closed mwarzynski closed 5 years ago

mwarzynski commented 8 years ago

Problem I have more than one interface. I wanted to connect with the network using interface with the strongest signal. Actually, I specified interface manually just before connect() and it didn't work. By saying, didn't work I mean network-manager tried to estabilish connection, but with other interface than I specified.

My solution: I needed to change nmcli command in this place - https://github.com/joshvillbrandt/wireless/blob/master/wireless/Wireless.py#L263 for:

# attempt to connect
response = cmd('nmcli dev wifi con {} password {} ifname {}'.format(
    ssid, password, self._interface))

If it matters, I am using Kubuntu 16.04 LTS.

joshvillbrandt commented 7 years ago

@mwarzynski, is the only difference here removing the letters "nect" from "connect"? Just out of curiosity, do you know why that fixes that (and how it mostly worked before then?)

A pull request would be appreciated! Thanks.

mwarzynski commented 5 years ago

@joshvillbrandt Yes, it seems the only difference is removed nect. Unfortunately, I don't remember what was my nmcli version back then.

As for now:

~ nmcli --version    
nmcli tool, version 1.14.7dev+3+g353743b99-1
~ nmcli dev wifi help
...
ARGUMENTS := connect

There is a full connect argument, so accordingly to my current nmcli version there is no bug.

Actually, I suppose con is just a shortcut for connect.

mwarzynski commented 5 years ago

I am not able to reproduce this bug anymore.