|
有了winusb_bulk的实例,我们怎样修改成UProg的固件呢?
其实这个也不难,主要牵涉到的就是vid、pid,只要修改这两个到我们对应的驱动就可以了
这些信息都在F3xx_USB0_Descriptor.c文件中有描述
// Note: Multi-byte fields are expressed in little-endian (LSB first)
SEGMENT_VARIABLE(DEVICE_DESC, const Device_Descriptor, SEG_CODE) =
{
18, // bLength
0x01, // bDescriptorType
LE_ARRAY(0x0110), // bcdUSB
0x00, // bDeviceClass
0x00, // bDeviceSubClass
0x00, // bDeviceProtocol
EP0_PACKET_SIZE, // bMaxPacketSize0
LE_ARRAY(0x10C4), // idVendor,这部分我们就不变了,毕竟用的他的芯片
LE_ARRAY(0x4EBB), // idProduct,这个我们就改下,方便区别其他的设备
LE_ARRAY(0x0000), // bcdDevice
0x01, // iManufacturer
0x02, // iProduct
0x00, // iSerialNumber
0x01 // bNumConfigurations
};
当然提示的信息也要做相应的修改,不然提示的可是牛头马嘴
// Note: sizeof("") returns an additional +1 for the null-terminator,
// which in this case is used in place of the first two bytes
// in the string descriptor
#define STRING1_LEN sizeof ("YeFeng Electronic Studio") * 2
static SEGMENT_VARIABLE(STRING1_DESC[STRING1_LEN], const U8, SEG_CODE) =
{
STRING1_LEN, 0x03,
'Y', 0,
'e', 0,
'F', 0,
'e', 0,
'n', 0,
'g', 0,
' ', 0,
'E', 0,
'l', 0,
'e', 0,
'c', 0,
't', 0,
'r', 0,
'o', 0,
'n', 0,
'i', 0,
'c', 0,
' ', 0,
'S', 0,
't', 0,
'u', 0,
'd', 0,
'i', 0,
'o', 0
};
// Note: sizeof("") returns an additional +1 for the null-terminator,
// which in this case is used in place of the first two bytes
// in the string descriptor
#define STRING2_LEN sizeof("UUProg") * 2
static SEGMENT_VARIABLE(STRING2_DESC[STRING2_LEN], const U8, SEG_CODE) =
{
STRING2_LEN, 0x03,
'U', 0,
'U', 0,
'P', 0,
'r', 0,
'o', 0,
'g', 0
};
这些都是改好得了,自己找前面的贴下winusb_bulk源代码吧
做完这些还不够,还需要把驱动inf中的相关vid、pid对应起来,不然驱动可不认的
[Version]
Signature = "$Windows NT$"
Class = "USB Universal Programmer" ;我们自定义的类名,方便查找
ClassGuid={46880C11-F934-41CB-A130-B123FFDAC55B}
Provider = %ProviderName%
DriverVer=05/05/2015,1.00.0000 ;驱动的时间改一下,好看点
CatalogFile=UUProg.cat
; ================== Class section ==================
[ClassInstall32]
Addreg=UUProgClassReg
[UUProgClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-1
; ========== Manufacturer/Models sections ===========
[Manufacturer]
%ProviderName% = UUProg_WinUSB,NTx86,NTamd64,NTia64
[UUProg_WinUSB.NTx86]
%USB\MyDevice.DeviceDesc% =USB_Install, USB\VID_10C4&PID_4EBB ;驱动的vid,pid,必须和固件的对应起来
[UUProg_WinUSB.NTamd64]
%USB\MyDevice.DeviceDesc% =USB_Install, USB\VID_10C4&PID_4EBB;驱动的vid,pid,必须和固件的对应起来
[UUProg_WinUSB.NTia64]
%USB\MyDevice.DeviceDesc% =USB_Install, USB\VID_10C4&PID_4EBB;驱动的vid,pid,必须和固件的对应起来
; =================== Installation ===================
;[1]
[USB_Install]
Include=winusb.inf
Needs=WINUSB.NT
;[2]
[USB_Install.Services]
Include=winusb.inf
AddService=WinUSB,0x00000002,WinUSB_ServiceInstall
;[3]
[WinUSB_ServiceInstall]
DisplayName = %WinUSB_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\winusb.sys
;[4]
[USB_Install.Wdf]
KmdfService=WINUSB, WinUsb_Install
[WinUSB_Install]
KmdfLibraryVersion=1.9
;[5]
[USB_Install.HW]
AddReg=Dev_AddReg
[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{7BE00EA9-A77D-4B28-AEDD-89F9AA978EEE}"
;[6]
[USB_Install.CoInstallers]
AddReg=CoInstallers_AddReg
CopyFiles=CoInstallers_CopyFiles
[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01009.dll,WdfCoInstaller","WinUSBCoInstaller2.dll"
[CoInstallers_CopyFiles]
WinUSBCoInstaller2.dll
WdfCoInstaller01009.dll
[DestinationDirs]
CoInstallers_CopyFiles=11
; ================= Source Media Section =====================
;[7]
[SourceDisksNames]
1 = %DISK_NAME%,,,\i386
2 = %DISK_NAME%,,,\amd64
3 = %DISK_NAME%,,,\ia64
[SourceDisksFiles.x86]
WinUSBCoInstaller2.dll=1
WdfCoInstaller01009.dll=1
[SourceDisksFiles.amd64]
WinUSBCoInstaller2.dll=2
WdfCoInstaller01009.dll=2
[SourceDisksFiles.ia64]
WinUSBCoInstaller2.dll=3
WdfCoInstaller01009.dll=3
; =================== Strings ===================
;这些就是驱动那里显示的东东了,就不做说明了,自己看字面意思就懂了,要是你还不懂那你得进补下,我就不操心了
[Strings]
ProviderName="叶峰电子工作室"
USB\MyDevice.DeviceDesc="USB Universal Programmer(UUProg)"
WinUSB_SvcDesc="UUProg WinUSB Driver"
DISK_NAME="UUProg Driver Install Disk"
ClassName="USB Universal Programmer"
|
|