Hi @bask185. If the ports produced by these boards each have unique USB VID/PID pairs or serial numbers then you could create a custom boards platform that associates a board definition with those properties. The board name would then be shown under the "Board Name" column of the arduino-cli board list output.
The port identification properties system is documented here:
The idea of creating your own boards platform might seem quite daunting (and indeed is in the case where you are creating support for a new microcontroller from scratch), but in this case where there an existing platform already provides support for your boards, it is only a matter of adding a single text file containing a dozen lines of configuration to the right subfolder under your sketchbook. You can reference all the resources from the existing platform using the system documented here:
You can see an example of the system in use to associate the "Arduino Uno" board definition with the unique VID/PID pairs of the ports produced by official and faithful clone Arduino Uno boards here in the "Arduino AVR Boards" platform's boards.txt configuration file:
The reason why there are four sets of VID/PID pairs in that code is because the Arduino Uno board has been manufactured with various VID/PID pairs over time and so associations must be set up for all of them. In your case you would only need to define a single set of identification properties.
Boards carrying ch340s should be named: Chinese knockoff
But for real. I was looking at.. well see screenshots. And I realized I could also JSON parse the VID and PID values and at the very least determen that the found COM port object is a CH340. However reading a few pages and add a dozen lines to a text file shouldn't be that hard.
So I am giving it a try. In this path C:\Program Files (x86)\Arduino\hardware\arduino\avr
I found a boards.txt. And I copied the one of an UNO for testing and replace it's content. I changed name and PID/VID values.
But so far no luck. My output does not change. I'll go dig a little further. Not so long ago I was toying around with the location of settings. For all I know I am editting the wrong boards.txt. The result is consistent in both IDE and CLI.
I'm glad you decided to dig in further. I think this stuff is pretty interesting.
There are two different systems for identifying ports:
the legacy system
the "pluggable discovery" system
The syntax you used here is the legacy system:
The legacy syntax is still supported even by the modern versions of the Arduino development tools like Arduino CLI in order to provide backwards compatibility for all the boards platforms that were created before the pluggable discovery system was introduced. However, if a platform has already been migrated to the pluggable discovery system then the legacy syntax is no longer recognized. This is the reason why the board was not identified as "CH340" in the arduino-cli board list output.
The "Arduino AVR Boards" platform has been migrated to the pluggable discovery system so you must use the new syntax when working in that platform. The new syntax looks like this:
If you replace the old syntax in your boards.txt file with those lines you will find that the arduino-cli board list output is as you expected.
You might notice that the "Arduino AVR Boards" platform still has the old syntax in addition to the new syntax:
Although these lines are ignored by the modern versions of Arduino CLI and Arduino IDE, they are necessary to provide compatibility with older versions of the Arduino development tools from before the implementation of the new pluggable discovery system.
I seem to have succes. I had problems at first.. it did not work but that was because I editted the wrong boards.txt. There was one in the program files directory buttt...
This little succes over here
Told me it was the one in the appdata folder.
Clever learning monkey that I am I used arduino-cli.exe config dump to find it.
I do want to change a few things like to use the nano bootloader. I usually use SMD atmega chips with the A6 and A7 pins.