<p>Harald Welte <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/10742">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">lms: Return error on device read timeout<br><br>If LImeSDR device is unplugged or its fw crashes during operation,<br>reading from the device will fail and will first receive short reads and<br>finally 0 byte reads. Let's quickly notify these events to upper layers<br>instead of trying to process the buffer and checking timestamps for<br>something we know it's already not useful.<br><br>Related: OS#3340<br>Change-Id: Ib1af8cdd6cdadf581b039882add4049eea45a0f7<br>---<br>M Transceiver52M/device/lms/LMSDevice.cpp<br>1 file changed, 5 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp</span><br><span>index 881cfb7..d8220ea 100644</span><br><span>--- a/Transceiver52M/device/lms/LMSDevice.cpp</span><br><span>+++ b/Transceiver52M/device/lms/LMSDevice.cpp</span><br><span>@@ -511,11 +511,13 @@</span><br><span>      for (i = 0; i<chans; i++) {</span><br><span>               thread_enable_cancel(false);</span><br><span>                 rc = LMS_RecvStream(&m_lms_stream_rx[i], bufs[i], len, &rx_metadata, 100);</span><br><span style="color: hsl(120, 100%, 40%);">+            if (rc != len) {</span><br><span style="color: hsl(120, 100%, 40%);">+                      LOGC(DDEV, ALERT) << "LMS: Device receive timed out (" << rc << " vs exp " << len << ").";</span><br><span style="color: hsl(120, 100%, 40%);">+                        thread_enable_cancel(true);</span><br><span style="color: hsl(120, 100%, 40%);">+                   return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+            }</span><br><span>            if (timestamp != (TIMESTAMP)rx_metadata.timestamp)</span><br><span>                   LOGC(DDEV, ALERT) << "chan "<< i << " recv buffer of len " << rc << " expect " << std::hex << timestamp << " got " << std::hex << (TIMESTAMP)rx_metadata.timestamp << " (" << std::hex << rx_metadata.timestamp <<") diff=" << rx_metadata.timestamp - timestamp;</span><br><span style="color: hsl(0, 100%, 40%);">-         if (rc != len) {</span><br><span style="color: hsl(0, 100%, 40%);">-                        LOGC(DDEV, ALERT) << "LMS: Device receive timed out";</span><br><span style="color: hsl(0, 100%, 40%);">-           }</span><br><span> </span><br><span>                if (LMS_GetStreamStatus(&m_lms_stream_rx[i], &status) == 0) {</span><br><span>                        if (status.underrun > m_last_rx_underruns[i])</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10742">change 10742</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/10742"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-trx </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ib1af8cdd6cdadf581b039882add4049eea45a0f7 </div>
<div style="display:none"> Gerrit-Change-Number: 10742 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Harald Welte <laforge@gnumonks.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>