Open augustopaulogh opened 5 years ago
Dunno about Macs, but get libusb from https://github.com/libusb/libusb or maybe with brew
. Might need to change the include path in build.sh too. Or if you cloned with git, init submodules and it pulls it into external
folder.
Hi jackun, I've already had libusb installed:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ brew list libusb /usr/local/Cellar/libusb/1.0.23/include/libusb-1.0/libusb.h /usr/local/Cellar/libusb/1.0.23/lib/libusb-1.0.0.dylib /usr/local/Cellar/libusb/1.0.23/lib/pkgconfig/libusb-1.0.pc /usr/local/Cellar/libusb/1.0.23/lib/ (2 other files) /usr/local/Cellar/libusb/1.0.23/share/libusb/ (16 files) Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$
Managed to include libusb.h into compilation:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ g++ -o rgblights.lnx rgblights/main.cpp -lusb-1.0 -I /usr/local/Cellar/libusb/1.0.23/include/libusb-1.0/
But then the compiler throws a bunch or warning an errors:
rgblights/main.cpp:13:12: warning: alias declarations are a C++11 extension [-Wc++11-extensions]
using ms = std::chrono::milliseconds; ^ rgblights/main.cpp:51:1: error: unknown type name 'constexpr' constexpr size_t countof(T(&arr)[N]) ^ rgblights/main.cpp:51:11: warning: variable templates are a C++14 extension [-Wc++14-extensions] constexpr size_t countof(T(&arr)[N]) ^ rgblights/main.cpp:51:17: error: expected ';' at end of declaration constexpr size_t countof(T(&arr)[N]) ^ ; rgblights/main.cpp:51:18: error: C++ requires a type specifier for all declarations constexpr size_t countof(T(&arr)[N]) ^ rgblights/main.cpp:51:29: error: use of undeclared identifier 'arr' constexpr size_t countof(T(&arr)[N]) ^ rgblights/main.cpp:51:34: error: use of undeclared identifier 'N' constexpr size_t countof(T(&arr)[N]) ^ rgblights/main.cpp:51:37: error: expected ';' after top level declarator constexpr size_t countof(T(&arr)[N]) ^ ; rgblights/main.cpp:115:2: error: expected member name or ';' after declaration specifiers { ^ rgblights/main.cpp:114:42: error: expected '(' PktRGB(uint8_t hdr = HDR_D_LED1_RGB) : s{ 0 } ^ rgblights/main.cpp:114:45: error: expected ';' after expression PktRGB(uint8_t hdr = HDR_D_LED1_RGB) : s{ 0 } ^ ; rgblights/main.cpp:114:44: warning: expression result unused [-Wunused-value] PktRGB(uint8_t hdr = HDR_D_LED1_RGB) : s{ 0 } ^ rgblights/main.cpp:157:2: error: expected member name or ';' after declaration specifiers { ^ rgblights/main.cpp:156:18: error: expected '(' PktEffect() : e { 0 } ^ rgblights/main.cpp:156:21: error: expected ';' after expression PktEffect() : e { 0 } ^ ; rgblights/main.cpp:156:20: warning: expression result unused [-Wunused-value] PktEffect() : e { 0 } ^ rgblights/main.cpp:450:38: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] struct libusb_device_handle handle = nullptr; ^ rgblights/main.cpp:451:29: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] struct libusb_context ctx = nullptr; ^ rgblights/main.cpp:454:21: warning: in-class initialization of non-static data member is a C++11 extension [-Wc++11-extensions] uint32_t led_count = 32; ^ rgblights/main.cpp:370:10: error: no member named 'Init' in 'PktEffect' effect.Init(hdr >= 0x20 ? hdr - 0x20 : hdr);
rgblights/main.cpp:390:11: error: no member named 'Reset' in 'PktRGB' packet.Reset(hdr); ~~~~~~ ^ rgblights/main.cpp:421:11: error: no member named 'Init' in 'PktEffect' effect.Init(i); ~~~~~~ ^ rgblights/main.cpp:583:2: warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions] auto delay = ms(10); ^ rgblights/main.cpp:693:32: error: use of undeclared identifier 'MakeColor' ite.SetAllPorts(EFFECT_PULSE, MakeColor(0xFF, 0x21, 0)); ^ 8 warnings and 16 errors generated. Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$
What next ?
Sorry... Just saw that you've added a compiler batch cfile for MacOSX.
I'll try when back home this evening.
Thanks!
Yes, seemed to build on catalina virtual machine. llvm-g++ needs extra -std=c++11
argument.
You can try to get python version to work (test.py), easier to modify effects maybe.
Got home early today and re-downloaded whole package again.
Compiled perfectly with new build-macos-brew.sh:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ ./build-macos-brew.sh Building... OK. Run it with "./rgblights.macos" Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$
But couldn't test due to "failed to claim interface 0" error:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ ./rgblights.macos Failed to claim interface 0 Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$
Also, the libusb1 (python) with "test.py" gives a similar error:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ cd python/ Paulos-iMac-Pro:python pauloaugusto$ python test.py Traceback (most recent call last): File "test.py", line 5, in
c = it.Controller() File "/Users/pauloaugusto/Downloads/IT8297-rgb-controller-master/python/it8297/init.py", line 200, in init self.handle.claimInterface(0) File "build/bdist.macosx-10.14-intel/egg/usb1/init.py", line 1309, in claimInterface File "build/bdist.macosx-10.14-intel/egg/usb1/init.py", line 133, in mayRaiseUSBError File "build/bdist.macosx-10.14-intel/egg/usb1/init.py", line 125, in raiseUSBError usb1.USBErrorAccess: LIBUSB_ERROR_ACCESS [-3] Paulos-iMac-Pro:python pauloaugusto$
I feel it is almost there ;-)
Seems that libusb can't detach HID driver on macos, so this should be converted to using hidapi instead as some comments suggest it should work then.
I've added hidapi version to python, seemed to work on linux. C++ version coming later.
It worked!! After I've checked my python version, I was able to see a lot of colours changing on the motherboard:
Paulos-iMac-Pro:python pauloaugusto$ python3 --version Python 3.7.3 Paulos-iMac-Pro:python pauloaugusto$ python3 test.py Manufacturer: ITE Tech. Inc. Product: ITE Device(8595) Serial No: None Product: IT8297-GIGABYTE V1.1.5.0 pulse Press CTRL + C to break the loop "off-by-one" RGB effect :P ^Csave MCU: True flash
transition between statics ^CTraceback (most recent call last): File "test.py", line 88, in
static(c) File "test.py", line 47, in static c.sendPacket(pkt) File "/Users/pauloaugusto/Downloads/IT8297-rgb-controller-master/python/it8297/controller_hidapi.py", line 49, in sendPacket return self.device.write(data) KeyboardInterrupt
When I tried a few more times, I couldn't get it to work again (had my iPhone ready for a photo ;-)) - but the principle is tested!!! Thanks a lot! ;-P
Paulos-iMac-Pro:python pauloaugusto$ python3 test.py Manufacturer: ITE Tech. Inc. Product: ITE Device(8595) Serial No: None
^CTraceback (most recent call last): File "test.py", line 6, in
c = it.Controller_hidapi() File "/Users/pauloaugusto/Downloads/IT8297-rgb-controller-master/python/it8297/controller_hidapi.py", line 40, in init self._startup() File "/Users/pauloaugusto/Downloads/IT8297-rgb-controller-master/python/it8297/base.py", line 184, in _startup self.setAllPorts(EFFECT_PULSE, 0x00FF2100) File "/Users/pauloaugusto/Downloads/IT8297-rgb-controller-master/python/it8297/base.py", line 208, in setAllPorts self.sendPacket(pkt) File "/Users/pauloaugusto/Downloads/IT8297-rgb-controller-master/python/it8297/controller_hidapi.py", line 49, in sendPacket return self.device.write(data) KeyboardInterrupt Paulos-iMac-Pro:python pauloaugusto$
Have a look at some pictures and small video:
https://drive.google.com/drive/folders/1P2OF3oXq3RxM2YGFqYU7hjdzB2IBcj5j?usp=sharing
Quite happy!!
Morning, Believe that you're working also on the C++ version for OSX ? ;-) What else do you want me to test ? Thanks
Good morning jackun, Tried the updated ./build-macos-brew.sh and it stops compiling with following errors:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ ./build-macos-brew.sh Building... rgblights/rgblights.cpp:16:2: error: No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
error No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
^ 1 error generated. Demo/Demo.cpp:21:2: error: No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
error No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
^ Demo/Demo.cpp:119:16: error: unknown type name 'UsbIT8297' void DoRainbow(UsbIT8297& usbDevice) ^ Demo/Demo.cpp:178:12: error: unknown type name 'UsbIT8297' void DoRGB(UsbIT8297& usbDevice) ^ Demo/Demo.cpp:242:2: error: unknown type name 'UsbIT8297' UsbIT8297 ite; ^ 4 errors generated. failed Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$
Uncommented _#define HAVEHIDAPI 1 in both files above, but then it's missing the hidapi.h file:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ ./build-macos-brew.sh Building... rgblights/rgblights.cpp:13:11: fatal error: 'hidapi.h' file not found
include
^~~~~~~~~~
1 error generated. Demo/Demo.cpp:21:2: error: No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
error No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
^ Demo/Demo.cpp:119:16: error: unknown type name 'UsbIT8297' void DoRainbow(UsbIT8297& usbDevice) ^ Demo/Demo.cpp:178:12: error: unknown type name 'UsbIT8297' void DoRGB(UsbIT8297& usbDevice) ^ Demo/Demo.cpp:242:2: error: unknown type name 'UsbIT8297' UsbIT8297 ite; ^ 4 errors generated. failed
Was able to find a hidapi.h on my drive (from github OpenCorsairLink project), but again, fails with errors:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ ./build-macos-brew.sh Building... rgblights/rgblights.cpp:216:7: error: use of undeclared identifier 'UsbIT8297_hidapi' void UsbIT8297_hidapi::Init() ^ rgblights/rgblights.cpp:253:2: error: use of undeclared identifier 'UsbIT8297_hidapi' UsbIT8297_hidapi::~UsbIT8297_hidapi() ^ rgblights/rgblights.cpp:263:6: error: use of undeclared identifier 'UsbIT8297_hidapi' int UsbIT8297_hidapi::SendPacket(unsigned char* packet) ^ 3 errors generated. Demo/Demo.cpp:21:2: error: No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
error No backend defined. Define HAVE_LIBUSB or HAVE_HIDAPI.
^ Demo/Demo.cpp:119:16: error: unknown type name 'UsbIT8297' void DoRainbow(UsbIT8297& usbDevice) ^ Demo/Demo.cpp:178:12: error: unknown type name 'UsbIT8297' void DoRGB(UsbIT8297& usbDevice) ^ Demo/Demo.cpp:242:2: error: unknown type name 'UsbIT8297' UsbIT8297 ite; ^ 4 errors generated. failed
The python version works perfectly:
-rw-r--r-- 1 pauloaugusto staff 2,2K 4 Nov 21:23 test.py Paulos-iMac-Pro:python pauloaugusto$ python3 test.py Manufacturer: ITE Tech. Inc. Product: ITE Device(8595) Serial No: None Product: IT8297-GIGABYTE V1.1.5.0 pulse Press CTRL + C to break the loop "off-by-one" RGB effect :P
It wasn't updated yet. I was just doing that :D
It wasn't updated yet. I was just doing that :D
He!He!He! Sorry, I'm too keen on getting this working on MacOSX!!
I'll test it again when I'm back home at the end of my day! Cheers.
Morning, Tested and fully compiles C++ version!! No errors.
Now the MacOS MacPorts version still produces compiles errors:
Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ ./build-macos-ports.sh ./build-macos-ports.sh:[:5: too many arguments Installing hidapi... Password: sudo: port: command not found Building... ./build-macos-ports.sh:17: no such file or directory: /opt/local/bin/pkg-config rgblights/rgblights.cpp:13:11: fatal error: 'hidapi.h' file not found
include
^~~~~~~~~~
1 error generated. failed
Now that the main feature is demonstrated and proved, what are your plans ? Are you going to add command switches to include other effects & features ? Do you want to publish this on Insanelymac or tonymacx86 websites ? ;-)
If you want you can now mature this, similarly, to what https://github.com/jonasmalacofilho/liquidctl have done ?
Cheers.
MacPorts is an alternative to brew.sh (and has to be installed).
Are you going to add command switches to include other effects & features ?
Hmm, maybe but not really. I can add some basic options, but probably nothing fancy.
Added some (user-unfriendly :P) command line arguments. Header port numbers might be different per motherboard but on Gigabyte X570 Elite these are in range of 32..39 and separate 88, 89 for custom RGB effects.
tested with Gigabyte Aorus X570 I Pro Wifi, work great for me on macOS (using brew)
Hi, I'm quite excited that you're trying to get an "alternative" to RGBFusion! This almost compile on Mojave (Mac OSX)...
`Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ ./build.sh rgblights/main.cpp:11:10: fatal error: 'libusb.h' file not found
include
1 error generated. Paulos-iMac-Pro:IT8297-rgb-controller-master pauloaugusto$ `
What do I need to do to test this also ?
Thanks ;-)