forked from sdr/gr-osmosdr
hackrf: support for hackrf_open_by_serial in hackrf source
Signed-off-by: Heikki Hannikainen <hessu@hes.iki.fi>
This commit is contained in:
parent
b3fdf5b83d
commit
9595b044b6
|
@ -102,9 +102,13 @@ hackrf_source_c::hackrf_source_c (const std::string &args)
|
||||||
_bandwidth(0)
|
_bandwidth(0)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
std::string *hackrf_serial = NULL;
|
||||||
|
|
||||||
dict_t dict = params_to_dict(args);
|
dict_t dict = params_to_dict(args);
|
||||||
|
|
||||||
|
if (dict.count("hackrf"))
|
||||||
|
hackrf_serial = &dict["hackrf"];
|
||||||
|
|
||||||
_buf_num = _buf_len = _buf_head = _buf_used = _buf_offset = 0;
|
_buf_num = _buf_len = _buf_head = _buf_used = _buf_offset = 0;
|
||||||
|
|
||||||
if (dict.count("buffers"))
|
if (dict.count("buffers"))
|
||||||
|
@ -142,7 +146,10 @@ hackrf_source_c::hackrf_source_c (const std::string &args)
|
||||||
}
|
}
|
||||||
|
|
||||||
_dev = NULL;
|
_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")
|
HACKRF_THROW_ON_ERROR(ret, "Failed to open HackRF device")
|
||||||
|
|
||||||
uint8_t board_id;
|
uint8_t board_id;
|
||||||
|
|
Loading…
Reference in New Issue