由于我购买了A4Tech Bloody V8鼠标,我想安装适用于Linux的驱动程序,特别适用于Linux Mint 18(基于Ubuntu 16.04)。
我在GitHub上找到了这个驱动程序:
https://github.com/maxmati/a4tech-bloody-linux-driver
由于没有关于如何安装它的文档,到目前为止我想出了如何准备它进行编译:
首先我安装了cmake
:
sudo apt-get install cmake
然后我为make
准备了如下:
cmake .
我附加输出以供将来参考,但我没有看到任何错误:
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/vlastimil/Downloads/a4tech-bloody-linux-driver-master
我尝试执行此问题页面上建议的所有步骤:https://github.com/maxmati/a4tech-bloody-linux-driver/issues/10
但是在运行时:
rm CMakeCache.txt && cmake . && make clean && make
我收到这些错误:
Scanning dependencies of target bloody
[ 33%] Building CXX object CMakeFiles/bloody.dir/main.cpp.o
[ 66%] Building CXX object CMakeFiles/bloody.dir/Mouse.cpp.o
[100%] Linking CXX executable bloody
CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::init()':
Mouse.cpp:(.text+0x18): undefined reference to `libusb_init'
Mouse.cpp:(.text+0x64): undefined reference to `libusb_set_debug'
CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::discoverDevices()':
Mouse.cpp:(.text+0xa5): undefined reference to `libusb_get_device_list'
Mouse.cpp:(.text+0x10a): undefined reference to `libusb_get_device_descriptor'
Mouse.cpp:(.text+0x14c): undefined reference to `libusb_open'
Mouse.cpp:(.text+0x16e): undefined reference to `libusb_kernel_driver_active'
Mouse.cpp:(.text+0x18d): undefined reference to `libusb_detach_kernel_driver'
Mouse.cpp:(.text+0x1a6): undefined reference to `libusb_close'
Mouse.cpp:(.text+0x1cc): undefined reference to `libusb_get_device_address'
Mouse.cpp:(.text+0x215): undefined reference to `libusb_free_device_list'
CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::~Mouse()':
Mouse.cpp:(.text+0x366): undefined reference to `libusb_close'
Mouse.cpp:(.text+0x391): undefined reference to `libusb_exit'
CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::writeToMouse(unsigned char*, unsigned long)':
Mouse.cpp:(.text+0x497): undefined reference to `libusb_control_transfer'
CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::readFromMouse(unsigned char*, unsigned long, unsigned char*, unsigned long)':
Mouse.cpp:(.text+0x548): undefined reference to `libusb_control_transfer'
CMakeFiles/bloody.dir/Mouse.cpp.o: In function `Mouse::listDevices()':
Mouse.cpp:(.text+0x6af): undefined reference to `libusb_get_device'
Mouse.cpp:(.text+0x6c6): undefined reference to `libusb_get_device_descriptor'
collect2: error: ld returned 1 exit status
CMakeFiles/bloody.dir/build.make:120: recipe for target 'bloody' failed
make[2]: *** [bloody] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/bloody.dir/all' failed
make[1]: *** [CMakeFiles/bloody.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
locate libusb.h
告诉我,它存在于:
/usr/include/libusb-1.0/libusb.h
但尝试使用g++
手动编译它:
g++ main.cpp -lusb-1.0
说,它找不到它:
In file included from main.cpp:2:0:
Mouse.h:8:20: fatal error: libusb.h: No such file or directory
compilation terminated.
混乱。
生成的文件列表看起来很好:
ll
total 124K
-rw-r--r-- 1 vlastimil vlastimil 6.3K Nov 17 15:25 build.make
-rw-r--r-- 1 vlastimil vlastimil 276 Nov 17 15:25 cmake_clean.cmake
-rw-r--r-- 1 vlastimil vlastimil 551 Nov 17 15:25 CXX.includecache
-rw-r--r-- 1 vlastimil vlastimil 799 Nov 17 15:25 DependInfo.cmake
-rw-r--r-- 1 vlastimil vlastimil 445 Nov 17 15:25 depend.internal
-rw-r--r-- 1 vlastimil vlastimil 274 Nov 17 15:25 depend.make
-rw-r--r-- 1 vlastimil vlastimil 255 Nov 17 15:25 flags.make
-rw-r--r-- 1 vlastimil vlastimil 182 Nov 17 15:25 link.txt
-rw-r--r-- 1 vlastimil vlastimil 9.9K Nov 17 15:25 main.cpp.o
-rw-r--r-- 1 vlastimil vlastimil 69K Nov 17 15:25 Mouse.cpp.o
-rw-r--r-- 1 vlastimil vlastimil 64 Nov 17 15:25 progress.make
我无法将它们链接到一个二进制文件中,我直接尝试了它:
/usr/bin/g++ -std=c++11 -I/usr/include/libusb-1.0 -L/usr/lib/x86_64-linux-gnu -lusb-1.0 main.cpp.o Mouse.cpp.o -o bloody
Mouse.cpp.o: In function `Mouse::init()':
Mouse.cpp:(.text+0x18): undefined reference to `libusb_init'
Mouse.cpp:(.text+0x64): undefined reference to `libusb_set_debug'
Mouse.cpp.o: In function `Mouse::discoverDevices()':
Mouse.cpp:(.text+0xa5): undefined reference to `libusb_get_device_list'
Mouse.cpp:(.text+0x10a): undefined reference to `libusb_get_device_descriptor'
Mouse.cpp:(.text+0x14c): undefined reference to `libusb_open'
Mouse.cpp:(.text+0x16e): undefined reference to `libusb_kernel_driver_active'
Mouse.cpp:(.text+0x18d): undefined reference to `libusb_detach_kernel_driver'
Mouse.cpp:(.text+0x1a6): undefined reference to `libusb_close'
Mouse.cpp:(.text+0x1cc): undefined reference to `libusb_get_device_address'
Mouse.cpp:(.text+0x215): undefined reference to `libusb_free_device_list'
Mouse.cpp.o: In function `Mouse::~Mouse()':
Mouse.cpp:(.text+0x366): undefined reference to `libusb_close'
Mouse.cpp:(.text+0x391): undefined reference to `libusb_exit'
Mouse.cpp.o: In function `Mouse::writeToMouse(unsigned char*, unsigned long)':
Mouse.cpp:(.text+0x497): undefined reference to `libusb_control_transfer'
Mouse.cpp.o: In function `Mouse::readFromMouse(unsigned char*, unsigned long, unsigned char*, unsigned long)':
Mouse.cpp:(.text+0x548): undefined reference to `libusb_control_transfer'
Mouse.cpp.o: In function `Mouse::listDevices()':
Mouse.cpp:(.text+0x6af): undefined reference to `libusb_get_device'
Mouse.cpp:(.text+0x6c6): undefined reference to `libusb_get_device_descriptor'
collect2: error: ld returned 1 exit status
我想知道它是否可能是链接器的错误(?)
我的最后一个想法是将这两个目标文件链接在一起:
g++ -o output main.cpp.o Mouse.cpp.o
但结果与上述直接尝试相同。
编译器版本是:
g++-5.real (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
我不知道如何继续前进。谢谢你的任何提示。
答案 0 :(得分:0)
好吧,我在这方面遇到了很多麻烦,但最终我发现了它。
可能有更好的解决方案,如果是,请添加您的。
将此文件复制,无论链接器找不到编译文件夹的原因是什么:
cp /usr/include/libusb-1.0/libusb.h ./
并且manualy调用编译:
g++ -std=c++11 main.cpp Mouse.cpp -I. -L. -L/usr/lib/x86_64-linux-gnu/ -lusb-1.0 -o "mouse-set-backlight"
这将创建mouse-set-backlight
文件,此时此文件无法识别我的鼠标。我将在明天尝试解决。
修复Bloody V8 Core 2:
编辑此文件:
Mouse.h
更改此行:
static const int BLOODY_V8_PID = 0x11F5;
为:
static const int BLOODY_V8_PID = 0x36E1;
再次编译。
如何修复Bloody鼠标的未知版本,通常是:
dmesg | grep Mouse
输出应该看起来像我的:
[462227.138026] hid-generic 0003:09DA:36E1.0005: input,hidraw1: USB HID v1.11 Mouse [COMPANY USB Device] on usb-0000:00:14.0-2/input1
请看这一部分:
hid-generic 0003:09DA:36E1.0005
地址的第三部分,就我而言36E1
而言,就是你所需要的。
为其添加0x
前缀,即0x36E1
最后,编辑您的Mouse.h
,与上面的方式类似。
再次编译。