visual studio-wdk8.1+vs2013中使用winusb模版开发usb设备驱动
問題描述
wdk8.1+vs2013中使用winusb模版開發usb設備驅動 新人一只,本身是做硬件的,現在要編寫硬件(USB設備)的驅動,然后想使用winusb進行快速的驅動開發。在使用winusb之前,使用了libusb-win32下的inf工具進行inf文件的生成和安裝,通過bus hound可以看到枚舉,并進行的bulk in/out測試(自帶的send command)。目標pc是64位的win7旗艦版。
現在狀況是vs2013新建了winusb模版工程,其中drivers package中的inf文件,對其修改了VID,PID,然后進行編譯生成。這時候插入usb設備(已經卸載并刪除了libusb生成的驅動),更新驅動程序->選擇本地的驅動文件,指向了工程的生成。但是結果是安裝不成功,提示是在inf中找不到所需的段落,如圖。
inf文件內容如下
; ; ksp_daq_v11_drivers.inf ; ; Installs WinUsb ;[Version] Signature = "$Windows NT$" Class = USBDevice ClassGUID = {88BAE032-5A81-49f0-BC3D-A4FF138216D6} Provider = %ManufacturerName% CatalogFile=ksp_daq_v11_drivers.cat; ========== Manufacturer/Models sections ===========[Manufacturer] %ManufacturerName% = Standard,NT$ARCH$[Standard.NT$ARCH$] %DeviceName% =USB_Install, USBVID_0308&PID_0110; ========== Class definition ===========[ClassInstall32] AddReg = ClassInstall_AddReg[ClassInstall_AddReg] HKR,,,,%ClassName% HKR,,NoInstallClass,,1 HKR,,IconPath,%REG_MULTI_SZ%,"%systemroot%system32setupapi.dll,-20" HKR,,LowerLogoVersion,,5.2; =================== Installation ===================[USB_Install] Include=winusb.inf Needs=WINUSB.NT[USB_Install.Services] Include=winusb.inf AddService=WinUsb,0x00000002,WinUsb_ServiceInstall[WinUsb_ServiceInstall] DisplayName = %WinUsb_SvcDesc% ServiceType = 1 StartType = 3 ErrorControl = 1 ServiceBinary = %12%WinUSB.sys[USB_Install.HW] AddReg=Dev_AddReg[Dev_AddReg] ; By default, USBDevice class uses iProduct descriptor to name the device in ; Device Manager on Windows 8 and higher. ; Uncomment for this device to use %DeviceName% on Windows 8 and higher: ;HKR,,FriendlyName,,%DeviceName% HKR,,DeviceInterfaceGUIDs,0x10000,"{fc47c010-ea60-4bed-9e8f-820bee86e7eb}"[USB_Install.CoInstallers] AddReg=CoInstallers_AddReg CopyFiles=CoInstallers_CopyFiles[CoInstallers_AddReg] HKR,,CoInstallers32,0x00010000,"WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll,WdfCoInstaller"[CoInstallers_CopyFiles] WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll[DestinationDirs] CoInstallers_CopyFiles=11; ================= Source Media Section =====================[SourceDisksNames] 1 = %DiskName%[SourceDisksFiles] WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1; =================== Strings ===================[Strings] ManufacturerName="ksp" ClassName="Universal Serial Bus devices" DiskName="ksp_daq_v11_drivers Installation Disk" WinUsb_SvcDesc="WinUSB Driver" DeviceName="ksp_daq_v11_drivers Device" REG_MULTI_SZ = 0x00010000 解決方案配置如下
我查找了windows的log文件setupact.log(位于C:Windows下)
WdfCoInstaller: [03/15/2016 20:12.05.288] DIF_INSTALLDEVICE: Pre-ProcessingWdfCoInstaller: [03/15/2016 20:12.05.706] error locating section [USB_Install.Wdf] in inf C:WindowsINFoem107.inf - status(E0000101) <no error text>WdfCoInstaller: [03/15/2016 20:12.05.849] DIF_INSTALLDEVICE: Pre-ProcessingWdfCoInstaller: [03/15/2016 20:12.05.937] GetDriverDetailsData: SetupDiGetSelectedDriver: status(E0000203) <no error text>WdfCoInstaller: [03/15/2016 20:12.05.993] DIF_INSTALLDEVICE: No action taken for NULL driver在出現了這個問題之后,我對比了ST-Link v2(ST公司的硬件仿真器)的inf文件(因為stlink貌似也是基于winusb開發的驅動),模版自動生成的inf文件之間的區別在于。模版的inf文件某幾節中少了WinUSBCoInstaller2.dll這個文件,我向模版inf文件中添加了這些部分,但是編譯不通過。報錯信息如下
22.9.1: winusbcoinstaller2.dll in [coinstallers_copyfiles] of ksp_daq_v11_drivers.inf is missing or cannot be decompressed from source media. Please verify all path values specified in SourceDisksNames, SouceDisksFiles, and CopyFiles sections resolve to the actual location of the file, and are expressed in terms relative to the location of the inf.狀況描述如上,求各位給點idea
解決方案
問題已經解決。使用了zadig提供的工具生成了inf文件,再對其修改后,使用wdk的inf2cat工具生成數字目錄。安裝成功。
具體inf內容為:
總結
以上是生活随笔為你收集整理的visual studio-wdk8.1+vs2013中使用winusb模版开发usb设备驱动的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 个人编码规范
- 下一篇: 计算机 映射网络驱动器,映射网络驱动器