about summary refs log tree commit diff
path: root/examples/python/dbus/show-bssids.py
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2021-02-11 18:11:46 +0100
committerMichael Biebl <biebl@debian.org>2021-02-11 18:11:46 +0100
commit80ec1decc49c72efec2a8b87c06245c92c0ab807 (patch)
treee3b229aa94e8dcf0590f2317664176e7b8f7607b /examples/python/dbus/show-bssids.py
parent65f86e8f56267192d42f2b629fc6b0c99fb9cd0c (diff)
New upstream version 1.29.90 upstream/1.29.90
Diffstat (limited to 'examples/python/dbus/show-bssids.py')
-rwxr-xr-xexamples/python/dbus/show-bssids.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/examples/python/dbus/show-bssids.py b/examples/python/dbus/show-bssids.py
index b56822fb..17364e49 100755
--- a/examples/python/dbus/show-bssids.py
+++ b/examples/python/dbus/show-bssids.py
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-# SPDX-License-Identifier: GPL-2.0+
+# SPDX-License-Identifier: GPL-2.0-or-later
 #
 # Copyright (C) 2010 Red Hat, Inc.
 #
@@ -7,6 +7,11 @@
 # This example prints out all the AP BSSIDs that all Wi-Fi devices on the
 # machine can see.  Useful for location-based services like Skyhook that
 # can geolocate you based on the APs you can see.
+#
+# Note that with NetworkManager clients are required to request scanning.
+# If you don't do that, the scan list may be outdated. That means, you would
+# check the LastScan property, and if necessary call RequestScan() first.
+# After RequestScan(), you wait until the LastScan property gets bumped again.
 
 import dbus
 
@@ -30,7 +35,7 @@ for d in devices:
 
     # Make sure the device is enabled before we try to use it
     state = prop_iface.Get("org.freedesktop.NetworkManager.Device", "State")
-    if state <= 2:
+    if state <= 20:  # NM_DEVICE_STATE_UNAVAILABLE
         continue
 
     # Get device's type; we only want wifi devices