对于 64 位 Windows,是否有 libusb-win32 的替代方案?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2581485/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there an alternative to libusb-win32 for 64bit windows?
提问by Jon Cage
I've been developing some software which uses the libusb-win32library to interact with some USB hardware I've been developing. Now I'm trying to run the same software on windows 64 but the drivers don't seem to work (understandably).
我一直在开发一些使用libusb-win32库与我一直在开发的 USB 硬件进行交互的软件。现在我试图在 Windows 64 上运行相同的软件,但驱动程序似乎不起作用(可以理解)。
Are there any alternatives for 64 bit Windows I've overlooked?
有没有我忽略的 64 位 Windows 的替代品?
回答by Jon Cage
Looks like there may be some 64-bit pre-compiled version available hereand here.
[Edit]Oops. Looks like this is already provided for in libusb-win32 in the latest release. 64bit and 32bit are both provided in the device driver package.
[编辑]哎呀。看起来这已经在最新版本的libusb-win32 中提供了。64 位和 32 位都在设备驱动程序包中提供。
回答by Frank
The last version 1.2.6.0 does not work in Windows 10, and presumably not in Windows 8/8.1. Works fine in 32/64 bit Windows 7. Development appears to have stopped in 2013.
最新版本 1.2.6.0 在 Windows 10 中不起作用,并且可能在 Windows 8/8.1 中不起作用。在 32/64 位 Windows 7 中运行良好。开发似乎在 2013 年停止了。
回答by mutl3y
Was having the similar issues with windows builds in Go.
在 Go 中构建 Windows 时遇到了类似的问题。
As I did not find this easy to figure out I will be a little verbose here to ensure what works for me is clear for the novice that stumbles across this post.
由于我发现这并不容易弄清楚,因此我将在这里稍微详细说明,以确保对偶然发现这篇文章的新手来说,对我有用的方法是清楚的。
Windows 10 X64
视窗 10 X64
- Install msys2
- install either 32 bit
pacman -S mingw-w64-i686-toolchain
or 64 bitpacman -Sy mingw-w64-x86_64-toolchain
check version of libusb that installed
pacman -Q | grep libusb
mingw-w64-x86_64-libusb 1.0.23-1
- create
/mingw64/lib/pkgconfig/libusb-1.0.pc
- 安装 msys2
- 安装 32 位
pacman -S mingw-w64-i686-toolchain
或 64 位pacman -Sy mingw-w64-x86_64-toolchain
检查安装的 libusb 版本
pacman -Q | grep libusb
mingw-w64-x86_64-libusb 1.0.23-1
- 创建
/mingw64/lib/pkgconfig/libusb-1.0.pc
#lib-usb-1.0.pc
prefix=/mingw64
exec_prefix=${prefix}
libdir=${exec_prefix}/x86_64-w64-mingw32/lib
includedir=${prefix}/include
Name: libusb-1.0
Description: C API for USB device access from Linux, Mac OS X, Windows, OpenBSD/NetBSD and Solaris userspace
#update version to match
Version: 1.0.23
Libs: -L${libdir} -llibusb-1.0
Libs.private:
Cflags: -I${includedir}/libusb-1.0
- create directory
/mingw64/include/libusb-1.0
- download correct version of libusb.h and extract to
/mingw64/include/libusb-1.0/libusb.h
- 创建目录
/mingw64/include/libusb-1.0
- 下载正确版本的 libusb.h 并解压到
/mingw64/include/libusb-1.0/libusb.h