summaryrefslogtreecommitdiff
path: root/iwinfo_cli.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2023-01-09 20:49:53 +0100
committerChristian Marangi <ansuelsmth@gmail.com>2023-01-10 00:26:50 +0100
commitfac0787ab007243d7dc51948bd06eceea7299bba (patch)
tree7b4c73010e1cfc1a17f90bcedf8acfabdc1ce04f /iwinfo_cli.c
parentc7b420a2f33c6f1034c3e2191eba0cb0374af7b6 (diff)
downloadiwinfo-fac0787ab007243d7dc51948bd06eceea7299bba.tar.gz
devices: add support for declaring compatible matched devices
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>
Diffstat (limited to 'iwinfo_cli.c')
-rw-r--r--iwinfo_cli.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/iwinfo_cli.c b/iwinfo_cli.c
index d70f7fb..9b3e8e3 100644
--- a/iwinfo_cli.c
+++ b/iwinfo_cli.c
@@ -335,9 +335,12 @@ static char * print_hardware_id(const struct iwinfo_ops *iw, const char *ifname)
if (!iw->hardware_id(ifname, (char *)&ids))
{
- snprintf(buf, sizeof(buf), "%04X:%04X %04X:%04X",
- ids.vendor_id, ids.device_id,
- ids.subsystem_vendor_id, ids.subsystem_device_id);
+ if (strlen(ids.compatible) > 0)
+ snprintf(buf, sizeof(buf), "embedded");
+ else
+ snprintf(buf, sizeof(buf), "%04X:%04X %04X:%04X",
+ ids.vendor_id, ids.device_id,
+ ids.subsystem_vendor_id, ids.subsystem_device_id);
}
else
{