maciek134 / charge-guru Goto Github PK
View Code? Open in Web Editor NEWAn application to control SkyRC B6* series chargers.
License: GNU General Public License v3.0
An application to control SkyRC B6* series chargers.
License: GNU General Public License v3.0
Findlibusb-1.0 module is not working right on Debian Bullseye, attached cmake configuration using pkg-config to get includes and libraries paths for the linker.
CMakeLists.txt
[ 20%] Automatic MOC and UIC for target ChargeGuru
[ 20%] Built target ChargeGuru_autogen
[ 40%] Linking CXX executable ChargeGuru
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::~Device()':
Device.cc:(.text+0x14): undefined reference to `libusb_release_interface'
/usr/bin/ld: Device.cc:(.text+0x23): undefined reference to `libusb_close'
/usr/bin/ld: Device.cc:(.text+0x2f): undefined reference to `libusb_exit'
/usr/bin/ld: Device.cc:(.text+0x57): undefined reference to `libusb_attach_kernel_driver'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::m_read()':
Device.cc:(.text+0xdc): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::m_write(b6::Packet)':
Device.cc:(.text+0x1ae): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::m_sendCommand(b6::CMD)':
Device.cc:(.text+0x289): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::Device()':
Device.cc:(.text+0xcf5): undefined reference to `libusb_init'
/usr/bin/ld: Device.cc:(.text+0xd0f): undefined reference to `libusb_open_device_with_vid_pid'
/usr/bin/ld: Device.cc:(.text+0xd26): undefined reference to `libusb_kernel_driver_active'
/usr/bin/ld: Device.cc:(.text+0xd36): undefined reference to `libusb_claim_interface'
/usr/bin/ld: Device.cc:(.text+0xd77): undefined reference to `libusb_detach_kernel_driver'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::setBuzzers(bool, bool)':
Device.cc:(.text+0xe86): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::setCycleTime(int)':
Device.cc:(.text+0x103a): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::setTempLimit(int)':
Device.cc:(.text+0x11ca): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::setCapacityLimit(bool, int)':
Device.cc:(.text+0x139f): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o): in function `b6::Device::setTimeLimit(bool, int)':
Device.cc:(.text+0x15af): undefined reference to `libusb_interrupt_transfer'
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/11/../../../../lib/libb6.a(Device.cc.o):Device.cc:(.text+0x1a2c): more undefined references to `libusb_interrupt_transfer' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/ChargeGuru.dir/build.make:134: ChargeGuru] Error 1
make[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/ChargeGuru.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Hi, I can't compile your code. Can you please help?
/usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function b6::Device::~Device()': Device.cc:(.text+0x10): undefined reference to
libusb_release_interface'
Device.cc:(.text+0x1f): undefined reference to libusb_close' Device.cc:(.text+0x2b): undefined reference to
libusb_exit'
Device.cc:(.text+0x4f): undefined reference to libusb_attach_kernel_driver' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::m_read()':
Device.cc:(.text+0xc4): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::m_write(b6::Packet)':
Device.cc:(.text+0x18b): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::m_sendCommand(b6::CMD)':
Device.cc:(.text+0x23f): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::stopCharging()':
Device.cc:(.text+0x1075): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::Device()':
Device.cc:(.text+0x127b): undefined reference to libusb_init' Device.cc:(.text+0x1295): undefined reference to
libusb_open_device_with_vid_pid'
Device.cc:(.text+0x12a8): undefined reference to libusb_kernel_driver_active' Device.cc:(.text+0x12b8): undefined reference to
libusb_claim_interface'
Device.cc:(.text+0x12ff): undefined reference to libusb_detach_kernel_driver' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::setBuzzers(bool, bool)':
Device.cc:(.text+0x1635): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::setCycleTime(int)':
Device.cc:(.text+0x17db): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::setTempLimit(int)':
Device.cc:(.text+0x195b): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::setCapacityLimit(bool, int)':
Device.cc:(.text+0x1b45): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o): In function
b6::Device::setTimeLimit(bool, int)':
Device.cc:(.text+0x1d75): undefined reference to libusb_interrupt_transfer' /usr/lib/gcc/x86_64-linux-gnu/7/../../../../lib/libb6.a(Device.cc.o):Device.cc:(.text+0x2292): more undefined references to
libusb_interrupt_transfer' follow
collect2: error: ld returned 1 exit status
CMakeFiles/ChargeGuru.dir/build.make:151: recipe for target 'ChargeGuru' failed
make[2]: *** [ChargeGuru] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/ChargeGuru.dir/all' failed
make[1]: *** [CMakeFiles/ChargeGuru.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
I tried using this app on macOS and it didn't work - the app simply doesn't detect the device.
After looking around, it turned out that libusb requires quite exclusive access to the USB device, which macOS only grants to kernel extensions or USB devices not claimed by other extensions, so libusb_open_device_with_vid_pid fails 1. Since libusb couldn't get access, apparently something was already "claiming it". After long tries of unloading every USB-related kext I could, I came to conclusion that it's probably system's HID driver, (which obviously can't be unloaded). Even the original SkyRC app seems not to require special drivers, which hints that it's using HID APIs as well.
I've checked the code of libb6 that this app is using and it seemed that a swap of libusb to libhid is quite straightforward. I've tried doing that and the app seems to work. Also, with hidlib it's not necessary to give root access or create udev access rules.
Here are the the changes to make it work with hidlib:
libb6
charge-guru
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.