aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeikki Hannikainen <hessu@hes.iki.fi>2015-02-24 11:37:32 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2015-06-01 22:01:01 +0200
commit69181b0e858c109d1471d4a1c9a2c87f732e8df6 (patch)
tree053e65fbb22cdcd6d8459c75138c93c364dd40bc
parent5dca65674565b6e44bf2e790430d5bb7370f2327 (diff)
hackrf_sink: support hackrf_open_by_serial
Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
-rw-r--r--lib/hackrf/hackrf_sink_c.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/hackrf/hackrf_sink_c.cc b/lib/hackrf/hackrf_sink_c.cc
index 60ef5ce..a052093 100644
--- a/lib/hackrf/hackrf_sink_c.cc
+++ b/lib/hackrf/hackrf_sink_c.cc
@@ -168,9 +168,13 @@ hackrf_sink_c::hackrf_sink_c (const std::string &args)
_bandwidth(0)
{
int ret;
+ std::string *hackrf_serial = NULL;
dict_t dict = params_to_dict(args);
+ if (dict.count("hackrf") && dict["hackrf"].length() > 0)
+ hackrf_serial = &dict["hackrf"];
+
_buf_num = 0;
if (dict.count("buffers"))
@@ -189,7 +193,10 @@ hackrf_sink_c::hackrf_sink_c (const std::string &args)
}
_dev = NULL;
- ret = hackrf_open( &_dev );
+ if ( hackrf_serial )
+ ret = hackrf_open_by_serial( hackrf_serial->c_str(), &_dev );
+ else
+ ret = hackrf_open( &_dev );
HACKRF_THROW_ON_ERROR(ret, "Failed to open HackRF device")
uint8_t board_id;