aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2012-04-18 22:26:17 +0200
committerClemens Ladisch <clemens@ladisch.de>2012-05-18 14:09:49 +0200
commit75732fc9ba3808da2d0d03be6f2c1230e8b17e3c (patch)
tree09d7f8c42e24b533c94ce8c3b8ea645ef3136584
parent11e118e775e67ecb2069631010390390510ba382 (diff)
downloadlinux-firewire-utils-75732fc9ba3808da2d0d03be6f2c1230e8b17e3c.tar.gz
lsfirewirephy: handle PHY ID masks correctly
-rw-r--r--src/lsfirewirephy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lsfirewirephy.c b/src/lsfirewirephy.c
index ad6e574..34bf02e 100644
--- a/src/lsfirewirephy.c
+++ b/src/lsfirewirephy.c
@@ -332,10 +332,13 @@ static const struct vendor *search_vendor(u24 oui)
static const struct phy *search_phy(const struct vendor *vendor, u24 id)
{
const struct phy *phy;
+ u24 mask;
- for (phy = vendor->phys; phy->name; ++phy)
- if ((phy->id & (phy->mask ?: 0xffffff)) == id)
+ for (phy = vendor->phys; phy->name; ++phy) {
+ mask = phy->mask ?: 0xffffff;
+ if ((phy->id & mask) == (id & mask))
return phy;
+ }
return NULL;
}