Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with wireless card detection #1

Open
kozliatko opened this issue Feb 24, 2021 · 13 comments
Open

Problem with wireless card detection #1

kozliatko opened this issue Feb 24, 2021 · 13 comments

Comments

@kozliatko
Copy link

kozliatko commented Feb 24, 2021

wlp1s0    Link encap:Ethernet  HWaddr 44:03:2c:9d:81:b8  
          inet addr:10.0.0.113  Bcast:10.0.0.255  Mask:255.255.255.0
          inet6 addr: fe80::e6d4:d75d:d152:dcb0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:472967 errors:0 dropped:0 overruns:0 frame:0
          TX packets:254140 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:299563101 (299.5 MB)  TX bytes:60382595 (60.3 MB)

gwen wifi-channel-watcher # ./channel-watch 
Wifi interface appears to be inactive.  Using a Pi?
For troubleshooting: https://github.com/angela-d/wifi-channel-watcher/wiki/Troubleshooting

I think it's because you assume a fixed number of columns, but Network name can contain more fields


gwen wifi-channel-watcher # nmcli con show --active
NAME           UUID                                  TYPE             DEVICE 
Auto slniecko  561a7513-cd9b-4887-8a6b-15ebeeaa4293  802-11-wireless  wlp1s0 
vpn0           09273c1c-a70e-4d5f-a371-e2b6a247b443  tun              vpn0   

and your script looks at position $3

# wifi active?
if [ "$(nmcli con show --active | awk '$3 ~ "wifi"')" == "" ];
@angela-d
Copy link
Owner

Thank you for the detailed report!

Here's my system:

NAME          UUID                                  TYPE  DEVICE 
myssid  myuuid  wifi  wlp3s0 

(column $3 is wifi)

I adjusted the match to have a condition:

if [ "$(nmcli con show --active | awk '$3 ~ "wifi" || "*wireless"')" == "" ];

I matched column 3, instead of 4, as I have been in systems that also have different device names; I didn't realize the wifi/wireless difference was a thing.

Please do a pull and see if the bugfix works for you.

@kozliatko
Copy link
Author

May be nmcli with -t and -f is better way

@angela-d
Copy link
Owner

Sorry, not sure I follow.

Does the bugfix in master fix this issue for you?

@kozliatko
Copy link
Author

gwen ~/Downloads/wifi-channel-watcher $ ./channel-watch
Error: Option '-g' is unknown, try 'nmcli -help'.
./channel-watch: line 122: [: : integer expression expected

@angela-d
Copy link
Owner

angela-d commented Feb 26, 2021

Can you post the first 2 lines of:

nmcli dev show

Should look something like this:

GENERAL.DEVICE:                         wlp3s0
GENERAL.TYPE:                           wifi

I have a suspicion GENERAL.TYPE might be returning something like wireless for you, similarly to the initial problem you reported with the different interface naming.

Please do another pull and test the latest code, I believe that should fix this particular issue.

@kozliatko
Copy link
Author

for wifi

GENERAL.DEVICE: wlp1s0
GENERAL.TYPE: wifi

but very first two lines was from VPN
GENERAL.DEVICE: vpn0
GENERAL.TYPE: tun

@kozliatko
Copy link
Author

kozliatko commented Mar 1, 2021

I think problem is that I have NAME with two words:

gwen ~ $ nmcli con show --active
NAME UUID TYPE DEVICE
Auto MyNet 561a7513-cd9b-4887-8a6b-15ebeeaa4293 802-11-wireless wlp1s0
ForWork OC e9179761-529d-450d-8794-51e3e9cacf90 vpn wlp1s0
vpn0 b573bccc-6af7-4dab-b2d8-4f1b3d0abafe tun vpn0

@angela-d
Copy link
Owner

angela-d commented Mar 2, 2021

Auto MyNet 561a7513-cd9b-4887-8a6b-15ebeeaa4293 802-11-wireless wlp1s0

This was likely the problem.

I believe this is fixed in the active master repo:
16fc7cf

Instead of:

nmcli -g chan dev wifi list | sort | uniq -c)

(a hard match on wifi)

It does a soft match of wi:

nmcli -g chan dev wi list | sort | uniq -c

Please pull the latest code and see if it works for you.

When you update your local codebase, take note of the new threshold option, you'll need to add it to your config file located in:
/home/your_username/.config/wifi-channel-watcher/config.conf - this new option gives you the ability to reduce the amount of notifications you receive if you're in a dense area and have no choice but to share your channels.

@kozliatko
Copy link
Author

gwen ~ $ nmcli -g chan dev wi list | sort | uniq -c
Error: Option '-g' is unknown, try 'nmcli -help'.
gwen ~ $ nmcli --version
nmcli tool, version 1.2.6

@angela-d
Copy link
Owner

angela-d commented Mar 3, 2021

That is an extremely old version, even older than the Debian stretch version of nmcli.

What operating system are you running?

If you haven't updated in a while, you should consider updating the operating system.

This was originally built on Debian buster, which is typically one of the distros that have the oldest packages.

I tested on stretch and it too, lacks the -g option, so I will set a minimum requirement of nmcli 1.14.

Irregardless of what distro you're running, this is a good read about running old and outdated operating systems: https://blog.linuxmint.com/?p=4030

@angela-d
Copy link
Owner

angela-d commented Mar 5, 2021

Was an outdated OS the problem, @kozliatko ?

I'd like to help you get this working, but as even the most crusty of distros has a later version of nmcli, I don't see it worthwhile to backport changes to support a version so old.

The output of nmcli's suggested script mode (-t terse mode), doesn't have the same flexibility as -g else it would have been a trivial change, irregardless of version used.

-f was originally the flag used, but on Debian stretch, I had recurring issues where the suggested channel would return CHAN (the array name) rather than a numeric channel. (-f doesn't hide the header, which is why I switched to using -g)

If you are on hardware that cannot update to a later OS, you could certainly update your installation to use -f, instead and be able to utilize the script.

If you or anyone else reading this has a better approach, I'm open to suggestions or PRs.

@kozliatko
Copy link
Author

Yes, this is an extremely old version, but still supported.

I have Linux Mint 18.3, Long term support release (LTS), supported until April 2021 with all updates installed.

@angela-d
Copy link
Owner

angela-d commented Mar 6, 2021

I didn't realize Mint had such old packages in still supported versions!!

According to Wikipedia, 18.3 is end of life in April 2021: https://en.wikipedia.org/wiki/Linux_Mint_version_history

If you intend to do a dist-upgrade before the official EOL, please let me know what version of nmcli v19 has; if it too is old, I will rework the script to make it compatible.

With only a month of life left in 18.3, I don't think it's worth the effort until we know what version v19 offers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants