LibUsb-Win32

  • 02/15/2004: Version 0.1.8.0 released
    • Ported version 0.1.8.0 of libusb to libusb-win32
    • Filter driver: fixed two bugs which caused BSODs on some systems during powerdown and device removal.
    • Filter driver: fixed bug in composite device handling code.
    • Services: added better handling of composite devices. These # devices now appear as one single device instead of multiple devices for each interface.
    • Sample inf-file: renamed to libusb.inf.
    • Sample inf-file: added better support for composite devices
    • Sample inf-file: included direct support for the Dakota and Walgreens digital cameras.
    • Installer: improved installation speed.

  • 02/01/2004: Version 0.1.7.10 released
    • The binary package distributions has been split up into two parts: Filter driver and device driver. An user friendly GUI installer has been added for the filter driver. The filter driver is now installed in a different way which will now allow access to all USB devices which weren't accessible in the past (mice, scanners, etc.). A Windows system service (daemon) has been added to achive this.
      The device driver (stub driver) doesn't need the filter driver to be installed any more. Please read installation details below.
    • DLL: fixed a bug which caused the device detection to fail on some systems.
    • Filter driver: PNP and power management code improved. This will hopefully remove the shutdown and hibernation problems reported by some users on XP systems.
Libusb-win32 is a port of the USB library libusb to the Windows operating systems (Win98SE, WinME, Win2k, WinXP). The library allows user space applications to access any USB device on Windows in a generic way without writing any line of kernel driver code.
Features:
  • Can be used as a filter driver for existing, already installed devices. This feature allows libusb-win32 to communicate with any installed USB device.
  • Can be used as a normal device driver for devices for which no driver exists (self build/developed USB hardware, etc).
  • The two methods described above can used in parallel without any problems.
  • 100% API and functional compatible with the main libusb project.
  • Supports Bulk and Interrupt transfers.
  • Supports all Standard Device Requests (control messages) described in chapter 9 of the USB specification.
  • Supports vendor specific control messages.
  • The library (DLL) is distributed under the terms of the GNU Lesser General Public License (LGPL).
  • All other components (drivers, services, installer) are distributed under the terms of the GNU General Public License (GPL).
  • This license combination explicitly allows the use of this library in commercial, non Open Source applications. Read the licenses carefully and apply all of their requirements before including this library in a commercial application!
If something isn't working as expected, make sure that you have installed the latest service packs for your OS, the mainboard's latest driver packages, and bios updates, and the latest version of libusb-win32 before requesting any support.
Available Support Options:
  • A mailing list is available for discussions, questions, bug reports, feature request, and other issues.
    Please subscribe to the list first before posting.
  • The project page offers different forms which can be filled out to get support, to report bugs, or to request new features.
    Please describe your problems and your system as precise as possible (OS, service packs, version of libusb-win32, type of device, etc.). This will make solving problems a lot easier.
Source code and binary packages can be downloaded from the projects download site. Source code is also available via anonymous CVS.

Installation

Filter Driver Installation
  • As of version 0.1.7.10 the filters driver is installed by a user friendly GUI installer which makes the install and uninstall process easier and more secure.
  • Log in as a user with administrator privileges.
  • Download the latest filter driver installer (libusb-win32-filter-bin-x.x.x.x.exe).
  • Close all applications which use USB devices before installing.
  • Run the installer, and follow it's instructions. Do not run the installer from an USB storage device!
  • At the end of the installation process the installer will offer to run a test program. This program will verify the correct installation and print the descriptors of all USB devices accessible by the library. The test program can also be run later from the system's start menu.
  • A reboot isn't necessary.
Device Driver Installation
  • As of version 0.1.7.10 the device driver is distributed as a seperate package which includes everything to use libusb-win32 for single devices as a normal device driver. The installation of the filter driver is not necessary any more!
  • Log in as a user with administrator privileges.
  • Download the latest device driver binary package (libusb-win32-device-bin-x.x.x.x.tar.gz).
  • Extract it to a temporary directory.
  • Rename and edit the sample inf-file 'libusb.inf' to match your device(s) (modify the vendor and product IDs, strings etc.). Create different inf-files to install different types of devices (devices with different IDs).
  • Unplug the device(s) from the system.
  • Open the Windows Device Manager and remove all incorrectly installed USB devices (device entries with a yellow exclamation mark).
  • Reconnect the device(s) to the system.
  • When Windows asks for a driver, choose the inf-file(s) created above. On Win2k and WinXP systems, Windows will warn that the driver is is not 'digitally signed'. Ignore this message and continue with the installation.
  • Open the Windows Device Manager to verify that the device is installed correctly. Run the test program (testlibusb-win.exe) from the 'bin directory'. It should print out the descriptors of your device(s).
  • A reboot isn't necessary.

Removing

Removing the Filter Driver
  • To remove the filter driver open the Control Panel, open 'Software', choose the 'LibUsb-Win32-x.x.x.x' entry, and remove it.
  • A reboot isn't necessary.
Removing the Device Driver
  • The device driver can not be removed from the system. Windows doesn't offer any option to do this.

Updating

Updating the Filter Driver
  • If you have installed version 0.1.7.10 or higher, remove this version first (see above). Direct updating is not supported.
  • If you have installed version 0.1.7.9 or lower, removing is not necessary. The new GUI installer will remove these versions automatically.
  • Install the new version as described above.
Updating the Device Driver
  • Download the latest device driver binary package (libusb-win32-device-bin-x.x.x.x.tar.gz).
  • Modify the inf-file as described in the Installation section.
  • Open the Device Manager and select the device you want to update.
  • Choose 'Properties->Driver->Update'. Disable the automatic installation and select the new inf-file manually.

Requirements

  • A Win2k or XP system.
  • The XP-DDK (Win2k-DDK could work, but has not been tested). A gratis CD of the DDK can be ordered at http://www.microsoft.com
  • MinGW/Msys, Cygwin is not working yet, but this will change in the future. Microsoft and Borland compilers can't be used to build the library, due to their lack of full C99 support.
  • Borland C++ Compiler (BCC) to build the import library for this compiler. A free command line version of BCC can be downloaded from http://www.borland.com.
  • The NSIS install system.
  • Make sure, that the binary directories of NSIS and BCC are in the system search path (modify the system's %PATH% environment variable).

Build Process

The package is currently build with a standard Makefile, there are no autoconf/automake scripts available yet.
  • Download the latest source code.
  • From a Msys shell run the following command (replace <DDKDIR> with your DDK's root directory):
    make DDK_PATH=<DDKDIR>
    to the build the library, services, and drivers.
  • To build the distribution archives and the installer run:
    make dist.

Using

  • To use libusb-win32 in your own programs include the supplied header file usb.h, and link against the import library (libraries for GCC, BCC, and MSVC are available)
  • To avoid any version conflicts, DO NOT include the DLL libusb0.dll in your application's directory. The DLL is part of the driver and installed automatically to the Windows system directory.
  • If you are porting a libusb based program from Unix style systems to Windows, remove all references to the library's global variable usb_busses. Use the function usb_get_busses() instead to get this variable. Global variables in shared libraries (DLLs) do not work on Windows systems across different compilers.
There is no documentation available yet, accept this page. As libusb-win32 is fully API compatible to libusb, the API documentation from the main libusb project site at http://libusb.sourceforge.net can be used.
  • libusb: The main libusb project from which libusb-win32 is derived.
  • www.usb.org: The place to get USB specifications and other general information about USB.
  • www.lvr.com: Lot's of information about USB hardware and software development.
  • www.beyondlogic.org: Another site with information about USB hardware and software development.
  • MCCI: Sells commercial generic USB drivers for Windows.
  • Jungo: Another vendor of generic USB drivers.
  • Thesycon: Another vendor of generic USB drivers.
  • JUSB: A project to provide a generic USB library for the Java platform, similar to libusb. The Windows support is still incomplete.
 Reference: http://libusb-win32.sourceforge.net/
关于libusb-win32开发的经验(2012-11-10 11:37:50)转载▼标签: win32rs232驱动usblibusbit 分类: 外围器件接口 作为设备开发者, 一般需要让设备与上位机PC通讯, 我们往往考虑采用以下几种接口: rs232, USB, ethernet. 现在在PC机上已经很难见到rs232的接口, 而ethernet也需要做特殊的配置, USB大多成为我们的首选. 对于数据偏少的应用, 我们可以利用USB虚拟串口的方式来完成这样的任务, 虚拟串口的驱动和实例, 对于下位机来说也非常常见. 有个问题: 很多应用无法用虚拟串口的方式来得到满足, 只能按照USB的方式来解决问题. 这个时候, 我们只好针对USB进行编程. 对于复杂的驱动编程, 大多数程序员往往望而却步. 不过总有其他简单的方法解决问题. 这里, 我们介绍一个USB通讯库: libusb. 介绍 libusb是一个针对usb通讯的库. 使用它, 你不需要知道操作系统的细节, 你只需要对USB有足够的了解即可. 它也不需要你写驱动, 所有的工作都可以在用户态完成. 使用方法很简单, 这里有一个示例: http://sourceforge.net/apps/trac/libusb-win32/wiki/libusbwin32_documentation#IV.Examples , 是不是很简单? 原理 libusb自己带有一个内核驱动, 名字叫libusb0.sys, 放在WINDOWSSYSTEM32DRIVERS里面. 用户程序调用libusb0.dll, dll会把任务交由驱动来完成. 这样保证用户态就能够完成USB通讯的作业. 具体做了什么, 可以通过下载项目的源文件来了解, 等我有时间的时候再看看吧. 安装方法 libusb现在有好几个版本. 主页面在这里: http://www.libusb.org/ 因为我们一般是进行工程应用, 选择相对稳定的版本: libusb-0.1. 平台在windows下的话, 我们采用libusb-win32: http://www.libusb.org/wiki/libusb-win32 linux下一般已经添加到源里面去了, 查找libusb即可. windows下安装方法: http://www.libusb.org/wiki/libusb-win32#Installation 里面有2种安装方式, Filter Driver Installation 和 Device Driver Installation, 前面一个可以说是开发环境, 后面可以说是发布驱动本身. 我们因为是做系统, 选择前面一个方式, 省得麻烦. 使用 这里有比较详细的文档: http://sourceforge.net/apps/trac/libusb-win32/wiki/libusbwin32_documentation libusb-win32的下载地址http://sourceforge.net/apps/trac/libusb-win32/wiki 开发者论坛地址:http://libusb.6.n5.nabble.com/ libusb-1.0 API Reference:http://libusb.sourceforge.net/api-1.0/ 开发过程中有超时问题的原因:http://sourceforge.net/apps/trac/libusb-win32/wiki/libusbwin32_documentation
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值