XP,WIN7或VISTA下INF文件有什么区别吗?
14 个解决方案
#1
当然有区别,而且三言两语说不清,主要是一些与Win7相关的代码段。建议搜一下STM32 CDC驱动使用的旧版与新版inf文件,做个比较。
#2
不只这个,很多烧写器仿真器的win7都不支持
#3
Alex_rcpilot,你好,
你说WIN7的相关代码段,能否具体说一下呢?
按你说的搜索了STM32的相关INF,你说的旧版和新版是指什么?
XP与WIN7下不一样的具体是哪里不一样?
你说WIN7的相关代码段,能否具体说一下呢?
按你说的搜索了STM32的相关INF,你说的旧版和新版是指什么?
XP与WIN7下不一样的具体是哪里不一样?
#4
STM32 CDC范例最高支持到Win7 x64的INF文件内容如下,我也是在网上搜到的。我的系统就是Win7 x64,现在用着没问题。
旧版的INF文件我好像删掉了,目录下没留。以前刚下到新版(就现在这版)文件的时候用Ultra Compare比较过,找到一大堆不一样的地方,大半个文件都不一样。不过最明显的差别是那个对Vista支持的段落。
;------------------------------------------------------------------------------
; STMicroelectronics Comunication Device Class driver (CDC) INF FILE
; (C)2009 Copyright STMicroelectronics
;------------------------------------------------------------------------------
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="STMicroelectronics"
INSTDISK="CDC_DISK"
DESCRIPTION="STM Virtual COM Port"
SERVICE="Virtual Com Driver"
由于仅仅用来将系统自带的usbser.sys指定给USB设备,设备本身都是用标准CDC类请求,因此可以作为其它CDC类设备驱动的模板。修改其中的VID/PID和MANUFACTURER等字段即可将产品信息改成你自己的产品。
旧版的INF文件我好像删掉了,目录下没留。以前刚下到新版(就现在这版)文件的时候用Ultra Compare比较过,找到一大堆不一样的地方,大半个文件都不一样。不过最明显的差别是那个对Vista支持的段落。
;------------------------------------------------------------------------------
; STMicroelectronics Comunication Device Class driver (CDC) INF FILE
; (C)2009 Copyright STMicroelectronics
;------------------------------------------------------------------------------
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="STMicroelectronics"
INSTDISK="CDC_DISK"
DESCRIPTION="STM Virtual COM Port"
SERVICE="Virtual Com Driver"
由于仅仅用来将系统自带的usbser.sys指定给USB设备,设备本身都是用标准CDC类请求,因此可以作为其它CDC类设备驱动的模板。修改其中的VID/PID和MANUFACTURER等字段即可将产品信息改成你自己的产品。
#5
Alex_rcpilot,非常感谢你的回答,
我用了你贴出来的驱动,只修改VID,PID,Manufacture后,
还是提示驱动装不成功
请问,你的是WIN764的吗,是和WIN7版本有关系?
我用了你贴出来的驱动,只修改VID,PID,Manufacture后,
还是提示驱动装不成功
请问,你的是WIN764的吗,是和WIN7版本有关系?
#6
我的是x64,请问你的硬件是什么平台?
#7
另外描述符方便发一下不?
#8
这样吧,我把STM32的描述符发出来你看看能不能用你的硬件来模拟它,需要改的地方应该不多。如果还是不行的话,看看是不是你的固件有不兼容的地方。不知道目前为止提示的都是什么错误。
/* USB Standard Device Descriptor */
const u8 Virtual_Com_Port_DeviceDescriptor[] =
{
0x12, /* bLength */
USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00,
0x02, /* bcdUSB = 2.00 */
0x02, /* bDeviceClass: CDC */
0x00, /* bDeviceSubClass */
0x00, /* bDeviceProtocol */
0x40, /* bMaxPacketSize0 */
0x83,
0x04, /* idVendor = 0x0483 */
0x40,
0x57, /* idProduct = 0x5740 */
0x00,
0x02, /* bcdDevice = 2.00 */
1, /* Index of string descriptor describing manufacturer */
2, /* Index of string descriptor describing product */
3, /* Index of string descriptor describing the device's serial number */
0x01 /* bNumConfigurations */
};
const u8 Virtual_Com_Port_ConfigDescriptor[] =
{
/*Configuation Descriptor*/
0x09, /* bLength: Configuation Descriptor size */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
VIRTUAL_COM_PORT_SIZ_CONFIG_DESC, /* wTotalLength:no of returned bytes */
0x00,
0x02, /* bNumInterfaces: 2 interface */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor describing the configuration */
0xC0, /* bmAttributes: self powered */
0x32, /* MaxPower 0 mA */
/*Interface Descriptor*/
0x09, /* bLength: Interface Descriptor size */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface */
/* Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x01, /* bNumEndpoints: One endpoints used */
0x02, /* bInterfaceClass: Communication Interface Class */
0x02, /* bInterfaceSubClass: Abstract Control Model */
0x01, /* bInterfaceProtocol: Common AT commands */
0x00, /* iInterface: */
/*Header Functional Descriptor*/
0x05, /* bLength: Header Functional Descriptor size */
0x24, /* bDescriptorType: CS_INTERFACE */
0x00, /* bDescriptorSubtype: Header Func Desc */
0x10, /* bcdCDC: spec release number */
0x01,
/*Call Management Functional Descriptor*/
0x05, /* bFunctionLength */
0x24, /* bDescriptorType: CS_INTERFACE */
0x01, /* bDescriptorSubtype: Call Management Func Desc */
0x00, /* bmCapabilities: D0+D1 */
0x01, /* bDataInterface: 1 */
/*ACM Functional Descriptor*/
0x04, /* bFunctionLength */
0x24, /* bDescriptorType: CS_INTERFACE */
0x02, /* bDescriptorSubtype: Abstract Control Management desc */
0x02, /* bmCapabilities */
/*Union Functional Descriptor*/
0x05, /* bFunctionLength */
0x24, /* bDescriptorType: CS_INTERFACE */
0x06, /* bDescriptorSubtype: Union func desc */
0x00, /* bMasterInterface: Communication class interface */
0x01, /* bSlaveInterface0: Data Class Interface */
/*Endpoint 2 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x82, /* bEndpointAddress: (IN2) */
0x03, /* bmAttributes: Interrupt */
VIRTUAL_COM_PORT_INT_SIZE, /* wMaxPacketSize: */
0x00,
0xFF, /* bInterval: */
/*Data class interface descriptor*/
0x09, /* bLength: Endpoint Descriptor size */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: */
0x01, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints: Two endpoints used */
0x0A, /* bInterfaceClass: CDC */
0x00, /* bInterfaceSubClass: */
0x00, /* bInterfaceProtocol: */
0x00, /* iInterface: */
/*Endpoint 3 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x03, /* bEndpointAddress: (OUT3) */
0x02, /* bmAttributes: Bulk */
VIRTUAL_COM_PORT_DATA_SIZE, /* wMaxPacketSize: */
0x00,
0x00, /* bInterval: ignore for Bulk transfer */
/*Endpoint 1 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x81, /* bEndpointAddress: (IN1) */
0x02, /* bmAttributes: Bulk */
VIRTUAL_COM_PORT_DATA_SIZE, /* wMaxPacketSize: */
0x00,
0x00 /* bInterval */
};
/* USB String Descriptors */
const u8 Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] =
{
VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
USB_STRING_DESCRIPTOR_TYPE,
0x09,
0x04 /* LangID = 0x0409: U.S. English */
};
const u8 Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR] =
{
VIRTUAL_COM_PORT_SIZ_STRING_VENDOR, /* Size of Vendor string */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType*/
/* Manufacturer: "STMicroelectronics" */
'S', 0, 'T', 0, 'M', 0, 'i', 0, 'c', 0, 'r', 0, 'o', 0, 'e', 0,
'l', 0, 'e', 0, 'c', 0, 't', 0, 'r', 0, 'o', 0, 'n', 0, 'i', 0,
'c', 0, 's', 0
};
const u8 Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT] =
{
VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT, /* bLength */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
/* Product name: "STM32 Virtual COM Port" */
'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, ' ', 0, 'V', 0, 'i', 0,
'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0, 'C', 0, 'O', 0,
'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0, ' ', 0, ' ', 0
};
u8 Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] =
{
VIRTUAL_COM_PORT_SIZ_STRING_SERIAL, /* bLength */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, '1', 0, '0', 0
}
;/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
#9
谢谢Alex_rcpilot,
你说的硬件平台是指USB吗,我只是枚举成虚拟串口CDC设备,然后在XP下安装非常正常,
但在WIN7下每次装的时候都是提示,设备搜索不到驱动,之后就出现黄色感叹号.
我不知道WIN7下是否还有分什么版本没有?X64,X32,什么的。
另外,描述符与驱动相关的就应该只有VID,PID号了。
我是用您之前的那个版本直接修改VID,PID和Manufacture。
修改的inf如下,你可以帮我看看不. 红色字体是修改部分
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="TEST"
INSTDISK="CDC_DISK"
DESCRIPTION="USB2UART"SERVICE="USB2UART Driver"
你说的硬件平台是指USB吗,我只是枚举成虚拟串口CDC设备,然后在XP下安装非常正常,
但在WIN7下每次装的时候都是提示,设备搜索不到驱动,之后就出现黄色感叹号.
我不知道WIN7下是否还有分什么版本没有?X64,X32,什么的。
另外,描述符与驱动相关的就应该只有VID,PID号了。
我是用您之前的那个版本直接修改VID,PID和Manufacture。
修改的inf如下,你可以帮我看看不. 红色字体是修改部分
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="TEST"
INSTDISK="CDC_DISK"
DESCRIPTION="USB2UART"SERVICE="USB2UART Driver"
#10
首先建议LZ用修改后的文件先在XP下试试能不能装,如果不能就不是系统支持的问题,是别的地方没弄好。如果XP下可以,那或许要改INF。
具体怎么改我也没把握,我手头有4本涉及USB驱动的书,合在一起上千页,讲INF的一共也没到5页,都非常笼统。
MSDN上对INF的介绍停留在WIN2000时代。
驱动开发网上有人问过manufacturer域中关键字与版本对应情况,算是一点线索,下面讲。我贴的文件我自己没在Win7 x86(32位平台)上试过,可能并不支持。在文件前半部分找到这个段:
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
下面还有这样的段(称作DDInstall段):
[DriverInstall.nt]
……
[DriverInstall.NTamd64]
从搜索到的信息来看,[Manufacturer]段是否标明支持的操作系统可能影响不大,但DDInstall段必须有相应的关键字,否则不能安装。我贴的文件包含nt和NTamd64这两个关键字。
驱网上那人提问以下几种标示分别对应什么系统,其中就有这两个关键字。
NT
NTX86
NT.5.1
NT.6.0
NTX86.5.1
NTX86.6.0
NTX86.6.1
NTIA64
NTAMd64
NTAMD64.6.0
NTAMD64.6.1
从MS官网上并没有找到nt关键字支持到那个版本OS为止,只是说2003 SP1版以前的所有NT架构系统,以及2003 SP1版本以后的所有NT架构系统中x86的分支。我推断这个“所有”止于Win7,否则它不会加上NT6.0这个东西。
顺便说一下其它平台。NTia64是Itanium 64位平台,搜索Itanium可以发现这是一个专门用于服务器的高端CPU架构——安腾64,普通用户用不上。NTamd64系列的明显是64位,但并非只支持AMD的CPU平台,只是由于64位处理器概念是先由AMD提出的,在这里用AMD64只是个标识,其实普通用户的x64系统都支持。
为了判断.nt支持的系统是否不包含Win7,LZ可以试试.nt.6.0和.ntx86.6.1两个关键字。方法是把
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
往下的整段复制出来,分两次尝试用上面的一个关键字替换.nt,然后贴回去,插入到原先的两个段落之间。比如:
;------------------------------------------------------------------------------
; Windows 7 x86 Support
;------------------------------------------------------------------------------
[DriverInstall.nt.6.0]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt.6.0
AddReg=DriverInstall.nt.6.0.AddReg
[DriverCopyFiles.nt.6.0]
usbser.sys,,,0x20
[DriverInstall.nt.6.0.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.6.0.Services]
AddService=usbser, 0x00000002, DriverService.nt.6.0
[DriverService.nt.6.0]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
附MSDN相关网页:
Creating Windows INF Files
Sample INF Models Sections for One or More Target Operating Systems
INF Version Section
Creating INF Files for Multiple Platforms and Operating Systems
具体怎么改我也没把握,我手头有4本涉及USB驱动的书,合在一起上千页,讲INF的一共也没到5页,都非常笼统。
MSDN上对INF的介绍停留在WIN2000时代。
驱动开发网上有人问过manufacturer域中关键字与版本对应情况,算是一点线索,下面讲。我贴的文件我自己没在Win7 x86(32位平台)上试过,可能并不支持。在文件前半部分找到这个段:
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
下面还有这样的段(称作DDInstall段):
[DriverInstall.nt]
……
[DriverInstall.NTamd64]
从搜索到的信息来看,[Manufacturer]段是否标明支持的操作系统可能影响不大,但DDInstall段必须有相应的关键字,否则不能安装。我贴的文件包含nt和NTamd64这两个关键字。
驱网上那人提问以下几种标示分别对应什么系统,其中就有这两个关键字。
NT
NTX86
NT.5.1
NT.6.0
NTX86.5.1
NTX86.6.0
NTX86.6.1
NTIA64
NTAMd64
NTAMD64.6.0
NTAMD64.6.1
从MS官网上并没有找到nt关键字支持到那个版本OS为止,只是说2003 SP1版以前的所有NT架构系统,以及2003 SP1版本以后的所有NT架构系统中x86的分支。我推断这个“所有”止于Win7,否则它不会加上NT6.0这个东西。
顺便说一下其它平台。NTia64是Itanium 64位平台,搜索Itanium可以发现这是一个专门用于服务器的高端CPU架构——安腾64,普通用户用不上。NTamd64系列的明显是64位,但并非只支持AMD的CPU平台,只是由于64位处理器概念是先由AMD提出的,在这里用AMD64只是个标识,其实普通用户的x64系统都支持。
为了判断.nt支持的系统是否不包含Win7,LZ可以试试.nt.6.0和.ntx86.6.1两个关键字。方法是把
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
往下的整段复制出来,分两次尝试用上面的一个关键字替换.nt,然后贴回去,插入到原先的两个段落之间。比如:
;------------------------------------------------------------------------------
; Windows 7 x86 Support
;------------------------------------------------------------------------------
[DriverInstall.nt.6.0]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt.6.0
AddReg=DriverInstall.nt.6.0.AddReg
[DriverCopyFiles.nt.6.0]
usbser.sys,,,0x20
[DriverInstall.nt.6.0.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.6.0.Services]
AddService=usbser, 0x00000002, DriverService.nt.6.0
[DriverService.nt.6.0]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
附MSDN相关网页:
Creating Windows INF Files
Sample INF Models Sections for One or More Target Operating Systems
INF Version Section
Creating INF Files for Multiple Platforms and Operating Systems
#11
另一个做法就是直接用我最初传给你的文件,不要改VID/PID。上你的USB硬件里把固件里的VID和PID改成我文件里面的样式。
我已经把USB descriptors贴出来了,也可以试试把固件里相应的descriptor修改成一模一样的,这样你的设备就相当于枚举为我手里的设备了。用它配合我贴的INF文件去XP下试一试。如果好使,那么先在XP系统下修改其它参数试试,每次走一小步,不行退回来再想办法。一次把所有东西全改了,出错都不知道怪哪里。
上面一楼忘了说,可以试试同时在这个位置插入一个关键字:
[Manufacturer]
%MANUFACTURER%=DeviceList ,nt.6.0,NTamd64
我已经把USB descriptors贴出来了,也可以试试把固件里相应的descriptor修改成一模一样的,这样你的设备就相当于枚举为我手里的设备了。用它配合我贴的INF文件去XP下试一试。如果好使,那么先在XP系统下修改其它参数试试,每次走一小步,不行退回来再想办法。一次把所有东西全改了,出错都不知道怪哪里。
上面一楼忘了说,可以试试同时在这个位置插入一个关键字:
[Manufacturer]
%MANUFACTURER%=DeviceList ,nt.6.0,NTamd64
#12
Alex_rcpilot,非常感谢你这么详细的解释与分析,
不管有没有解决,还是应该先把分给你了。
WIN7这个驱动真是搞得头大,
我会按你的方法到时依次改一下试试,
如果有结果再回来贴一下,嘿嘿,
谢谢!
不管有没有解决,还是应该先把分给你了。
WIN7这个驱动真是搞得头大,
我会按你的方法到时依次改一下试试,
如果有结果再回来贴一下,嘿嘿,
谢谢!
#13
客气了,主要还是解决问题。
#14
I'm also working on USB CDC device recently. And here is the .inf file I've made based on various sources. I have tested it on both Windows XP (SP3) and Windows 7 Pro. Hope it could help.
;============================================================================
; Inf file for USB/RS232 Device
;============================================================================
[Version]
Signature="$Chicago$"
Class = Ports ;(COM & LPT ports)
ClassGuid = {4d36e978-e325-11ce-bfc1-08002be10318}
Provider=%MFG%
DriverVer=07/11/2011, 1.0.23.0
[Manufacturer]
%MFG%=USB_RS232_DEMO, NTamd64
[USB_RS232_DEMO]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[USB_RS232_DEMO.NTamd64]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[DestinationDirs]
DefaultDestDir=12 ; %SystemRoot%\system32\drivers
[DeviceInstall.NTx86]
CopyFiles=DeviceInstall.NTx86.Copy
AddReg=DeviceInstall.NTx86.AddReg
[DeviceInstall.NTx86.Copy]
usbser.sys
[DeviceInstall.NTx86.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTx86.Services]
AddService = usbser, 0x00000002, ServiceInstall ; Assign the named service as the PnP function driver
[ServiceInstall]
DisplayName = %ServiceDescription%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\usbser.sys
LoadOrderGroup = Base
[Strings]
MFG = "SuperMan"
USB_RS232_DEMO = "USB RS232 Demo"
ServiceDescription = "USB RS232 Driver"
[DeviceInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DeviceCopyFiles.NTamd64
AddReg=DeviceInstall.NTamd64.AddReg
[DeviceCopyFiles.NTamd64]
usbser.sys,,,0x20
[DeviceInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DeviceService.NTamd64
[DeviceService.NTamd64]
DisplayName=%ServiceDescription%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys
;============================================================================
; Inf file for USB/RS232 Device
;============================================================================
[Version]
Signature="$Chicago$"
Class = Ports ;(COM & LPT ports)
ClassGuid = {4d36e978-e325-11ce-bfc1-08002be10318}
Provider=%MFG%
DriverVer=07/11/2011, 1.0.23.0
[Manufacturer]
%MFG%=USB_RS232_DEMO, NTamd64
[USB_RS232_DEMO]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[USB_RS232_DEMO.NTamd64]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[DestinationDirs]
DefaultDestDir=12 ; %SystemRoot%\system32\drivers
[DeviceInstall.NTx86]
CopyFiles=DeviceInstall.NTx86.Copy
AddReg=DeviceInstall.NTx86.AddReg
[DeviceInstall.NTx86.Copy]
usbser.sys
[DeviceInstall.NTx86.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTx86.Services]
AddService = usbser, 0x00000002, ServiceInstall ; Assign the named service as the PnP function driver
[ServiceInstall]
DisplayName = %ServiceDescription%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\usbser.sys
LoadOrderGroup = Base
[Strings]
MFG = "SuperMan"
USB_RS232_DEMO = "USB RS232 Demo"
ServiceDescription = "USB RS232 Driver"
[DeviceInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DeviceCopyFiles.NTamd64
AddReg=DeviceInstall.NTamd64.AddReg
[DeviceCopyFiles.NTamd64]
usbser.sys,,,0x20
[DeviceInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DeviceService.NTamd64
[DeviceService.NTamd64]
DisplayName=%ServiceDescription%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys
#1
当然有区别,而且三言两语说不清,主要是一些与Win7相关的代码段。建议搜一下STM32 CDC驱动使用的旧版与新版inf文件,做个比较。
#2
不只这个,很多烧写器仿真器的win7都不支持
#3
Alex_rcpilot,你好,
你说WIN7的相关代码段,能否具体说一下呢?
按你说的搜索了STM32的相关INF,你说的旧版和新版是指什么?
XP与WIN7下不一样的具体是哪里不一样?
你说WIN7的相关代码段,能否具体说一下呢?
按你说的搜索了STM32的相关INF,你说的旧版和新版是指什么?
XP与WIN7下不一样的具体是哪里不一样?
#4
STM32 CDC范例最高支持到Win7 x64的INF文件内容如下,我也是在网上搜到的。我的系统就是Win7 x64,现在用着没问题。
旧版的INF文件我好像删掉了,目录下没留。以前刚下到新版(就现在这版)文件的时候用Ultra Compare比较过,找到一大堆不一样的地方,大半个文件都不一样。不过最明显的差别是那个对Vista支持的段落。
;------------------------------------------------------------------------------
; STMicroelectronics Comunication Device Class driver (CDC) INF FILE
; (C)2009 Copyright STMicroelectronics
;------------------------------------------------------------------------------
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="STMicroelectronics"
INSTDISK="CDC_DISK"
DESCRIPTION="STM Virtual COM Port"
SERVICE="Virtual Com Driver"
由于仅仅用来将系统自带的usbser.sys指定给USB设备,设备本身都是用标准CDC类请求,因此可以作为其它CDC类设备驱动的模板。修改其中的VID/PID和MANUFACTURER等字段即可将产品信息改成你自己的产品。
旧版的INF文件我好像删掉了,目录下没留。以前刚下到新版(就现在这版)文件的时候用Ultra Compare比较过,找到一大堆不一样的地方,大半个文件都不一样。不过最明显的差别是那个对Vista支持的段落。
;------------------------------------------------------------------------------
; STMicroelectronics Comunication Device Class driver (CDC) INF FILE
; (C)2009 Copyright STMicroelectronics
;------------------------------------------------------------------------------
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_0483&PID_5740
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="STMicroelectronics"
INSTDISK="CDC_DISK"
DESCRIPTION="STM Virtual COM Port"
SERVICE="Virtual Com Driver"
由于仅仅用来将系统自带的usbser.sys指定给USB设备,设备本身都是用标准CDC类请求,因此可以作为其它CDC类设备驱动的模板。修改其中的VID/PID和MANUFACTURER等字段即可将产品信息改成你自己的产品。
#5
Alex_rcpilot,非常感谢你的回答,
我用了你贴出来的驱动,只修改VID,PID,Manufacture后,
还是提示驱动装不成功
请问,你的是WIN764的吗,是和WIN7版本有关系?
我用了你贴出来的驱动,只修改VID,PID,Manufacture后,
还是提示驱动装不成功
请问,你的是WIN764的吗,是和WIN7版本有关系?
#6
我的是x64,请问你的硬件是什么平台?
#7
另外描述符方便发一下不?
#8
这样吧,我把STM32的描述符发出来你看看能不能用你的硬件来模拟它,需要改的地方应该不多。如果还是不行的话,看看是不是你的固件有不兼容的地方。不知道目前为止提示的都是什么错误。
/* USB Standard Device Descriptor */
const u8 Virtual_Com_Port_DeviceDescriptor[] =
{
0x12, /* bLength */
USB_DEVICE_DESCRIPTOR_TYPE, /* bDescriptorType */
0x00,
0x02, /* bcdUSB = 2.00 */
0x02, /* bDeviceClass: CDC */
0x00, /* bDeviceSubClass */
0x00, /* bDeviceProtocol */
0x40, /* bMaxPacketSize0 */
0x83,
0x04, /* idVendor = 0x0483 */
0x40,
0x57, /* idProduct = 0x5740 */
0x00,
0x02, /* bcdDevice = 2.00 */
1, /* Index of string descriptor describing manufacturer */
2, /* Index of string descriptor describing product */
3, /* Index of string descriptor describing the device's serial number */
0x01 /* bNumConfigurations */
};
const u8 Virtual_Com_Port_ConfigDescriptor[] =
{
/*Configuation Descriptor*/
0x09, /* bLength: Configuation Descriptor size */
USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType: Configuration */
VIRTUAL_COM_PORT_SIZ_CONFIG_DESC, /* wTotalLength:no of returned bytes */
0x00,
0x02, /* bNumInterfaces: 2 interface */
0x01, /* bConfigurationValue: Configuration value */
0x00, /* iConfiguration: Index of string descriptor describing the configuration */
0xC0, /* bmAttributes: self powered */
0x32, /* MaxPower 0 mA */
/*Interface Descriptor*/
0x09, /* bLength: Interface Descriptor size */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: Interface */
/* Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x01, /* bNumEndpoints: One endpoints used */
0x02, /* bInterfaceClass: Communication Interface Class */
0x02, /* bInterfaceSubClass: Abstract Control Model */
0x01, /* bInterfaceProtocol: Common AT commands */
0x00, /* iInterface: */
/*Header Functional Descriptor*/
0x05, /* bLength: Header Functional Descriptor size */
0x24, /* bDescriptorType: CS_INTERFACE */
0x00, /* bDescriptorSubtype: Header Func Desc */
0x10, /* bcdCDC: spec release number */
0x01,
/*Call Management Functional Descriptor*/
0x05, /* bFunctionLength */
0x24, /* bDescriptorType: CS_INTERFACE */
0x01, /* bDescriptorSubtype: Call Management Func Desc */
0x00, /* bmCapabilities: D0+D1 */
0x01, /* bDataInterface: 1 */
/*ACM Functional Descriptor*/
0x04, /* bFunctionLength */
0x24, /* bDescriptorType: CS_INTERFACE */
0x02, /* bDescriptorSubtype: Abstract Control Management desc */
0x02, /* bmCapabilities */
/*Union Functional Descriptor*/
0x05, /* bFunctionLength */
0x24, /* bDescriptorType: CS_INTERFACE */
0x06, /* bDescriptorSubtype: Union func desc */
0x00, /* bMasterInterface: Communication class interface */
0x01, /* bSlaveInterface0: Data Class Interface */
/*Endpoint 2 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x82, /* bEndpointAddress: (IN2) */
0x03, /* bmAttributes: Interrupt */
VIRTUAL_COM_PORT_INT_SIZE, /* wMaxPacketSize: */
0x00,
0xFF, /* bInterval: */
/*Data class interface descriptor*/
0x09, /* bLength: Endpoint Descriptor size */
USB_INTERFACE_DESCRIPTOR_TYPE, /* bDescriptorType: */
0x01, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints: Two endpoints used */
0x0A, /* bInterfaceClass: CDC */
0x00, /* bInterfaceSubClass: */
0x00, /* bInterfaceProtocol: */
0x00, /* iInterface: */
/*Endpoint 3 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x03, /* bEndpointAddress: (OUT3) */
0x02, /* bmAttributes: Bulk */
VIRTUAL_COM_PORT_DATA_SIZE, /* wMaxPacketSize: */
0x00,
0x00, /* bInterval: ignore for Bulk transfer */
/*Endpoint 1 Descriptor*/
0x07, /* bLength: Endpoint Descriptor size */
USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: Endpoint */
0x81, /* bEndpointAddress: (IN1) */
0x02, /* bmAttributes: Bulk */
VIRTUAL_COM_PORT_DATA_SIZE, /* wMaxPacketSize: */
0x00,
0x00 /* bInterval */
};
/* USB String Descriptors */
const u8 Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] =
{
VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
USB_STRING_DESCRIPTOR_TYPE,
0x09,
0x04 /* LangID = 0x0409: U.S. English */
};
const u8 Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR] =
{
VIRTUAL_COM_PORT_SIZ_STRING_VENDOR, /* Size of Vendor string */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType*/
/* Manufacturer: "STMicroelectronics" */
'S', 0, 'T', 0, 'M', 0, 'i', 0, 'c', 0, 'r', 0, 'o', 0, 'e', 0,
'l', 0, 'e', 0, 'c', 0, 't', 0, 'r', 0, 'o', 0, 'n', 0, 'i', 0,
'c', 0, 's', 0
};
const u8 Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT] =
{
VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT, /* bLength */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
/* Product name: "STM32 Virtual COM Port" */
'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, ' ', 0, 'V', 0, 'i', 0,
'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0, 'C', 0, 'O', 0,
'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0, ' ', 0, ' ', 0
};
u8 Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] =
{
VIRTUAL_COM_PORT_SIZ_STRING_SERIAL, /* bLength */
USB_STRING_DESCRIPTOR_TYPE, /* bDescriptorType */
'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, '1', 0, '0', 0
}
;/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
#9
谢谢Alex_rcpilot,
你说的硬件平台是指USB吗,我只是枚举成虚拟串口CDC设备,然后在XP下安装非常正常,
但在WIN7下每次装的时候都是提示,设备搜索不到驱动,之后就出现黄色感叹号.
我不知道WIN7下是否还有分什么版本没有?X64,X32,什么的。
另外,描述符与驱动相关的就应该只有VID,PID号了。
我是用您之前的那个版本直接修改VID,PID和Manufacture。
修改的inf如下,你可以帮我看看不. 红色字体是修改部分
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="TEST"
INSTDISK="CDC_DISK"
DESCRIPTION="USB2UART"SERVICE="USB2UART Driver"
你说的硬件平台是指USB吗,我只是枚举成虚拟串口CDC设备,然后在XP下安装非常正常,
但在WIN7下每次装的时候都是提示,设备搜索不到驱动,之后就出现黄色感叹号.
我不知道WIN7下是否还有分什么版本没有?X64,X32,什么的。
另外,描述符与驱动相关的就应该只有VID,PID号了。
我是用您之前的那个版本直接修改VID,PID和Manufacture。
修改的inf如下,你可以帮我看看不. 红色字体是修改部分
[Version]
Signature="$Windows NT$"
Class=Ports
ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}
Provider=%MANUFACTURER%
LayoutFile=layout.inf
;CatalogFile=%FILENAME%.cat
DriverVer= 9/20/2009,1.2.0
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
[DestinationDirs]
DefaultDestDir=12
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
[DriverInstall.nt]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt
AddReg=DriverInstall.nt.AddReg
[DriverCopyFiles.nt]
usbser.sys,,,0x20
[DriverInstall.nt.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.Services]
AddService=usbser, 0x00000002, DriverService.nt
[DriverService.nt]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; Windows Vista x64 / Windows7 x64 Support
;------------------------------------------------------------------------------
[DriverInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.NTamd64
AddReg=DriverInstall.NTamd64.AddReg
[DriverCopyFiles.NTamd64]
%DRIVERFILENAME%.sys,,,0x20
[DriverInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DriverService.NTamd64
[DriverService.NTamd64]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
;------------------------------------------------------------------------------
; VID/PID Settings
;------------------------------------------------------------------------------
[SourceDisksFiles]
[SourceDisksNames]
[DeviceList]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
[DeviceList.NTamd64]
%DESCRIPTION%=DriverInstall,USB\VID_a000&PID_3042
;------------------------------------------------------------------------------
; String Definitions
;------------------------------------------------------------------------------
[Strings]
FILENAME="ST_Virtual"
DRIVERFILENAME ="usbser"
MANUFACTURER="TEST"
INSTDISK="CDC_DISK"
DESCRIPTION="USB2UART"SERVICE="USB2UART Driver"
#10
首先建议LZ用修改后的文件先在XP下试试能不能装,如果不能就不是系统支持的问题,是别的地方没弄好。如果XP下可以,那或许要改INF。
具体怎么改我也没把握,我手头有4本涉及USB驱动的书,合在一起上千页,讲INF的一共也没到5页,都非常笼统。
MSDN上对INF的介绍停留在WIN2000时代。
驱动开发网上有人问过manufacturer域中关键字与版本对应情况,算是一点线索,下面讲。我贴的文件我自己没在Win7 x86(32位平台)上试过,可能并不支持。在文件前半部分找到这个段:
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
下面还有这样的段(称作DDInstall段):
[DriverInstall.nt]
……
[DriverInstall.NTamd64]
从搜索到的信息来看,[Manufacturer]段是否标明支持的操作系统可能影响不大,但DDInstall段必须有相应的关键字,否则不能安装。我贴的文件包含nt和NTamd64这两个关键字。
驱网上那人提问以下几种标示分别对应什么系统,其中就有这两个关键字。
NT
NTX86
NT.5.1
NT.6.0
NTX86.5.1
NTX86.6.0
NTX86.6.1
NTIA64
NTAMd64
NTAMD64.6.0
NTAMD64.6.1
从MS官网上并没有找到nt关键字支持到那个版本OS为止,只是说2003 SP1版以前的所有NT架构系统,以及2003 SP1版本以后的所有NT架构系统中x86的分支。我推断这个“所有”止于Win7,否则它不会加上NT6.0这个东西。
顺便说一下其它平台。NTia64是Itanium 64位平台,搜索Itanium可以发现这是一个专门用于服务器的高端CPU架构——安腾64,普通用户用不上。NTamd64系列的明显是64位,但并非只支持AMD的CPU平台,只是由于64位处理器概念是先由AMD提出的,在这里用AMD64只是个标识,其实普通用户的x64系统都支持。
为了判断.nt支持的系统是否不包含Win7,LZ可以试试.nt.6.0和.ntx86.6.1两个关键字。方法是把
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
往下的整段复制出来,分两次尝试用上面的一个关键字替换.nt,然后贴回去,插入到原先的两个段落之间。比如:
;------------------------------------------------------------------------------
; Windows 7 x86 Support
;------------------------------------------------------------------------------
[DriverInstall.nt.6.0]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt.6.0
AddReg=DriverInstall.nt.6.0.AddReg
[DriverCopyFiles.nt.6.0]
usbser.sys,,,0x20
[DriverInstall.nt.6.0.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.6.0.Services]
AddService=usbser, 0x00000002, DriverService.nt.6.0
[DriverService.nt.6.0]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
附MSDN相关网页:
Creating Windows INF Files
Sample INF Models Sections for One or More Target Operating Systems
INF Version Section
Creating INF Files for Multiple Platforms and Operating Systems
具体怎么改我也没把握,我手头有4本涉及USB驱动的书,合在一起上千页,讲INF的一共也没到5页,都非常笼统。
MSDN上对INF的介绍停留在WIN2000时代。
驱动开发网上有人问过manufacturer域中关键字与版本对应情况,算是一点线索,下面讲。我贴的文件我自己没在Win7 x86(32位平台)上试过,可能并不支持。在文件前半部分找到这个段:
[Manufacturer]
%MANUFACTURER%=DeviceList,NTamd64
下面还有这样的段(称作DDInstall段):
[DriverInstall.nt]
……
[DriverInstall.NTamd64]
从搜索到的信息来看,[Manufacturer]段是否标明支持的操作系统可能影响不大,但DDInstall段必须有相应的关键字,否则不能安装。我贴的文件包含nt和NTamd64这两个关键字。
驱网上那人提问以下几种标示分别对应什么系统,其中就有这两个关键字。
NT
NTX86
NT.5.1
NT.6.0
NTX86.5.1
NTX86.6.0
NTX86.6.1
NTIA64
NTAMd64
NTAMD64.6.0
NTAMD64.6.1
从MS官网上并没有找到nt关键字支持到那个版本OS为止,只是说2003 SP1版以前的所有NT架构系统,以及2003 SP1版本以后的所有NT架构系统中x86的分支。我推断这个“所有”止于Win7,否则它不会加上NT6.0这个东西。
顺便说一下其它平台。NTia64是Itanium 64位平台,搜索Itanium可以发现这是一个专门用于服务器的高端CPU架构——安腾64,普通用户用不上。NTamd64系列的明显是64位,但并非只支持AMD的CPU平台,只是由于64位处理器概念是先由AMD提出的,在这里用AMD64只是个标识,其实普通用户的x64系统都支持。
为了判断.nt支持的系统是否不包含Win7,LZ可以试试.nt.6.0和.ntx86.6.1两个关键字。方法是把
;------------------------------------------------------------------------------
; Windows 2000/XP/Vista32 Support
;------------------------------------------------------------------------------
往下的整段复制出来,分两次尝试用上面的一个关键字替换.nt,然后贴回去,插入到原先的两个段落之间。比如:
;------------------------------------------------------------------------------
; Windows 7 x86 Support
;------------------------------------------------------------------------------
[DriverInstall.nt.6.0]
include=mdmcpq.inf
CopyFiles=DriverCopyFiles.nt.6.0
AddReg=DriverInstall.nt.6.0.AddReg
[DriverCopyFiles.nt.6.0]
usbser.sys,,,0x20
[DriverInstall.nt.6.0.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,%DRIVERFILENAME%.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DriverInstall.nt.6.0.Services]
AddService=usbser, 0x00000002, DriverService.nt.6.0
[DriverService.nt.6.0]
DisplayName=%SERVICE%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\%DRIVERFILENAME%.sys
附MSDN相关网页:
Creating Windows INF Files
Sample INF Models Sections for One or More Target Operating Systems
INF Version Section
Creating INF Files for Multiple Platforms and Operating Systems
#11
另一个做法就是直接用我最初传给你的文件,不要改VID/PID。上你的USB硬件里把固件里的VID和PID改成我文件里面的样式。
我已经把USB descriptors贴出来了,也可以试试把固件里相应的descriptor修改成一模一样的,这样你的设备就相当于枚举为我手里的设备了。用它配合我贴的INF文件去XP下试一试。如果好使,那么先在XP系统下修改其它参数试试,每次走一小步,不行退回来再想办法。一次把所有东西全改了,出错都不知道怪哪里。
上面一楼忘了说,可以试试同时在这个位置插入一个关键字:
[Manufacturer]
%MANUFACTURER%=DeviceList ,nt.6.0,NTamd64
我已经把USB descriptors贴出来了,也可以试试把固件里相应的descriptor修改成一模一样的,这样你的设备就相当于枚举为我手里的设备了。用它配合我贴的INF文件去XP下试一试。如果好使,那么先在XP系统下修改其它参数试试,每次走一小步,不行退回来再想办法。一次把所有东西全改了,出错都不知道怪哪里。
上面一楼忘了说,可以试试同时在这个位置插入一个关键字:
[Manufacturer]
%MANUFACTURER%=DeviceList ,nt.6.0,NTamd64
#12
Alex_rcpilot,非常感谢你这么详细的解释与分析,
不管有没有解决,还是应该先把分给你了。
WIN7这个驱动真是搞得头大,
我会按你的方法到时依次改一下试试,
如果有结果再回来贴一下,嘿嘿,
谢谢!
不管有没有解决,还是应该先把分给你了。
WIN7这个驱动真是搞得头大,
我会按你的方法到时依次改一下试试,
如果有结果再回来贴一下,嘿嘿,
谢谢!
#13
客气了,主要还是解决问题。
#14
I'm also working on USB CDC device recently. And here is the .inf file I've made based on various sources. I have tested it on both Windows XP (SP3) and Windows 7 Pro. Hope it could help.
;============================================================================
; Inf file for USB/RS232 Device
;============================================================================
[Version]
Signature="$Chicago$"
Class = Ports ;(COM & LPT ports)
ClassGuid = {4d36e978-e325-11ce-bfc1-08002be10318}
Provider=%MFG%
DriverVer=07/11/2011, 1.0.23.0
[Manufacturer]
%MFG%=USB_RS232_DEMO, NTamd64
[USB_RS232_DEMO]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[USB_RS232_DEMO.NTamd64]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[DestinationDirs]
DefaultDestDir=12 ; %SystemRoot%\system32\drivers
[DeviceInstall.NTx86]
CopyFiles=DeviceInstall.NTx86.Copy
AddReg=DeviceInstall.NTx86.AddReg
[DeviceInstall.NTx86.Copy]
usbser.sys
[DeviceInstall.NTx86.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTx86.Services]
AddService = usbser, 0x00000002, ServiceInstall ; Assign the named service as the PnP function driver
[ServiceInstall]
DisplayName = %ServiceDescription%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\usbser.sys
LoadOrderGroup = Base
[Strings]
MFG = "SuperMan"
USB_RS232_DEMO = "USB RS232 Demo"
ServiceDescription = "USB RS232 Driver"
[DeviceInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DeviceCopyFiles.NTamd64
AddReg=DeviceInstall.NTamd64.AddReg
[DeviceCopyFiles.NTamd64]
usbser.sys,,,0x20
[DeviceInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DeviceService.NTamd64
[DeviceService.NTamd64]
DisplayName=%ServiceDescription%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys
;============================================================================
; Inf file for USB/RS232 Device
;============================================================================
[Version]
Signature="$Chicago$"
Class = Ports ;(COM & LPT ports)
ClassGuid = {4d36e978-e325-11ce-bfc1-08002be10318}
Provider=%MFG%
DriverVer=07/11/2011, 1.0.23.0
[Manufacturer]
%MFG%=USB_RS232_DEMO, NTamd64
[USB_RS232_DEMO]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[USB_RS232_DEMO.NTamd64]
%USB_RS232_DEMO%=DeviceInstall, USB\VID_04B4&PID_1094
[DestinationDirs]
DefaultDestDir=12 ; %SystemRoot%\system32\drivers
[DeviceInstall.NTx86]
CopyFiles=DeviceInstall.NTx86.Copy
AddReg=DeviceInstall.NTx86.AddReg
[DeviceInstall.NTx86.Copy]
usbser.sys
[DeviceInstall.NTx86.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTx86.Services]
AddService = usbser, 0x00000002, ServiceInstall ; Assign the named service as the PnP function driver
[ServiceInstall]
DisplayName = %ServiceDescription%
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 3 ; SERVICE_DEMAND_START
ErrorControl = 1 ; SERVICE_ERROR_NORMAL
ServiceBinary = %12%\usbser.sys
LoadOrderGroup = Base
[Strings]
MFG = "SuperMan"
USB_RS232_DEMO = "USB RS232 Demo"
ServiceDescription = "USB RS232 Driver"
[DeviceInstall.NTamd64]
include=mdmcpq.inf
CopyFiles=DeviceCopyFiles.NTamd64
AddReg=DeviceInstall.NTamd64.AddReg
[DeviceCopyFiles.NTamd64]
usbser.sys,,,0x20
[DeviceInstall.NTamd64.AddReg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,usbser.sys
HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
[DeviceInstall.NTamd64.Services]
AddService=usbser, 0x00000002, DeviceService.NTamd64
[DeviceService.NTamd64]
DisplayName=%ServiceDescription%
ServiceType=1
StartType=3
ErrorControl=1
ServiceBinary=%12%\usbser.sys