aboutsummaryrefslogtreecommitdiffstats
path: root/host/lib/types.cpp
diff options
context:
space:
mode:
authorJosh Blum <josh@joshknows.com>2010-11-04 16:43:52 -0700
committerJosh Blum <josh@joshknows.com>2010-11-04 16:43:52 -0700
commit20c9b194aa40e28f08898256039fbbbd7883b2ad (patch)
tree882331bcbcb166f215abb7aceea6ac1166bd1791 /host/lib/types.cpp
parent082f619de40a00880b3b25f29c96d572de131662 (diff)
downloaduhd-20c9b194aa40e28f08898256039fbbbd7883b2ad.tar.gz
uhd-20c9b194aa40e28f08898256039fbbbd7883b2ad.tar.bz2
uhd-20c9b194aa40e28f08898256039fbbbd7883b2ad.zip
usrp: created mboard eeprom map class, implemented for usrp2
Diffstat (limited to 'host/lib/types.cpp')
-rw-r--r--host/lib/types.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/host/lib/types.cpp b/host/lib/types.cpp
index 4188568aa..e5e6a2512 100644
--- a/host/lib/types.cpp
+++ b/host/lib/types.cpp
@@ -250,22 +250,19 @@ mac_addr_t mac_addr_t::from_bytes(const byte_vector_t &bytes){
mac_addr_t mac_addr_t::from_string(const std::string &mac_addr_str){
- byte_vector_t bytes = boost::assign::list_of
- (0x00)(0x50)(0xC2)(0x85)(0x30)(0x00); // Matt's IAB
+ byte_vector_t bytes;
try{
- //only allow patterns of xx:xx or xx:xx:xx:xx:xx:xx
- //the IAB above will fill in for the shorter pattern
- if (mac_addr_str.size() != 5 and mac_addr_str.size() != 17)
- throw std::runtime_error("expected exactly 5 or 17 characters");
+ if (mac_addr_str.size() != 17){
+ throw std::runtime_error("expected exactly 17 characters");
+ }
//split the mac addr hex string at the colons
- size_t i = 0;
BOOST_FOREACH(const std::string &hex_str, std::split_string(mac_addr_str, ":")){
int hex_num;
std::istringstream iss(hex_str);
iss >> std::hex >> hex_num;
- bytes[i++] = boost::uint8_t(hex_num);
+ bytes.push_back(boost::uint8_t(hex_num));
}
}