I have designed an embedded system using PIC18F67J94 and have used a random VID and PID. Then I used Zadig to generate a USB CDC driver for the hardware. It uses mdmcpq.inf and usbser.sys. The following is the .inf file made by Zadig with a few modifications in vendor name
[Strings]
SNMPMOD = "SNMP-Modbus Converter"
VendorName = "ABCD"
SourceName = "ABCD Install Disk"
SNMPMODID = "VID_8474&PID_0005"
DeviceGUID = "{6097438F-67AB-4C8C-A8C5-AF92EE79D3DF}"
Service = "USB COM Port"
[Version]
Signature = "$Windows NT$"
Provider = "ABCD"
Class = Ports
ClassGuid = {4D36E978-E325-11CE-BFC1-08002BE10318}
CatalogFile = ABCD.cat
DriverVer = 04/11/2018, 1.0.0.6
[ControlFlags]
ExcludeFromSelect=*
[Manufacturer]
%VendorName% = DeviceList,NTx86,NTamd64
[DeviceList.NTx86]
%SNMPMOD% = UsbSer_Install, USB\%SNMPMODID%
[DeviceList.NTamd64]
%SNMPMOD% = UsbSer_Install, USB\%SNMPMODID%
[UsbSer_Install]
include = mdmcpq.inf
CopyFiles = FakeModemCopyFileSection
AddReg = UsbSer_Install.AddReg
AddProperty = UsbSer_AddProperty
[UsbSer_Install.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[UsbSer_Install.Services]
AddService = usbser,0x00000002,UsbSer_Service
[UsbSer_Service]
DisplayName = %Service%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\usbser.sys
LoadOrderGroup = Base
[UsbSer_AddProperty]
GenericDriverInstalled,,,,1
[DestinationDirs]
DefaultDestDir = 12
[SourceDisksNames]
1 = %SourceName%
It makes a COM port and works fine, but if I remove the device without closing the COM Port and then reconnect the device, the device manager shows the device to be connected and the com port number along with it but that com port is no more accessible using a terminal software.
I then have to remove the device again and then reconnect the device after which it creates a valid com port.
I also have used FTDI devices, and also Prolific Technology device, they both dont have these issues.
Prolific uses ser2pl.sys where as FTDI has its own .sys files.
I want to know if it is possible to make the windows somehow close the COM port when the device is disconnected.