Skip to content

Commit

Permalink
blocks/sinks/uhd: add library and abi version reporting to debug dump
Browse files Browse the repository at this point in the history
  • Loading branch information
vsergeev committed Feb 27, 2020
1 parent 5c6b95a commit 4aeaa33
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion radio/blocks/sinks/uhd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ if not package.loaded['radio.blocks.sources.uhd'] then
} uhd_error;

/* Functions */
uhd_error uhd_get_abi_string(char* abi_string_out, size_t buffer_len);
uhd_error uhd_get_version_string(char* version_out, size_t buffer_len);

uhd_error uhd_usrp_make(uhd_usrp_handle *h, const char *args);
uhd_error uhd_usrp_free(uhd_usrp_handle *h);

Expand Down Expand Up @@ -408,7 +411,22 @@ function UHDSink:initialize_uhd()

-- Dump version info
if debug.enabled then
-- FIXME UHD is missing C API for getting UHD version and ABI string
-- Look up UHD version
local uhd_version = ffi.new("char[512]")
ret = libuhd.uhd_get_version_string(uhd_version, ffi.sizeof(uhd_version))
if ret ~= 0 then
error("uhd_get_version_string(): " .. uhd_code_strerror(ret))
end

-- Look up UHD ABI version
local abi_version = ffi.new("char[512]")
ret = libuhd.uhd_get_abi_string(abi_version, ffi.sizeof(abi_version))
if ret ~= 0 then
error("uhd_get_abi_string(): " .. uhd_code_strerror(ret))
end

debug.printf("[UHDSink] UHD version: %s\n", ffi.string(uhd_version))
debug.printf("[UHDSink] UHD ABI version: %s\n", ffi.string(abi_version))
end

-- Create USRP handle
Expand Down

0 comments on commit 4aeaa33

Please sign in to comment.