maciek134 / charge-guru

An application to control SkyRC B6* series chargers.
GNU General Public License v3.0
24 stars 8 forks source link

Not working on macOS #3

Open mplatov opened 3 years ago

mplatov commented 3 years ago

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

maciek134 commented 3 years ago

Interesting. Sorry for not getting back to you earlier, I must have missed a notification. Please open a pull request, I'll check it out.