There's no need to iterate over all devices in /sys/class/net and check
if the phy index matches, sysfs already provides per phy devices.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Providing the channel alone isn't clear as there're overlapping channels
on e.g. band 2 and 6.
Note: This changes the ABI.
Signed-off-by: Andre Heider <a.heider@gmail.com>
So that consumers don't have to fiddle around with mapping frequencies
to bands, which everyone seems to do a little differently.
Note: This changes the ABI.
Signed-off-by: Andre Heider <a.heider@gmail.com>
iwinfo.h have a mixed way to declare defines, some use enum, some define
bits in enum and other have their own special way. In all of this case
the count of all this defines is hardcoded to an arbitrary number.
To make code less error prone, convert everything to a common pattern
and use enum way to calculate the count of each flags.
Also drop defining number for each flag and just declare that the enum
starts from 0.
Move the related char array just below the define declaration to improve
code readability.
No functionl change intended.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
A nice and stable working mainline driver deserves first class support,
and this adds all USB devices supported by it.
The PIDs/VIDs are taken directly from the driver, in the very same order
to make future syncs easy.
The single left out entry is the unknown 148f:760a.
Signed-off-by: Andre Heider <a.heider@gmail.com>
This adds the single missing compatible supported by the mt76 driver,
which is used by a bunch of ramips mt7628an devices.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Some device have embedded wifi card that are not connected with usb or
internall with pci. Such device have fake device_id and only the
vendor_id actually reflect something real but internally they don't have
any id and are just matched by the node compatible binding in DT.
We currently match this with a big if-else to match the single devices
but this can be improved and be matched directly in devices.txt
Rework this so that we can drop the big if-else and move the matching
to devices.txt
When a device is matched using compatible in iwinfo the hardware will be
flagged as embedded and won't print empty ids.
Update devices.txt by migrating all the compatible matching device from
fake id to compatible matching.
Tested-by: Christian Marangi <ansuelsmth@gmail.com> # ipq4019
Co-developed-by: Christian Marangi <ansuelsmth@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Tested-by: Robert Marko <robimarko@gmail.com> # ipq8074
Reviewed-by: Andre Heider <a.heider@gmail.com>
The "chan_width" var contains an index, not a value.
While at it, make the 40 and 2040 description shorter and clearer.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Match by frequency and not by channel as the radio might have the same
channel on multiple bands:
$ iwinfo radio0 freqlist
[snip]
* 2.432 GHz (Channel 5)
[snip]
* 5.975 GHz (Channel 5)
[snip]
Signed-off-by: Andre Heider <a.heider@gmail.com>
Some defines/enums use bits, while some functions only set a single one.
Make it less painful to get to a name for those.
This avoids hardcoding bit lists for consumers.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Unify how hwmodes are displayed, e.g.:
"802.11ac/ax/b/g/n" instead of "802.11bgnacax".
Luci currently uses a natural sort order, but that probably doesn't work
as intended once "be" is added, so let's do this here.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Use a hyphen for the WEP cipher names, just as the others. Not that
anyone cares anymore, but this let's us use this array instead of
everyone fixing it up on their own.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Repurpose the IWINFO_FREQ_NO_2160MHZ define for that, which was
introduced but never used. nl80211 doesn't have such a flag either.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Just use the already provided info instead of mapping frequencies.
Fixes mapping lower frequencies of the 6G band, which starts at 5935MHz.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Required for NL80211_BAND_6GHZ and NL80211_FREQUENCY_ATTR_NO_HE.
Taken from the v5.15.74 release, which is the current version of the
used mac80211 package.
Signed-off-by: Andre Heider <a.heider@gmail.com>
Update using current linux sources, which this was apparently
based on.
Signed-off-by: Andre Heider <a.heider@gmail.com>
[don't fail if no ieee80211ax option is present]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
It's too slow to do it all over again and again, especially with e.g.
luci constantly polling.
Before:
$ time iwinfo phy0 info
real 0m 0.54s
$ time iwinfo radio0 info
real 0m 0.70s
$ time ubus call luci-rpc getWirelessDevices
real 0m 0.67s
After:
$ time iwinfo phy0 info
real 0m 0.04s
$ time iwinfo radio0 info
real 0m 0.09s
$ time ubus call luci-rpc getWirelessDevices
real 0m 0.17s
Signed-off-by: Andre Heider <a.heider@gmail.com>
Add USB PID/VID as found on e.g. Comfast CF-953AX.
Signed-off-by: Andre Heider <a.heider@gmail.com>
[rebase onto current master]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Treat USB vendor and product IDs like PCI subsystem vendor and device IDs
respectively to allow describing USB devices as `0000 0000 $vid $pid` in
the hardware database.
As a side effect, this also skips potentially expensive MTD lookups on
embedded devices with plugged in USB radios.
With a 5.15 kernel, such MTD lookups even spam dmesg with:
mtdblock: MTD device 'factory' is NAND, please consider using UBI block devices instead.
This fix speeds up iwinfo considerably on affected systems:
Before:
sys 0m 3.56s
After:
sys 0m 0.09s
Suggested-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This isn't required nor used anymore, and it's been +8 years.
See
"735a03be: iwinfo: adjust for changed wpa_supplicant control socket path"
on the main repository.
Signed-off-by: Andre Heider <a.heider@gmail.com>
No data at all can currently be read from the control socket.
Set up the permission exactly like hostapd's wpa_cli utility to fix it.
Among other this fixes a mesh's encryption being shown as "None".
Signed-off-by: Andre Heider <a.heider@gmail.com>