问题提出:有遇到这样的问题,WIN8操作系统,USB虚拟串口无法驱动。为了WIN8及以后的操作系统可以免驱动,这个USB虚拟串口设计为WINUSB兼容设备。但设备VID,PID还是与老的USB虚拟串口的一样。如果安装了老的USB虚拟串口驱动,但是因为缺少系统文件(usbser.sys,mdmcpq.inf),驱动不正常,却又无法卸载。
解决方法:
1.从正常的WIN8系统拷贝usbser.sys,mdmcpq.inf,安装老的USB虚拟串口驱动,驱动安装成功,问题解决。
2.试过其他机器上可以解决问题的方法:
win7 机器
1.卸载驱动时选中“删除此设备驱动程序文件”,可以卸载驱动。
2.也可以更新驱动程序。
USB设备驱动相关:
1.文件:驱动安装成功后会保存在下列位置:
c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\ .inf, .pnf文件等
c:\windows\system32\drivers .sys文件
C:\Windows\inf oemxx.inf setup.dev.log 记录设备安装信息:
>>> [Device Install (UpdateDriverForPlugAndPlayDevices) - USB\VID_0483&PID_5740&REV_0203]
>>> Section start 2017/05/26 16:55:30.846
cmd: "C:\Program Files (x86)\STMicroelectronics\Software\Virtual comport driver\Win7\dpinst_amd64.exe"
dvi: Set selected driver complete.
dvi: {Build Driver List} 16:55:30.853
dvi: Searching for hardware ID(s):
dvi: usb\vid_0483&pid_5740&rev_0203
dvi: usb\vid_0483&pid_5740
dvi: Searching for compatible ID(s):
dvi: usb\ms_comp_winusb
dvi: usb\class_02&subclass_02&prot_01
dvi: usb\class_02&subclass_02
dvi: usb\class_02
cpy: Policy is set to make all digital signatures equal.
dvi: Processing a single INF: 'c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\stmcdc.inf'
inf: Opened PNF: 'c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\stmcdc.inf' ([strings])
dvi: Created Driver Node:
dvi: HardwareID - USB\VID_0483&PID_5740
dvi: InfName - c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\stmcdc.inf
dvi: DevDesc - STMicroelectronics Virtual COM Port
dvi: DrvDesc - STMicroelectronics Virtual COM Port
dvi: Provider - STMicroelectronics
dvi: Mfg - STMicroelectronics.
dvi: ModelsSec - DeviceList.NTamd64
dvi: InstallSec - DriverInstall
dvi: ActualSec - DriverInstall.NT
dvi: Rank - 0x00ff0001
dvi: Signer - Microsoft Windows Hardware Compatibility Publisher
dvi: Signer Score - WHQL
dvi: DrvDate - 04/25/2010
dvi: Version - 1.3.1.0
dvi: {Build Driver List - exit(0x00000000)} 16:55:30.862
dvi: {DIF_SELECTBESTCOMPATDRV} 16:55:30.862
dvi: Using exported function 'PortsClassInstaller' in module 'C:\Windows\system32\MsPorts.Dll'.
dvi: Class installer == MsPorts.Dll,PortsClassInstaller
dvi: No CoInstallers found
dvi: Class installer: Enter 16:55:30.865
dvi: Class installer: Exit
dvi: Default installer: Enter 16:55:30.865
dvi: {Select Best Driver}
dvi: Selected driver installs from section [DriverInstall] in 'c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\stmcdc.inf'.
dvi: Class GUID of device changed to: {4d36e978-e325-11ce-bfc1-08002be10318}.
dvi: {DIF_DESTROYPRIVATEDATA} 16:55:30.866
dvi: Class installer: Enter 16:55:30.867
dvi: Class installer: Exit
dvi: Default installer: Enter 16:55:30.867
dvi: Default installer: Exit
dvi: {DIF_DESTROYPRIVATEDATA - exit(0xe000020e)} 16:55:30.868
dvi: Set selected driver complete.
dvi: Selected:
dvi: Description - [STMicroelectronics Virtual COM Port]
dvi: InfFile - [c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\stmcdc.inf]
dvi: Section - [DriverInstall]
dvi: Signer - [Microsoft Windows Hardware Compatibility Publisher]
dvi: Rank - [0x00ff0001]
dvi: {Select Best Driver - exit(0x00000000)}
dvi: Default installer: Exit
dvi: {DIF_SELECTBESTCOMPATDRV - exit(0x00000000)} 16:55:30.870
inf: {SetupCopyOEMInf: C:\Windows\INF\oem24.inf} 16:55:30.871
inf: {SetupCopyOEMInf exit (0x00000002)} 16:55:30.871
!!! ndv: Driver Package import failed for new device...installing NULL driver.
!!! ndv: Error 2: The system cannot find the file specified.
dvi: {Plug and Play Service: Device Install for USB\VID_0483&PID_5740\VIRTUAL_COM_PORT__}
ump: Creating Install Process: DrvInst.exe 16:55:30.880
! ndv: Installing NULL driver!
dvi: Set selected driver complete.
dvi: {DIF_ALLOW_INSTALL} 16:55:30.913
dvi: No class installer for 'Virtual COM Port '
dvi: No CoInstallers found
dvi: Default installer: Enter 16:55:30.915
dvi: Default installer: Exit
dvi: {DIF_ALLOW_INSTALL - exit(0xe000020e)} 16:55:30.916
dvi: {DIF_INSTALLDEVICE} 16:55:30.916
dvi: No class installer for 'Virtual COM Port '
dvi: Default installer: Enter 16:55:30.917
! dvi: Installing NULL driver!
dvi: Writing common driver property settings.
dvi: {Restarting Devices} 16:55:30.929
dvi: Restart: USB\VID_0483&PID_5740\VIRTUAL_COM_PORT__
dvi: Restart complete.
dvi: {Restarting Devices exit} 16:55:30.938
dvi: Default installer: Exit
dvi: {DIF_INSTALLDEVICE - exit(0x00000000)} 16:55:30.939
ump: Server install process exited with code 0x00000000 16:55:30.945
ump: {Plug and Play Service: Device Install exit(00000000)}
dvi: {Build Driver List} 16:55:30.946
! dvi: Driver list already built
dvi: {Build Driver List - exit(0x00000000)} 16:55:30.947
dvi: {DIF_SELECTBESTCOMPATDRV} 16:55:30.947
dvi: Using exported function 'PortsClassInstaller' in module 'C:\Windows\system32\MsPorts.Dll'.
dvi: Class installer == MsPorts.Dll,PortsClassInstaller
dvi: No CoInstallers found
dvi: Class installer: Enter 16:55:30.950
dvi: Class installer: Exit
dvi: Default installer: Enter 16:55:30.951
dvi: {Select Best Driver}
dvi: Selected driver installs from section [DriverInstall] in 'c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\stmcdc.inf'.
dvi: Class GUID of device changed to: {4d36e978-e325-11ce-bfc1-08002be10318}.
dvi: {DIF_DESTROYPRIVATEDATA} 16:55:30.952
dvi: Class installer: Enter 16:55:30.953
dvi: Class installer: Exit
dvi: Default installer: Enter 16:55:30.953
dvi: Default installer: Exit
dvi: {DIF_DESTROYPRIVATEDATA - exit(0xe000020e)} 16:55:30.954
dvi: Set selected driver complete.
dvi: Selected:
dvi: Description - [STMicroelectronics Virtual COM Port]
dvi: InfFile - [c:\windows\system32\driverstore\filerepository\stmcdc.inf_amd64_neutral_9422b577b75e16b8\stmcdc.inf]
dvi: Section - [DriverInstall]
dvi: Signer - [Microsoft Windows Hardware Compatibility Publisher]
dvi: Rank - [0x00ff0001]
dvi: {Select Best Driver - exit(0x00000000)}
dvi: Default installer: Exit
dvi: {DIF_SELECTBESTCOMPATDRV - exit(0x00000000)} 16:55:30.957
dvi: {DIF_NEWDEVICEWIZARD_FINISHINSTALL} 16:55:30.958
dvi: Using exported function 'PortsClassInstaller' in module 'C:\Windows\system32\MsPorts.Dll'.
dvi: Class installer == MsPorts.Dll,PortsClassInstaller
dvi: No CoInstallers found
dvi: Class installer: Enter 16:55:30.960
dvi: Class installer: Exit
dvi: Default installer: Enter 16:55:30.961
dvi: Default installer: Exit
dvi: {DIF_NEWDEVICEWIZARD_FINISHINSTALL - exit(0xe000020e)} 16:55:30.962
dvi: {DIF_DESTROYPRIVATEDATA} 16:55:30.962
dvi: Class installer: Enter 16:55:30.963
dvi: Class installer: Exit
dvi: Default installer: Enter 16:55:30.963
dvi: Default installer: Exit
dvi: {DIF_DESTROYPRIVATEDATA - exit(0xe000020e)} 16:55:30.964
<<< Section end 2017/05/26 16:55:30.964
<<< [Exit status: SUCCESS]
2.注册表:
USB设备第一次枚举会在
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\usbflags\
添加例如 048357400203 项:VID+PID+VER
USB设备安装成功会在
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\USB\
添加类似:\VID_0483&PID_5740\Virtual_COM_Port__ 包含驱动的CLASS,CLASSID,OEMXX.INF 等驱动信息。
3.常用命令行工具:
设备控制台 devcon.exe 可以查看安装卸载驱动。可以从网上下载。
例如:devcon remove "USB\VID_0483&PID_5740"
devcon install "Virtual_COM_Port.inf" "USB\VID_0483&PID_5740"
win7之后Windows自带的驱动程序工具pnputil.exe,取代了Windows XP&2003中的DEVCON.EXE
例如:添加驱动:pnputil -a d:\Virtual_COM_Port.inf
删除驱动:pnputil -d oem19.inf