Description
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
- Open the
platform.txt
file of one of the installed platforms in a text editor. - Add the following line anywhere in the file:
pluggable_monitor.pattern.serial=foobar
- Save the file.
- Run an
arduino-cli monitor
command, specifying a board of the modified platform via the--fqbn
flag.
🐛 The defaultbuiltin:serial-monitor
tool is used rather that the expected failure of the command due to attempting to run the nonexistentfoobar
command specified via the pattern. - Define a pattern for a new
bazqux
monitor protocol by adding the following line anywhere in theplatform.txt
file:pluggable_monitor.pattern.myprotocol=bazqux
- Save the file.
- 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 nonexistentfoobar
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).