关于libusb,libusbx,libusbK,libusb-win32,WinUSB的关系

刚开始接触USB驱动编程,一般是利用现成的库来做,但是网上一搜索,发现一大堆各种各样的lib把人搞的很头疼,这边总结一下。

== libusb ==
说明:libusb是一个跨平台的usb驱动框架。libusb原始项目在2010年后基本没有更新,曾有libusbx项目2012年从libusb分出来,2014年1月26日又合并回libusb了。当时的libusbx-1.0.18和libusb-1.0.18其实完全一样,相当于libusbx替换了libusb的代码!后续的版本其实都是基于libusbx的代码了!

包含两个主要分支1.x和0.1.x。
1.x和0.1.x并不兼容,可以同时存在,如果要在1.x基础上兼容0.1.x需要libusb-compat转换层。所以0.1.x和libusb-compat不能同时装上!

内核:目前1.x分支的驱动只有用户态,linux下支持usbfs,windows下支持WinUSB.sys。
也可以支持libusbK和libusb-win32(通过libusbK支持)。

工具:通过Zadig支持生成基于libusb0、libusbK、WinUSB的inf文件。
https://github.com/pbatard/libwdi/wiki/Zadig

== libusb-win32 ==
说明:libusb-win32是从libusb-0.1.x分支衍生的,
主要是针对Windows做优化,所以接口风格和libusb-0.1.x一致。

内核:WDM框架的libusb0.sys驱动。

工具:自带inf-wizard.exe生成基于libusb0.sys的inf文件。

注意:目前建议是新的项目尽可能使用libusb,而不是这个libusb-win32了。我在这个上面花了很多时间,一直报错,坑爹了,要注意libusb-win32已经废弃,目前使用的是libusb+Zadig的组合。

== libusbK ==
说明:libusbK主要是想做一个WinUSB接口风格的开源usb库,
支持基于KMDF的libusbK.sys和系统自带的WinUSB.sys。参考libusb-win32做的开发,部分工具是从libusb-win32整合而来的。因为源代码里也包含了libusb0.dll的加载功能和转换层,所以也可以支持WDM框架的libusb0.sys(libusb-win32)。

内核:基于KMDF框架的libusbK.sys、WDM的libusb0.sys、系统的WinUSB.sys

工具:自带libusbK-inf-wizard.exe(基于libusb-win32的工具改的)
生成基于libusb0、libusbK、WinUSB的inf文件。

== 备忘 ==
libusb (官方版本,2014.06.14)
新网站:http://libusb.info/
新代码:http://sourceforge.net/projects/libusb/ (新的1.0.19-2014.06.14)
新开发:http://github.com/libusb/ (貌似开发进度都在这个上面显示了)
旧网站:http://www.libusb.org/ (基于Trac的,已经废弃了)
旧网站:http://libusbx.org/
旧代码:http://sourceforge.net/projects/libusbx/ (到1.0.18-2014.01.26为止)
目前Windows下只是用户态的驱动
支持libusbK、WinUSB、libusb-win32的内核驱动访问。
如果要使用libusb-win32的话,需要安装libusbK!

libusbK(支持windows,2014.04.27)
新网站:http://sourceforge.net/projects/libusbk/
旧网站:http://code.google.com/p/usb-travis/
包含内核态和用户态驱动

libusb-win32(libusb-0.1版本的windows移植,2012.01.17)
网站:http://www.libusb.org/wiki/libusb-win32
网站:http://sourceforge.net/projects/libusb-win32/
包含内核态和用户态驱动

简单说,就是不要去管libusb-win32和libusbK项目,目前不管是windows还是Linux都是使用libusb项目,主页是libusb.info。

在Windows上使用libusb时是调用微软的WinUSB接口,在Linux上是usbfs。用Zadig工具统一安装驱动,不用理什么inf-wizard.exe。

参考 http://blog.gpjtag.com/?p=733

网友评论:

  1. minecraft 说:

    Pretty section of content. I just stumbled upon your blog and in accession capital to assert that
    I get actually enjoyed account your blog posts. Anyway
    I’ll be subscribing to your augment and even I
    achievement you access consistently rapidly.

  2. minecraft free download 2018 说:

    Excellent blog! Do you have any hints for aspiring writers?
    I’m hoping to start my own site soon but I’m
    a little lost on everything. Would you propose starting
    with a free platform like WordPress or go for a paid option? There are
    so many choices out there that I’m completely overwhelmed ..
    Any suggestions? Appreciate it!

  3. tinder dating site 说:

    This article provides clear idea for the new people of blogging, that in fact how to do blogging and site-building.

  4. Sling TV 说:

    Does your blog have a contact page? I’m having trouble locating it but, I’d like to send you an e-mail.

    I’ve got some ideas for your blog you might be interested
    in hearing. Either way, great blog and I look forward to seeing it grow over time.

  5. Sling TV 说:

    Today, I went to the beach with my children. I found a
    sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her
    ear and screamed. There was a hermit crab inside and it pinched her ear.
    She never wants to go back! LoL I know this is completely off
    topic but I had to tell someone!

  6. descargar facebook 说:

    Do you have a spam problem on this site; I also am a blogger,
    and I was wondering your situation; many of us have developed some nice
    practices and we are looking to trade methods
    with other folks, why not shoot me an email if interested.

  7. joen 说:

    grep -robUaP “\xbf\x1b” ./ 目录下搜索二进制 0xbf 1b

发表评论

发表评论前,请选对水果: 菠萝