1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-11-27 18:43:15 -05:00

Merge pull request #2567 from srcejon/fix_2552

USRP: Call setBuddySharedPtr even if open fails.
This commit is contained in:
Edouard Griffiths 2025-11-27 08:17:10 +01:00 committed by GitHub
commit b80ef49adb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -100,6 +100,8 @@ void USRPOutput::destroy()
bool USRPOutput::openDevice() bool USRPOutput::openDevice()
{ {
bool ret = true;
int requestedChannel = m_deviceAPI->getDeviceItemIndex(); int requestedChannel = m_deviceAPI->getDeviceItemIndex();
// look for Tx buddies and get reference to common parameters // look for Tx buddies and get reference to common parameters
@ -198,14 +200,15 @@ bool USRPOutput::openDevice()
if (!m_deviceShared.m_deviceParams->open(deviceStr, false)) if (!m_deviceShared.m_deviceParams->open(deviceStr, false))
{ {
qCritical("USRPOutput::openDevice: failed to open device"); qCritical("USRPOutput::openDevice: failed to open device");
return false; // We need to set setBuddySharedPtr below even if open fails
ret = false;
} }
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
} }
m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API
return true; return ret;
} }
void USRPOutput::suspendRxBuddies() void USRPOutput::suspendRxBuddies()

View File

@ -104,6 +104,8 @@ void USRPInput::destroy()
bool USRPInput::openDevice() bool USRPInput::openDevice()
{ {
bool ret = true;
// B210 supports up to 50MSa/s, so a fairly large FIFO is probably a good idea // B210 supports up to 50MSa/s, so a fairly large FIFO is probably a good idea
// Should it be bigger still? // Should it be bigger still?
if (!m_sampleFifo.setSize(2000000)) if (!m_sampleFifo.setSize(2000000))
@ -228,14 +230,15 @@ bool USRPInput::openDevice()
if (!m_deviceShared.m_deviceParams->open(deviceStr, false)) if (!m_deviceShared.m_deviceParams->open(deviceStr, false))
{ {
qCritical("USRPInput::openDevice: failed to open device"); qCritical("USRPInput::openDevice: failed to open device");
return false; // We need to set setBuddySharedPtr below even if open fails
ret = false;
} }
m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel m_deviceShared.m_channel = requestedChannel; // acknowledge the requested channel
} }
m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API m_deviceAPI->setBuddySharedPtr(&m_deviceShared); // propagate common parameters to API
return true; return ret;
} }
void USRPInput::suspendRxBuddies() void USRPInput::suspendRxBuddies()