diff options
author | Martin Braun <martin.braun@ettus.com> | 2017-11-10 17:01:24 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-12-22 15:05:05 -0800 |
commit | db73d59969185bc3c261b39e3a6e9e2462b14a3a (patch) | |
tree | 718657002f27e4d13d173941dc91d3ed7618f8ee | |
parent | 34dbd5e60090cf9138ff51988c4460df1888fb2c (diff) | |
download | uhd-db73d59969185bc3c261b39e3a6e9e2462b14a3a.tar.gz uhd-db73d59969185bc3c261b39e3a6e9e2462b14a3a.tar.bz2 uhd-db73d59969185bc3c261b39e3a6e9e2462b14a3a.zip |
uhd: Remove keys from device hashing
-rw-r--r-- | host/lib/device.cpp | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/host/lib/device.cpp b/host/lib/device.cpp index ca76781da..d0aa0f200 100644 --- a/host/lib/device.cpp +++ b/host/lib/device.cpp @@ -36,14 +36,27 @@ static size_t hash_device_addr( //combine the hashes of sorted keys/value pairs size_t hash = 0; + // The device addr can contain all sorts of stuff, which sometimes gets in + // the way of hashing reliably. TODO: Make this a whitelist + const std::vector<std::string> hash_key_blacklist = { + "claimed", + "skip_dram", + "skip_ddc", + "skip_duc" + }; + if(dev_addr.has_key("resource")) { boost::hash_combine(hash, "resource"); boost::hash_combine(hash, dev_addr["resource"]); } else { - for(const std::string &key: uhd::sorted(dev_addr.keys())){ - boost::hash_combine(hash, key); - boost::hash_combine(hash, dev_addr[key]); + for (const std::string &key: uhd::sorted(dev_addr.keys())) { + if (std::find(hash_key_blacklist.begin(), + hash_key_blacklist.end(), + key) == hash_key_blacklist.end()) { + boost::hash_combine(hash, key); + boost::hash_combine(hash, dev_addr[key]); + } } } return hash; |