On Fri, Jun 19, 2009 at 4:06 PM, Xiaofan Chen<xiaof...@gmail.com> wrote:
> On Fri, Jun 19, 2009 at 3:13 PM, David Brownell<davi...@pacbell.net> wrote:
>> On Thursday 18 June 2009, Michael Fischer wrote:
>>> I think we should start to collect the inf files too?
>>
>> In SVN?  I'd think so.
>>
>> Along with installation and upgrade instructions,
>> since that's rarely painless on Windows.
>
> For libusb-win32, it is not too bad. You use the INF wizard to create the
> INF file and then point to the directory with the inf file.
>
> You can even use the undocumented method to install the driver.
> rundll32 libusb0.dll,usb_install_driver_np_rundll your_inf_file.inf
>
> Details:
> http://www.nabble.com/-Libusb-win32-devel--HID-device-problem-td5937112.html
>

For example, this is the INF file generated for J-Link (jlink.inf)

[Version]
Signature = "$Chicago$"
provider  = %manufacturer%
DriverVer = 03/20/2007,0.1.12.1
CatalogFile = jlink.cat
CatalogFile.NT = jlink.cat
CatalogFile.NTAMD64 = jlink_x64.cat

Class = LibUsbDevices
ClassGUID = {EB781AAF-9C70-4523-A5DF-642A87ECA567}

[ClassInstall]
AddReg=libusb_class_install_add_reg

[ClassInstall32]
AddReg=libusb_class_install_add_reg

[libusb_class_install_add_reg]
HKR,,,,"LibUSB-Win32 Devices"
HKR,,Icon,,"-20"

[Manufacturer]
%manufacturer%=Devices,NT,NTAMD64

;--------------------------------------------------------------------------
; Files
;--------------------------------------------------------------------------

[SourceDisksNames]
1 = "Libusb-Win32 Driver Installation Disk",,

[SourceDisksFiles]
libusb0.sys = 1,,
libusb0.dll = 1,,
libusb0_x64.sys = 1,,
libusb0_x64.dll = 1,,

[DestinationDirs]
libusb_files_sys = 10,system32\drivers
libusb_files_sys_x64 = 10,system32\drivers
libusb_files_dll = 10,system32
libusb_files_dll_wow64 = 10,syswow64
libusb_files_dll_x64 = 10,system32

[libusb_files_sys]
libusb0.sys

[libusb_files_sys_x64]
libusb0.sys,libusb0_x64.sys

[libusb_files_dll]
libusb0.dll

[libusb_files_dll_wow64]
libusb0.dll

[libusb_files_dll_x64]
libusb0.dll,libusb0_x64.dll

;--------------------------------------------------------------------------
; Device driver
;--------------------------------------------------------------------------

[LIBUSB_DEV]
CopyFiles = libusb_files_sys, libusb_files_dll
AddReg    = libusb_add_reg

[LIBUSB_DEV.NT]
CopyFiles = libusb_files_sys, libusb_files_dll

[LIBUSB_DEV.NTAMD64]
CopyFiles = libusb_files_sys_x64, libusb_files_dll_wow64, libusb_files_dll_x64

[LIBUSB_DEV.HW]
DelReg = libusb_del_reg_hw
AddReg = libusb_add_reg_hw

[LIBUSB_DEV.NT.HW]
DelReg = libusb_del_reg_hw
AddReg = libusb_add_reg_hw

[LIBUSB_DEV.NTAMD64.HW]
DelReg = libusb_del_reg_hw
AddReg = libusb_add_reg_hw

[LIBUSB_DEV.NT.Services]
AddService = libusb0, 0x00000002, libusb_add_service

[LIBUSB_DEV.NTAMD64.Services]
AddService = libusb0, 0x00000002, libusb_add_service

[libusb_add_reg]
HKR,,DevLoader,,*ntkern
HKR,,NTMPDriver,,libusb0.sys

; Older versions of this .inf file installed filter drivers. They are not
; needed any more and must be removed
[libusb_del_reg_hw]
HKR,,LowerFilters
HKR,,UpperFilters

; Device properties
[libusb_add_reg_hw]
HKR,,SurpriseRemovalOK, 0x00010001, 1

;--------------------------------------------------------------------------
; Services
;--------------------------------------------------------------------------

[libusb_add_service]
DisplayName    = "LibUsb-Win32 - Kernel Driver 03/20/2007, 0.1.12.1"
ServiceType    = 1
StartType      = 3
ErrorControl   = 0
ServiceBinary  = %12%\libusb0.sys

;--------------------------------------------------------------------------
; Devices
;--------------------------------------------------------------------------

[Devices]
"J-Link driver"=LIBUSB_DEV, USB\VID_1366&PID_0101

[Devices.NT]
"J-Link driver"=LIBUSB_DEV, USB\VID_1366&PID_0101

[Devices.NTAMD64]
"J-Link driver"=LIBUSB_DEV, USB\VID_1366&PID_0101


;--------------------------------------------------------------------------
; Strings
;--------------------------------------------------------------------------

[Strings]
manufacturer = "Segger"

Then you run the following command to install the J-Link libusb-win32 driver.
C:\\usb\libusb-win32-device-bin-0.1.12.1\bin>rundll32
libusb0.dll,usb_install_driver_np_rundll jlink.inf

You will then notice that it automatically updates the J-Link Segger
driver to libusb-win32. You can see under "Device Manager" that there
is now a new entry called "LibUSB-Win32 Devices --> J-Link Driver"

You can then test it with testlibusb.exe.
C:\usb\libusb-win32-device-bin-0.1.12.1\bin>testlibusb.exe
Dev #0: 0000 - 0000
  Dev #1: SEGGER - J-Link

You can also test it with the testlibusb-win.exe. A popup window will show
the following (kind of a brief version of lsusb under Linux).
DLL version:    0.1.12.1
Driver version: 0.1.12.1

bus/device  idVendor/idProduct
bus-0/\\.\libusb0-0001--0x1366-0x0101     1366/0101
- Manufacturer : SEGGER
- Product      : J-Link
- Serial Number: 123456
  wTotalLength:         32
  bNumInterfaces:       1
  bConfigurationValue:  1
  iConfiguration:       0
  bmAttributes:         c0h
  MaxPower:             50
    bInterfaceNumber:   0
    bAlternateSetting:  0
    bNumEndpoints:      2
    bInterfaceClass:    255
    bInterfaceSubClass: 255
    bInterfaceProtocol: 255
    iInterface:         0
      bEndpointAddress: 81h
      bmAttributes:     02h
      wMaxPacketSize:   64
      bInterval:        0
      bRefresh:         0
      bSynchAddress:    0
      bEndpointAddress: 02h
      bmAttributes:     02h
      wMaxPacketSize:   64
      bInterval:        0
      bRefresh:         0
      bSynchAddress:    0

After that, you can try out OpenOCD.


-- 
Xiaofan http://mcuee.blogspot.com
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to