summaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorNicholas Corgan <nick.corgan@ettus.com>2014-02-11 12:25:06 -0800
committerNicholas Corgan <nick.corgan@ettus.com>2014-02-14 15:27:39 -0800
commit55fd590f3eac63f97433b68ae415027c7ff41f71 (patch)
tree6fbbc5e01c68f44d604ff01ab18734af623bbe59 /host
parent7fef199d194c9a63b3312845979fa353f90f4d23 (diff)
downloaduhd-55fd590f3eac63f97433b68ae415027c7ff41f71.tar.gz
uhd-55fd590f3eac63f97433b68ae415027c7ff41f71.tar.bz2
uhd-55fd590f3eac63f97433b68ae415027c7ff41f71.zip
usb: better processing of strings from libusb
* When overwriting a string field with a shorter string, libusb doesn't erase extra characters * Extra processing of this string (already done by load_eeprom) removes extraneous characters
Diffstat (limited to 'host')
-rw-r--r--host/lib/transport/libusb1_base.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp
index 8bd0f4354..23117f128 100644
--- a/host/lib/transport/libusb1_base.cpp
+++ b/host/lib/transport/libusb1_base.cpp
@@ -21,6 +21,7 @@
#include <uhd/utils/log.hpp>
#include <uhd/utils/tasks.hpp>
#include <uhd/types/dict.hpp>
+#include <uhd/types/serial.hpp>
#include <boost/weak_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/foreach.hpp>
@@ -184,7 +185,14 @@ public:
);
if (ret < 0) return ""; //on error, just return empty string
- return std::string((char *)buff, ret);
+ std::string string_descriptor((char *)buff, ret);
+ byte_vector_t string_vec(string_descriptor.begin(), string_descriptor.end());
+ std::string out;
+ BOOST_FOREACH(boost::uint8_t byte, string_vec){
+ if (byte < 32 or byte > 127) return out;
+ out += byte;
+ }
+ return out;
}
private: