Skip to content

Impossible to override default pluggable monitor for serial protocol #1563

Closed
@per1234

Description

@per1234

The new pluggable monitor system allows platform authors to specify an arbitrary monitor tool to use for each communication protocol.

For backwards compatibility, when no pluggable monitor is specified, the builtin:serial-monitor tool is used. However, platform authors should be able to use a custom monitor tool for the serial protocol if they want.

🐛 The builtin:serial-monitor pluggable monitor tool is used for ports of the serial protocol even when a board is selected from a platform that a custom monitor tool for the serial protocol.

Steps to reproduce

  1. Open the platform.txt file of one of the installed platforms in a text editor.
  2. Add the following line anywhere in the file:
    pluggable_monitor.pattern.serial=foobar
    
  3. Save the file.
  4. Run an arduino-cli monitor command, specifying a board of the modified platform via the --fqbn flag.
    🐛 The default builtin:serial-monitor tool is used rather that the expected failure of the command due to attempting to run the nonexistent foobar command specified via the pattern.
  5. Define a pattern for a new bazqux monitor protocol by adding the following line anywhere in the platform.txt file:
    pluggable_monitor.pattern.myprotocol=bazqux
    
  6. Save the file.
  7. Run an arduino-cli monitor command, specifying a board of the modified platform via the --fqbn flag and using the --protocol bazqux to specify the newly defined monitor protocol be used.
    🙂 Note that the command fails as expected due to attempting to run the nonexistent foobar command specified via the pattern.

Demonstration

$ arduino-cli version
arduino-cli alpha Version: nightly-20211114 Commit: bf4a784 Date: 2021-11-14T01:27:21Z

$ echo "pluggable_monitor.pattern.serial=foobar" >> ~/.arduino15/packages/arduino/hardware/avr/1.8.3/platform.txt
$ arduino-cli monitor --port /dev/ttyACM0 --fqbn arduino:avr:leonardo --protocol serial
Connected to /dev/ttyACM0! Press CTRL-C to exit.
Hello world from the Arduino Leonardo's serial port!
^C

$ echo "pluggable_monitor.pattern.myprotocol=bazqux" >> ~/.arduino15/packages/arduino/hardware/avr/1.8.3/platform.txt
$ arduino-cli monitor --port /dev/ttyACM0 --fqbn arduino:avr:leonardo --protocol myprotocol
Error getting port settings details: Port monitor error: exec: "bazqux": executable file not found in $PATH

Environment

  • OS: Ubuntu 20.04.3
  • Arduino CLI: nightly-20211114 Commit: bf4a784 Date: 2021-11-14T01:27:21Z

Additional information

The same problem occurs when using the pluggable_monitor.required.PROTOCOL=VENDOR_ID:MONITOR_NAME to specify a monitor tool dependency as defined in the platform's package index. I chose to use pluggable_monitor.pattern.PROTOCOL=MONITOR_RECIPE for the demonstration due to it being more simple to set up (especially since the package index system for installing those tools is currently broken as well).

Metadata

Metadata

Labels

criticality: mediumOf moderate impacttopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions