首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WinUSB安装

WinUSB安装
EN

Stack Overflow用户
提问于 2012-10-30 16:08:51
回答 1查看 6.2K关注 0票数 3

我想用WinUSB做一点实验。我已经安装了WinDDK,即将为我的驱动程序创建我的第一个INF文件。我遵循MSDN guide来做这件事。该指南包含一个示例INF文件和“将节名中的USB_Install更改为适当的DDInstall值”的说明。

公平地说,唯一的问题是我不知道什么是“合适的DDInstall值”。

我并不是INF文件方面的专家,我只能猜测指南可能希望我更改示例文件中的节名

代码语言:javascript
复制
[USB_Install]
Include = winusb.inf
Needs   = WINUSB.NT

设置为节标题中不同于[USB_Install]的内容。我找到的关于DDInstall的唯一解释是关于如何处理这一部分的一般性解释(Also on MSDN)。

我的问题是,我应该在INF文件中放入什么,而不是[USB_Install]字符串?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-12-17 13:40:59

我曾尝试遵循相同的MSDN指南,但遇到了一些问题。我最终使用了Microchip的WinUSB驱动程序模板。该模板可以在Microchip Application Libraries中找到。

它与MSDN给出的例子有点不同,但它在我的系统上是有效的。它还可以与最新的WDK (8.0版)附带的工具和dll文件一起使用。

虽然这没有解决您的问题,但我认为与MSDN提供的模板相比,它是一个更好的工作模板。

以下是Microchip提供的inf文件:

代码语言:javascript
复制
;This .inf file is a modified version of the example INF provided
;in the Microsoft document:
;"How to Use WinUSB to Communicate with a USB Device"


[Version]
Signature = "$Windows NT$"
Class = CustomUSBDevices
ClassGuid= {a503e2d3-a031-49dc-b684-c99085dbfe92}
Provider = %MFGNAME%
DriverVer=07/20/2012,1.0.0.4
CatalogFile=winusb.cat    ;CAT file needed for a signed driver pacakage
;------------------------------------------------------------------------------
; ========== Manufacturer/Models sections ===========
;------------------------------------------------------------------------------
[Manufacturer]
%MFGNAME% = MyDevice_WinUSB,NTx86,NTamd64

;------------------------------------------------------------------------------
;  Vendor and Product ID Definitions
;------------------------------------------------------------------------------
; When developing your custom USB device, the VID and PID used in the PC side
; application program and the firmware on the microcontroller must match.
; Modify the below lines to use your VID and PID.  Use the format as shown below.
; Note: One INF file can be used for multiple devices with different VID and PIDs.
; For each supported device, append ",USB\VID_xxxx&PID_yyyy" to the end of the line.
; There is a maximum number of devices that can be supported per line however.
; If you append a large number of VID/PIDs to the end of the line, and get a:
; "The data area passed to a system call is too small." error when trying to install
; the INF, try removing some of the VIDs/PIDs.
;------------------------------------------------------------------------------
[MyDevice_WinUSB.NTx86]
%DESCRIPTION% =USB_Install, USB\VID_04d8&PID_0204

[MyDevice_WinUSB.NTamd64]
%DESCRIPTION% =USB_Install, USB\VID_04d8&PID_0204


;=========================================================================================
;ClassInstall32 and ClassInstall_AddReg sections used to make new device manager category.
;=========================================================================================
[ClassInstall32]
AddReg=ClassInstall_AddReg

[ClassInstall_AddReg]
HKR,,,,%DEVICEMANAGERCATEGORY%
HKR,,Icon,,"-20"


; =================== 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.Wdf]
KmdfService=WINUSB, WinUsb_Install

[WinUSB_Install]
KmdfLibraryVersion=1.11

[USB_Install.HW]
AddReg=Dev_AddReg

[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{58D07210-27C1-11DD-BD0B-0800200C9a66}"
;When editing the GUID (the big hex number with dashes inside the squiggly 
;braces), make sure to write the intended PC application to use the same GUID.
;Otherwise the application won't be able to find the USB device properly.

[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

; ================= Source Media Section =====================

[SourceDisksNames]
1 = %DISK_NAME%,,,\i386
2 = %DISK_NAME%,,,\amd64

[SourceDisksFiles.x86]
WinUSBCoInstaller2.dll=1
WdfCoInstaller01011.dll=1

[SourceDisksFiles.amd64]
WinUSBCoInstaller2.dll=2
WdfCoInstaller01011.dll=2

; =================== Strings ===================

[Strings]
MFGNAME="Your Manufacturer Name" ; ManufacturerName
DESCRIPTION="Your USB Device Name" ; DeviceName
WinUSB_SvcDesc="WinUSB Device"
DISK_NAME="WinUSB Device Install Disk" ; DiskName
DEVICEMANAGERCATEGORY="Custom USB Devices" ; ClassName
票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13134934

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档