Code Monkey home page Code Monkey logo

charge-guru's Introduction

ChargeGuru

This is an application to control SkyRC B6* chargers. It's a replacement for the ChargeMaster application provided by the manufacturer, which is badly designed and doesn't work on GNU/Linux. It's written in Qt5.

screenshot

Installation

Dependencies:

qt5 qtcharts libusb-1.0 libb6

Grab libb6 from https://github.com/maciek134/libb6.

Run these commands to compile the software:

$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ make

Either run the programs that use it as root (not recommended) or create an udev rule similar to this one:

SUBSYSTEM=="usb", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0001", MODE:="666", GROUP="plugdev"
KERNEL=="hidraw*", ATTRS{idVendor}=="0000", ATTRS{idProduct}=="0001", MODE="0666", GROUP="plugdev"

Start the software and connect the charger, the interface will be enabled when charger's interface is up (it may take a few seconds, the MCU is a bit slow in that aspect).

What's working

  • device information
  • system settings
  • starting / stopping charging with all available options
  • toggable charging charts
  • displaying charging errors
  • notification after charging complete

TODO / what to expect in the future

  • saving charging profiles for quick use
  • battery datasheet / charging profile database
  • charging data export (to csv)
  • pause / resume charging
  • SMS / e-mail notifications
  • touch interface?
  • Windows build if I figure out how to make CMake work in there

charge-guru's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

charge-guru's Issues

undefined reference Device.cc

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

Not working on macOS

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

Unable To compile on POP OS( Ubuntu Based)

[ 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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.