日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

visual studio-wdk8.1+vs2013中使用winusb模版开发usb设备驱动

發布時間:2023/12/20 编程问答 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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內容為:

; Ksp_DAQ_v1.1.inf ; Copyright (c) 2010-2016 Pete Batard <pete@akeo.ie> (GNU LGPL) [Strings] DeviceName = "Ksp DAQ v1.1" VendorName = "Ksp" SourceName = "Ksp DAQ v1.1 Install Disk" DeviceID = "VID_0308&PID_0110" DeviceGUID = "{4AAD13DD-7D64-41AD-A015-01D19A4B7D3F}"[Version] Signature = "$Windows NT$" Class = "USBDevice" ClassGuid = {88bae032-5a81-49f0-bc3d-a4ff138216d6} Provider = %VendorName% CatalogFile = Ksp_DAQ_v1.1.cat DriverVer = 03/31/2015, 6.1.7600.16385[ClassInstall32] Addreg = WinUSBDeviceClassReg[WinUSBDeviceClassReg] HKR,,,0,"Universal Serial Bus devices" HKR,,Icon,,-20[Manufacturer] %VendorName% = libusbDevice_WinUSB,NTx86,NTamd64,NTarm[libusbDevice_WinUSB.NTx86] %DeviceName% = USB_Install, USB%DeviceID%[libusbDevice_WinUSB.NTamd64] %DeviceName% = USB_Install, USB%DeviceID%[libusbDevice_WinUSB.NTarm] %DeviceName% = USB_Install, USB%DeviceID%[USB_Install] Include = winusb.inf Needs = WINUSB.NT[USB_Install.Services] Include = winusb.inf AddService = WinUSB,0x00000002,WinUSB_ServiceInstall[WinUSB_ServiceInstall] DisplayName = "WinUSB - Kernel Driver 03/31/2015 6.1.7600.16385" ServiceType = 1 StartType = 3 ErrorControl = 1 ServiceBinary = %12%WinUSB.sys[USB_Install.Wdf] KmdfService = WINUSB, WinUsb_Install[WinUSB_Install] KmdfLibraryVersion = 1.11[USB_Install.HW] AddReg = AddDeviceInterfaceGUID[NoDeviceInterfaceGUID] ; Avoids adding a DeviceInterfaceGUID for generic driver[AddDeviceInterfaceGUID] HKR,,DeviceInterfaceGUIDs,0x10000,%DeviceGUID%[USB_Install.CoInstallers] AddReg = CoInstallers_AddReg CopyFiles = CoInstallers_CopyFiles[CoInstallers_AddReg] HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01011.dll,WdfCoInstaller","WinUSBCoInstaller2.dll"[CoInstallers_CopyFiles] WinUSBCoInstaller2.dll WdfCoInstaller01011.dll[DestinationDirs] CoInstallers_CopyFiles = 11[SourceDisksNames] 1 = %SourceName%[SourceDisksFiles.x86] WinUSBCoInstaller2.dll = 1,x86 WdfCoInstaller01011.dll = 1,x86[SourceDisksFiles.amd64] WinUSBCoInstaller2.dll = 1,amd64 WdfCoInstaller01011.dll = 1,amd64[SourceDisksFiles.arm] WinUSBCoInstaller2.dll = 1,arm WdfCoInstaller01011.dll = 1,arm

總結

以上是生活随笔為你收集整理的visual studio-wdk8.1+vs2013中使用winusb模版开发usb设备驱动的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。