Skip to content

Commit

Permalink
ContextBuilder: Validate if the context has the 'usb,libusb' attribute.
Browse files Browse the repository at this point in the history
Signed-off-by: Teo Perisanu <[email protected]>
  • Loading branch information
Teo Perisanu authored and AlexandraTrifan committed Oct 29, 2020
1 parent 1c16aa0 commit 376168e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/contextbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ Context* ContextBuilder::contextOpen(struct iio_context* ctx, const char* uri)
LIBM2K_LOG(INFO, "libiio version: " + to_string(ctx_major) + "." +
to_string(ctx_minor));

std::string libusb_version = iio_context_get_attr_value(ctx, "usb,libusb");
if (!libusb_version.empty()) {
LIBM2K_LOG(INFO, "libusb version: " + libusb_version);
const char *libusb_version = iio_context_get_attr_value(ctx, "usb,libusb");
if (libusb_version != nullptr) {
LIBM2K_LOG(INFO, "libusb version: " + std::string(libusb_version));
}

std::string hw_fw_version = iio_context_get_attr_value(ctx, "fw_version");
if (!hw_fw_version.empty()) {
LIBM2K_LOG(INFO, "Firmware version: " + hw_fw_version);
const char *hw_fw_version = iio_context_get_attr_value(ctx, "fw_version");
if (hw_fw_version != nullptr) {
LIBM2K_LOG(INFO, "Firmware version: " + std::string(hw_fw_version));
}

for (Context* dev : s_connectedDevices) {
Expand Down

0 comments on commit 376168e

Please sign in to comment.