Iw "do not screenscrape" & iwinfo reported signal


So I'm looking to use iw adhoc0 station dump, where adhoc0 is the name of the wireless interface to get some information relative to other devices, such as bytes transferred and relative signal strength. It seems to work and give data fine, however when running iw without any other parameters for more information about the command, there's a glaring disclaimer that says, "Do NOT screenscrape this tool, we don't consider its output stable."

What specifically about the command isn't stable? If iw is not what I should be looking to use, would someone be able to point me to a utility that might still offer me the information that I'm looking for?

The other question I have is about the output when I run, iwinfo adhoc0 info. When running iw adhoc0 station dump, it gives information about the signal strength for each of the other devices it sees, I assume this is the strength of the signal at the point at which the signal reaches the device that I'm connected to. First of all, is this a correct assumption? And what then does the signal strength reported in iwinfo adhoc0 info represent?

I would really appreciate answers or direction to where to look for more information for either or both of these questions. I definitely admit to treading unfamiliar territory, so please excuse me if it seems that I'm asking rather obvious stuff.

1 Like

Just what it says, don't depend on the format not changing for scripting purposes. If iw is updated, your scripts may fail, as they aren't guaranteeing that the text output is a stable API.

The signal strength is at the device you queried, not the remote. If you see multiple values, that is because your chipset supports antenna diversity.

iwinfo is an OpenWRT-specific user-space application. Its source can be viewed at https://git.openwrt.org/project/iwinfo.git That may help you understand its output, as well as the stable APIs that it queries.

Another source of data is the ubus system.

ubus -v list

will give you an idea of what data is available, as well as additional methods that can be called.

1 Like

If you find an iw-independent alternative for signal strength, please come back and post it.

In travelmate I use this:

 trm_ifquality="$(${trm_iwinfo} ${ifname} info 2>/dev/null | awk -F "[\/| ]" '/Link Quality:/{printf "%i\n", (100 / $NF * $(NF-1)) }')"
1 Like

use hostapd + json
this topik