SetCommState() fails on PC when connected to USB in CDC mode for iMX6

@alex.tx and @Fide I’ve made a big step forward on this topic, and realized I had created the main issue for myself. I remembered about this topic from 5 years ago:
Can we access the virtual COM port using COMx rather than \.\wceusbsh001? - Technical Support - Toradex Community

That was a similar discussion about USB class and subclass settings for the T20. Raja made a modified copy of the driver file for the T20 called serialusbfn.dll which uses USB class 2 and subclass 2. That driver allows the VCOM port on the T20 to be recognized and used Windows 10 & 11 without having to supply a .inf file, it’s plug and play.

What I realized today was that our firmware was still quietly installing this modified driver when it ran on the iMX6. That modified driver is clearly not 100% compatible with the iMX6. When I removed the modified driver and used the one which comes as part of the iMX6 image then the problem with opening the COM port and using SetCommState() goes away.

This is a big improvement, but it doesn’t completely solve the problem. The driver that is distributed with the iMX6 image uses USB class 2 and subclass 0xFF as shown below. Windows 10 & 11 don’t recognize that subclass and it appears in the device manager with an exclamation point until I tell Windows to load my custom and digitally signed .inf file. After that the COM port works very well.

image

Using subclass 0xFF was part of the discussion in that other topic from 5 years ago when Raja made a driver for me which uses subclass 2. The screenshot which @Fide posted earlie in this topic shows that the iMX8 uses subclass 2, which would explain why the COM port works perfectly with the iMX8. Can you make me a customized dll for the iMX6 which uses subclass 2? Making the COM port work in a plug and play way without the need to install a driver is a real benefit for our end users.