[iwinfo PATCH] devices: add support for declaring compatible matched devices

Andre Heider a.heider at gmail.com
Mon Jan 9 11:14:36 PST 2023


On 09/01/2023 19:58, Christian Marangi wrote:
> On Mon, Jan 09, 2023 at 07:53:02PM +0100, Andre Heider wrote:
>> On 09/01/2023 19:46, Christian Marangi wrote:
>>> On Mon, Jan 09, 2023 at 07:44:34PM +0100, Andre Heider wrote:
>>>> On 09/01/2023 18:28, Christian Marangi wrote:
>>>>> From: Jo-Philipp Wich <jo at mein.io>
>>>>>
>>>>> 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.
>>>>
>>>> Nice cleanup! But those fake entries in devices.txt can then be removed,
>>>> right? (Assuming all of those _are_ fake and not mapped to actual pci ids)
>>>>
>>>
>>> But they are dropped. Am I missing something? Everything with compatible
>>> doesn't have the id declared and internally they are all set to 0.
>>
>> The code that maps them to ids is dropped, the id entries mapping those to
>> the result values are not (which is why this is so ugly ;)
>>
>> For the first if() that's:
>>
>> diff --git a/devices.txt b/devices.txt
>> index e0663b8..040766c 100644
>> --- a/devices.txt
>> +++ b/devices.txt
>> @@ -141,7 +141,6 @@
>>   0x168c 0x002a 0x0777 0xe202   12      0  "Ubiquiti" "Bullet M2"
>>   0x168c 0x002a 0x0777 0xe805    5      0  "Ubiquiti" "Bullet M5"
>>   0x168c 0x002a 0x0777 0xe345    0      0  "Ubiquiti" "WispStation M5" /*
>> ToDo: confirm offset - Wrong! */
>> -0x168c 0x0029 0x168c 0x9130    0      0  "Atheros"  "AR9130"
>>   0x168c 0x0029 0x168c 0xa094    0      0  "Atheros"  "AR9220"
>>   0x168c 0x0029 0x168c 0xa095    0      0  "Atheros"  "AR9223"
>>   0x168c 0x002a 0x168c 0xa093    0      0  "Atheros"  "AR9280"
> 
> Still I'm not following... the only place we did compatible matching was
> in nl80211_hardware_id_from_fdt. Stuff that was present in devices.txt
> is all matched from pci id. Unless they are faked by some driver iwinfo
> in theory is using provided pci id to do the match.
> 
> If that is not the case then I have no idea how iwinfo is taking the id if
> the connected pci card is not providing them.
> 
> Happy to fix if you can give me better example but I wasn't aware we had
> pci device with fake id. Am I missing a patch on a different place?

Drivers are not faking anything, iwinfo is.

Once upon a time it only supported pci based cards, using the four id 
values. Later support for non-pci dt-compatible was hacked in. For that, 
it maps those compatible strings to made up pci ids in code, and at the 
same time added those fake ids to devices.txt.

Like the recent commit here:
https://git.openwrt.org/?p=project/iwinfo.git;a=commitdiff;h=5914d7113ecf77de63eb21fc233684d1a1a52ca5

This patch cleans that up, but it left out the device entries, which are 
dead now.

Hope that clears it up?



More information about the openwrt-devel mailing list