Fix --device -1 option

ssdv
Michal Fratczak 2020-02-05 00:58:20 +01:00
rodzic e94ac08788
commit 31af8bd64e
2 zmienionych plików z 13 dodań i 10 usunięć

Wyświetl plik

@ -75,7 +75,7 @@ public:
// options
struct PARAMS
{
int device_ = -1; // index to SoapySDR::Device::enumerate()
int device_ = 0; // index to SoapySDR::Device::enumerate()
std::string command_host_ = "0.0.0.0";
int command_port_ = 5555;
std::string station_callsign_ = ""; // habitat upload

Wyświetl plik

@ -112,6 +112,18 @@ bool SetupDevice(SoapySDR::Kwargs& o_device)
}
int device_index = GLOBALS::get().par_.device_;
if(device_index < 0)
{
cout<<C_MAGENTA<<"No SDR device specified. Select one by specifying it's"<<C_RED<<" NUMBER"<<C_OFF<<endl;
cout<<C_MAGENTA<<"Available Devices:"<<C_OFF<<endl;
int DEV_NUM = 0;
PrintDevicesList(device_list);
cout<<C_OFF<<endl;
return false;
}
if( device_index >= int(device_list.size()) )
{
cout<<C_RED<<"No device with number "<<device_index<<endl;
@ -122,16 +134,7 @@ bool SetupDevice(SoapySDR::Kwargs& o_device)
{
device_index = 0;
}
else if(device_index < 0)
{
cout<<C_MAGENTA<<"No SDR device specified. Select one by specifying it's"<<C_RED<<" NUMBER"<<C_OFF<<endl;
cout<<C_MAGENTA<<"Available Devices:"<<C_OFF<<endl;
int DEV_NUM = 0;
PrintDevicesList(device_list);
cout<<C_OFF<<endl;
return false;
}
// setup DEVICE
//