Skip to content

Impossible to override default pluggable monitor for serial protocol #1563

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
per1234 opened this issue Nov 23, 2021 · 0 comments · Fixed by #2153
Closed

Impossible to override default pluggable monitor for serial protocol #1563

per1234 opened this issue Nov 23, 2021 · 0 comments · Fixed by #2153
Assignees
Labels
criticality: medium Of moderate impact topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@per1234
Copy link
Contributor

per1234 commented Nov 23, 2021

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).

@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Nov 23, 2021
@ubidefeo ubidefeo added the criticality: medium Of moderate impact label Jul 25, 2022
@umbynos umbynos added this to the Arduino CLI 1.0 milestone Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
criticality: medium Of moderate impact topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants