From fac0787ab007243d7dc51948bd06eceea7299bba Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 9 Jan 2023 20:49:53 +0100 Subject: 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 # ipq4019 Co-developed-by: Christian Marangi Signed-off-by: Jo-Philipp Wich Signed-off-by: Christian Marangi Tested-by: Robert Marko # ipq8074 Reviewed-by: Andre Heider --- iwinfo_cli.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'iwinfo_cli.c') 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 { -- cgit v1.2.1