summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* devices: add MediaTek MT7981 WMAC compatibleHEADmasterDavid Bauer2023-05-171-0/+1
| | | | | | This adds detection for the MediaTek MT7981 WMAC. Signed-off-by: David Bauer <mail@david-bauer.net>
* devices: add compatible strings for Ralink WiSoCsDaniel Golle2023-02-081-9/+10
| | | | | | | | | | | | | | | | | Now that iwinfo_hardware_id_from_mtd() is no longer called in case a compatible string is found we need to add those to devices.txt. Unfortunately some WiSoCs share the same dtsi and hence also the compatible string, so detection is now slightly wrong for those, as they were previously identified parsing the MTD EEPROM data. As a reminder that this will need fixing, the following entries have been left in devices.txt: 0x1814 0x3051 0x1814 0x0007 0 0 "Ralink" "Rt3051" 0x1814 0x3052 0x1814 0x0008 0 0 "Ralink" "Rt3052" 0x1814 0x3350 0x1814 0x000b 0 0 "Ralink" "Rt3350" 0x1814 0x3662 0x1814 0x000d 0 0 "Ralink" "Rt3662" Fixes: fac0787 ("devices: add support for declaring compatible matched devices") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* nl80211: restore iterating over all devices in nl80211_phy2ifname()Andre Heider2023-02-061-4/+6
| | | | | | | | | | | | | | | This reverts to the earlier behaviour, because: * phys can be renamed, which breaks hardcoding "phy%d" * /sys/class/ieee80211/*/device can return networks of other phys, since "device" is a symlink which can have multiple phys The earlier behaviour fixes both points. Fixes: 6194aaf0 "nl80211: simplify iterating over phy's devices" Signed-off-by: Andre Heider <a.heider@gmail.com> Tested-by: Olcay Korkmaz <nuke_mania@hotmail.com> [ drop extra Fixes tag related to openwrt issue ] Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* iwinfo: readd missing define for IWINFO_AUTH in headerChristian Marangi2023-01-231-0/+3
| | | | | | | | | In converting the iwinfo header to enum-define pattern the IWINFO_AUTH define conversion was wrongly dropped. Readd the missing define to fix iwinfo always reporting None as encryption. Fixes: 7e3d7ded29d7 ("iwinfo: reorganize iwinfo header to enum and defines") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* cli: print the flags on the frequency listAndre Heider2023-01-201-2/+21
| | | | | | | Provide info for each flags applied to the frequency on frequency list dump. Signed-off-by: Andre Heider <a.heider@gmail.com>
* lib: add IWINFO_FREQ_FLAG_NAMESAndre Heider2023-01-202-0/+14
| | | | | | | The same as with the other defines/enums which allow consumers to iterate over all known ones. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: fix some commentsAndre Heider2023-01-201-4/+4
| | | | | | Spelling and indenting fixes. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: prefer non-supplicant-based devicesAndre Heider2023-01-201-4/+12
| | | | | | | | | | | | | If a phy has multiple devices, prefer non-supplicant-based ones as per link_mode, see [0] and [1]. The nl80211 API provides more information than wpa_supplicant/hostapd does, like HT/VHT operation, which are used by e.g. luci's channel analysis. [0] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-class-net [1] https://github.com/openwrt/luci/issues/6167#issuecomment-1364500296 Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: simplify iterating over phy's devicesAndre Heider2023-01-201-12/+9
| | | | | | | 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>
* nl80211: remove redundant check in nl80211_phy2ifname()Andre Heider2023-01-201-16/+13
| | | | | | phyidx is already checked for <0 a few lines above. Signed-off-by: Andre Heider <a.heider@gmail.com>
* cli: print the frequency and band on the scan listAndre Heider2023-01-201-1/+3
| | | | | | Provide band and frequency info on scan list dump. Signed-off-by: Andre Heider <a.heider@gmail.com>
* cli: print the band on the frequency listAndre Heider2023-01-201-1/+13
| | | | | | Provide band info on frequency list dump. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: add "mhz" and "band" to iwinfo_scanlist_entryAndre Heider2023-01-202-3/+24
| | | | | | | | | 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>
* nl80211: add "band" to iwinfo_freqlist_entryAndre Heider2023-01-202-0/+2
| | | | | | | | | 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>
* nl80211: add support for radiation and indoor chan restrictionChristian Marangi2023-01-202-5/+12
| | | | | | Add new 'flags' bits to declare these two channel restrictions. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* iwinfo: reorganize iwinfo header to enum and definesChristian Marangi2023-01-201-73/+162
| | | | | | | | | | | | | | | | | | | 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>
* devices: add USB devices supported by the mt76 driverAndre Heider2023-01-201-0/+40
| | | | | | | | | | | | 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>
* utils: skip comment lines when parsing devices.txtAndre Heider2023-01-201-0/+3
| | | | | | Just a small optimization, skip the line early if it starts with a #. Signed-off-by: Andre Heider <a.heider@gmail.com>
* cli: describe USB devices as suchAndre Heider2023-01-201-0/+4
| | | | | | This makes it clear if the hardware is embedded or usb/pci based. Signed-off-by: Andre Heider <a.heider@gmail.com>
* devices: add MediaTek MT7628 cardAndre Heider2023-01-201-0/+1
| | | | | | | 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>
* devices: add support for declaring compatible matched devicesJo-Philipp Wich2023-01-105-77/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* devices: add Qualcomm Atheros QCN6024/9024/9074 cardsRobert Marko2023-01-061-0/+1
| | | | | | | Add Qualcomm Atheros QCN6024/9024/9074 PCI ID, they all are compatible and use the same ID. Signed-off-by: Robert Marko <robimarko@gmail.com>
* iwinfo: devices: add Qualcomm Atheros IPQ8074 WiSoCRobert Marko2023-01-062-0/+6
| | | | | | | Add detection of the Qualcomm Atheros IPQ8074 WiSoC using the compatible string from device tree. Signed-off-by: Robert Marko <robimarko@gmail.com>
* cli: print current HT modeAndre Heider2022-12-161-2/+17
| | | | | | This was present in the ubus call provided by rpcd, but not the cli. Signed-off-by: Andre Heider <a.heider@gmail.com>
* cli: use IWINFO_HTMODE_COUNTAndre Heider2022-12-161-1/+1
| | | | | | ARRAY_SIZE works too, but just the sake of consistency. Signed-off-by: Andre Heider <a.heider@gmail.com>
* cli: use IWINFO_KMGMT_NAMESAndre Heider2022-12-161-14/+4
| | | | | | There's no need to duplicate the strings or even miss new ones. Signed-off-by: Andre Heider <a.heider@gmail.com>
* cli: use IWINFO_CIPHER_NAMESAndre Heider2022-12-161-32/+4
| | | | | | There's no need to duplicate the strings or even miss new ones. Signed-off-by: Andre Heider <a.heider@gmail.com>
* cli: fix printing the scan channel widthAndre Heider2022-12-161-13/+18
| | | | | | | | 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>
* cli: fix marking the active channelAndre Heider2022-12-161-4/+4
| | | | | | | | | | | | | | 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>
* utils: add iwinfo_band2ghz() and iwinfo_ghz2band() helpersAndre Heider2022-12-162-0/+37
| | | | | | To classify bands, to be used as ubus values. Signed-off-by: Andre Heider <a.heider@gmail.com>
* utils: add helper functions to get names by valuesAndre Heider2022-12-162-0/+41
| | | | | | | | | 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>
* utils: add iwinfo_htmode_is_{ht|vht|he} helpersAndre Heider2022-12-162-0/+45
| | | | | | Small and useful functions which allow to clear up some consumers. Signed-off-by: Andre Heider <a.heider@gmail.com>
* utils: add and use iwinfo_format_hwmodes()Andre Heider2022-12-163-11/+29
| | | | | | | | | | 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>
* lib: add IWINFO_80211_COUNT and IWINFO_80211_NAMESAndre Heider2022-12-162-0/+12
| | | | | | | The same as with the other defines/enums which allow consumers to iterate over all known ones. Signed-off-by: Andre Heider <a.heider@gmail.com>
* lib: add IWINFO_BAND_COUNT and IWINFO_BAND_NAMESAndre Heider2022-12-162-0/+9
| | | | Signed-off-by: Andre Heider <a.heider@gmail.com>
* lib: use common IWINFO_CIPHER_NAMES stringsAndre Heider2022-12-151-2/+2
| | | | | | | | 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>
* lib: add IWINFO_OPMODE_COUNT and use it for IWINFO_OPMODE_NAMESAndre Heider2022-12-152-2/+4
| | | | | | Match the other string arrays, which allows us to consistently loop over them. Signed-off-by: Andre Heider <a.heider@gmail.com>
* lib: constify and fixup the string array definitionsAndre Heider2022-12-152-11/+11
| | | | | | Match their declarations as per the header. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: mark frequencies where HE operation in not allowedAndre Heider2022-12-152-1/+3
| | | | | | | 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>
* nl80211: add support for HE htmodesAndre Heider2022-12-151-7/+26
| | | | | | Query hostapd or wpa_supplicant to determine if 802.11ax is enabled. Signed-off-by: Andre Heider <a.heider@gmail.com>
* nl80211: properly get available bands for the hwmodeAndre Heider2022-12-151-35/+21
| | | | | | | | 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>
* nl80211: update the kernel header nl80211.hAndre Heider2022-12-151-71/+2719
| | | | | | | | | 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>
* nl80211: fix frequency/channel conversion for the 6G bandAndre Heider2022-12-151-9/+41
| | | | | | | | | 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>
* nl80211: don't guess if a name is an ifnameAndre Heider2022-12-151-3/+13
| | | | | | | | | | | | | | | | | | | | | | | 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>
* devices: add usb device MediaTek MT7921AUAndre Heider2022-12-151-0/+4
| | | | | | | | 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>
* nl80211: add ability to describe USB devicesJo-Philipp Wich2022-12-151-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* nl80211: remove ancient wpa_supplicant ctrl socket pathAndre Heider2022-12-151-10/+3
| | | | | | | | | | 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>
* nl80211: fix wpa supplicant ctrl socket permissionsAndre Heider2022-12-151-0/+16
| | | | | | | | | 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>
* fix -Wdangling-else warningsAndre Heider2022-12-152-0/+4
| | | | | | It's less confusing with braces. Signed-off-by: Andre Heider <a.heider@gmail.com>
* fix -Wreturn-type warningAndre Heider2022-12-151-1/+1
| | | | | | | The function doesn't return anything nor does any caller expect anything. Signed-off-by: Andre Heider <a.heider@gmail.com>