ATtila icon indicating copy to clipboard operation
ATtila copied to clipboard

[BUG] Longer Response time commands do not execute properly

Open wildbiotiger opened this issue 2 years ago • 3 comments

Describe the bug It appears that longer executing commands do not collect all the information from the output, e.g. commands such as AT+CGDCONT? and AT+COPS=?. Most of the time, the parser only catches the echo of the command and not the full response.

To Reproduce

atrunenv = ATRuntimeEnvironment(abort_on_failure=True)
atrunenv.configure_communicator(port_name, baud_rate)
atrunenv.open_serial()

# returns ['AT+CGDCONT?'] or ['AT+CGDCONT?', '', '+CGDCONT: 1,"IPV4V6","","0.0.0.0.0.0.0.0.0.0.0'], not all results
cgdcont_result = self.atrunenv.exec('AT+CGDCONT?')
# fails as it parses only the shortened results
cgdcont_result = self.atrunenv.exec('AT+CGDCONT?;;OK;;;;5')

# sometimes times out, sometimes gets the response if a recent scan - inconsistent
cops_result = self.atrunenv.exec('AT+COPS=?;;OK;;;;900')

Expected behavior CGDCONT should capture all data, there were 3 other PDP contexts displayed normally. COPS should wait for the operator scan to complete and return the data.

Desktop (please complete the following information):

  • OS: Debian 32-bit
  • Architecture ARMHF
  • Python version 3.7
  • ATtila version 1.2.2

Additional context There may be an additional consistency bug. Some of the normal commands failed with no output, but repeating the command succeeds. The CGDCONT always fails however.

wildbiotiger avatar Feb 11 '23 22:02 wildbiotiger

I've struggled with a similar problem and I've solved it by setting ATE0 . The setting ATE1 is nice for debugging but causes the modem to output two "batches" of data.

I've spent a couple of hours digging through the source code of ATtila and it seems it only expects one "batch" of data, so the two batches caused by a long running command is something that breaks important assumptions.

lukipuki avatar Apr 30 '23 22:04 lukipuki

Have you tried setting a longer timeout on the communicator? The default is 10 seconds, but you can make it longer:

atrunenv.configure_communicator(port_name, baud_rate, 180.0)

I wonder if that would help it catch longer running commands.

nabeel-halo avatar Jul 06 '23 21:07 nabeel-halo

This is a great project, thank-you Christian.

I am developing on a Seeed E5 LoRaWAN modem, I see that there are various AT command response formats;

  1. Simple single-line string.
  2. Long single-line strings with comma-separated values
  3. Multiple line strings, (some with comma-separated values)
  4. Multiple line strings with long time delays between receiving them.

To run the Regex over format-3 responses, In atsession.py, use join method to join combine the strings in each line before the re.search

To allow enough time to capture format-4 responses, adjust;

In atcommunbicator.py, Comment out: lines 213 & 214;

if self._device.in_waiting > 0:
               data_still_available = True
           #else:
               #data_still_available = False

Cloolalang avatar May 07 '24 10:05 Cloolalang