当前位置: 首页 > ops >正文

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中找不到所需的段落,如图。
visual studio-wdk8.1+vs2013中使用winusb模版开发usb设备驱动-visual 2013 wdk

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

解决方案配置如下
visual studio-wdk8.1+vs2013中使用winusb模版开发usb设备驱动-visual studio

我查找了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
http://www.xdnf.cn/news/11246.html

相关文章:

  • linux:services服务器配置
  • 23种PHP开发工具PHP IDE集合
  • CURL命令 : GET、POST请求、文件下载等常用命令
  • 我们的生日花
  • 【Linux】Ubuntu12.04的下载与安装
  • appfuse是什么
  • 将字符串切割成数组 componentsSeparatedByString
  • C语言程序设计:学生成绩管理系统(附代码以及编写逻辑)
  • SAP 金税接口介绍
  • 文件快速定位神器(C++小项目实战)
  • 【Maven学习】Nexus OSS私服仓库的安装和配置
  • 从osCommerce到Zen Cart,再到CubeCart
  • java环境变量
  • 区块链的介绍和应用场景以及发展趋势
  • TP-link路由器如何进行端口映射?
  • 程序设计模式
  • jdk 命令大全
  • iText输出中文的三种字体选择方式
  • 常用邮箱的 IMAP/POP3/SMTP 设置
  • 回溯经典-m图着色问题(和地图4色问题的区别)
  • php+html+mysql实现购物商城在线购物系统服装购物系统计算机源码获取php+mysql电子商务系统电商系统php毕业设计课程设计大作业
  • VC皮肤库SkinSharp 1 0 6 6的使用
  • Servlet基础详解)
  • 共享打印机无法打印?常见的12种解决方法【详解】
  • 防不胜防 这些游戏被外挂活生生地毁了
  • YTM32的Flash控制器EFM模块详解
  • Apache启动失败解决办法
  • 中国顶级黑客Top10,混得最好的你猜是谁
  • 十大MySQL开发工具
  • Linux打怪通关攻略(1)Linux用户管理