I'm very excited to see the 2.0 beta adding support for pluggable discovery. I'm using that feature on a custom board and it works well for showing port options with a custom discovery program. However, my board does not use serial port for programming and I'd like to filter out the serial ports from the select since for me they aren't valid selection. Currently, after I select the right port, if I unplug and replug my device in, it junks to a random serial port as the active port and then uploads fail.
package_index.json file and in my boards file I have
myboard.upload.protocol = notserial
but when I select my board in the 2.0 IDE, it lists both the my-discovery ports, and any serial ports that are connected. Under the hood, it is loading arduino/serial-discovery to find the serial ports. If I select a serial port (or it becomes the default from a disconnect) and I click upload, it complains that upload.tool.serial is not defined. But because I'm not using the serial protocol, I haven't defined a upload.tool.serial but instead upload.tool.notserial.
Is there a way to either have my-discovery replace serial-discovery or filter out its results? Should Arduino expect upload.tool.serial to be defined if I haven't configured the upload.protocol to be serial?
Unless I'm misunderstanding, I can use
myboard.upload_port.something=blah to filter out 'candidates' but that doesn't remove them for the available ports.
I did a quick investigation about this yesterday, but was not able to determine a solution. I think the Arduino CLI developers will be better able to respond.
Actually, that bug report was me, but yeah, I was able to track it down to the arduino-cli behavior and confirm that it is a bug and not a misconfiguration on my part, so I figured a bug report there would be more helpful.
An update here that it seems that intended behavior is not to filter out discoveries based on the active board but to list all port from all discoveries. In that case, there is a bug in the IDE that causes different discoveries to conflict with each other. I've submitted a bug report at discoveries not isolated with different protocols · Issue #711 · arduino/arduino-ide · GitHub