From ce33adf4224214ceef873da50725f9b2e9c52dcc Mon Sep 17 00:00:00 2001 From: Thomas Tsou Date: Tue, 16 Nov 2010 15:53:25 -0500 Subject: [PATCH] uhd: exit on device open failure If the device doesn't open, there's no reason to continue. Shut down so the process doesn't linger. Signed-off-by: Thomas Tsou --- public-trunk/Transceiver/USRPping.cpp | 5 ++++- public-trunk/Transceiver/runTransceiver.cpp | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/public-trunk/Transceiver/USRPping.cpp b/public-trunk/Transceiver/USRPping.cpp index 08121d0..101834f 100644 --- a/public-trunk/Transceiver/USRPping.cpp +++ b/public-trunk/Transceiver/USRPping.cpp @@ -42,7 +42,10 @@ int main(int argc, char *argv[]) { if (argc>2) gSetLogFile(argv[2]); Device *usrp = Device::make(400e3); - usrp->open(); + if (!usrp->open()) { + cerr << "Device open failed. Exiting..." << endl; + exit(1); + } TIMESTAMP timestamp; diff --git a/public-trunk/Transceiver/runTransceiver.cpp b/public-trunk/Transceiver/runTransceiver.cpp index 813c5c2..a40e94b 100644 --- a/public-trunk/Transceiver/runTransceiver.cpp +++ b/public-trunk/Transceiver/runTransceiver.cpp @@ -50,7 +50,11 @@ int main(int argc, char *argv[]) { srandom(time(NULL)); Device *usrp = Device::make(400.0e3); - usrp->open(); + if (!usrp->open()) { + cerr << "Device open failed. Exiting..." << endl; + exit(1); + } + RadioInterface* radio = new RadioInterface(usrp,3); Transceiver *trx = new Transceiver(5700,"127.0.0.1",SAMPSPERSYM,GSM::Time(2,0),radio); trx->transmitFIFO(radio->transmitFIFO());