minor fixes, further prototyping
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

This commit is contained in:
Dmitry Isaenko 2025-01-26 00:54:18 +03:00
parent f33002f67e
commit f9f79a4eeb
7 changed files with 355 additions and 244 deletions

View file

@ -1,7 +1,7 @@
# argb controls for 048d:5711 Integrated Technology Express, Inc. GIGABYTE Device
![License](https://img.shields.io/badge/License-GPLv3-blue.svg) [![status-badge](https://ci.redrise.ru/api/badges/13/status.svg)](https://ci.redrise.ru/repos/13)
![License](https://img.shields.io/badge/License-GPLv3-blue.svg) ![status-badge](https://ci.redrise.ru/api/badges/13/status.svg)](https://ci.redrise.ru/repos/13)
Reference hardware used: Z890 AORUS PRO ICE

View file

@ -62,7 +62,7 @@ cc38
### Commands / directives to apply changes
BRG abbreviation stands for Blue Red Green
*BGR abbreviation stands for Blue Green Red*
There are two types of commands:
* synchronized - applies same setting to everything

View file

@ -50,7 +50,7 @@ int main(int argc, char *argv[]) {
return 1;
}
// Get deivce list
// Get device list
libusb_device* device = NULL;
for (int i = 0; devs[i]; i++){
if (findDevice(devs[i])){
@ -65,14 +65,8 @@ int main(int argc, char *argv[]) {
return 1;
}
// Free deivce list
// Free device list
libusb_free_device_list(devs, 1);
/*
libusb_device_handle* device = libusb_open_device_with_vid_pid(context, VID, PID);
if (device == NULL)
printf("Device not found\n");
*/
ret = libusb_open(device, &dev_handle);
if (ret < 0) {
@ -94,7 +88,6 @@ int main(int argc, char *argv[]) {
}
printf("Current bConfigurationValue: %d\n", bConfigurationValue);
// Set configuration (soft reset device)
// if device used by kernel drivers already
ret = libusb_kernel_driver_active(dev_handle, 1);
printf("libusb_kernel_driver_active: %d\n", ret);

View file

@ -1,4 +1,5 @@
unsigned char end_transaction[64] = { 0xcc, 0x28, 0xff, 0x07, }; //cc28ff07
unsigned char end_alt_transaction[64] = { 0xcc, 0x28, 0x04, }; //cc2804
int prefix(){
counter = 0;
@ -61,17 +62,17 @@ int staticColorSeparate(unsigned char brightness, unsigned char red, unsigned ch
counter = 0;
limit = 7;
//cc 22 04 00 00 00 00 00 00 00 00 01__00______
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red };
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red, };
//cc 24 10 00 00 00 00 00 00 00 00 01__00______
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red };
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red, };
//cc 25 20 00 00 00 00 00 00 00 00 01__00______
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red };
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red, };
//cc 26 40 00 00 00 00 00 00 00 00 01__00______
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red };
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red, };
//cc 27 80 00 00 00 00 00 00 00 00 01__00______
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red };
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red, };
//cc 91 00 02 00 00 00 00 00 00 00 01__00______
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red };
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, brightness, 0x00, blue, green, red, };
if(64 != writeUsb(dir1))
return 1;
@ -98,3 +99,120 @@ int staticColorSeparate(unsigned char brightness, unsigned char red, unsigned ch
return 0;
}
int turnOffBacklight(){
if (prefix())
return 0;
counter = 0;
limit = 7;
//cc 22 04 00 00 00 00 00 00 00 00 01 ff
unsigned char dir1[64] = { 0xcc, 0x22, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 24 10 00 00 00 00 00 00 00 00 01 ff
unsigned char dir2[64] = { 0xcc, 0x24, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 25 20 00 00 00 00 00 00 00 00 01 ff
unsigned char dir3[64] = { 0xcc, 0x25, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 26 40 00 00 00 00 00 00 00 00 01 ff
unsigned char dir4[64] = { 0xcc, 0x26, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 27 80 00 00 00 00 00 00 00 00 01 ff
unsigned char dir5[64] = { 0xcc, 0x27, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
//cc 91 00 02 00 00 00 00 00 00 00 01 ff
unsigned char dir6[64] = { 0xcc, 0x91, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
if(64 != writeUsb(dir1))
return 1;
if(64 != writeUsb(dir2))
return 1;
if(64 != writeUsb(dir3))
return 1;
if(64 != writeUsb(dir4))
return 1;
if(64 != writeUsb(dir5))
return 1;
if(64 != writeUsb(dir6))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("\rTurn off backlight (Separate) sequence sent\n");
return 0;
}
int turnOffBacklightSync(){
if (prefix())
return 0;
counter = 0;
limit = 2;
//cc 20 ff 07 00 00 00 00 00 00 00 01 ff
unsigned char dir1[64] = { 0xcc, 0x20, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0xff, };
if(64 != writeUsb(dir1))
return 1;
if(64 != writeUsb(end_transaction))
return 1;
printf("\rTurn off backlight (Sync) sequence sent\n");
return 0;
}
int wave1(){
//cc 20 ff 07 00 00 00 00 00 00 00 01 ff ← turns off backlight
//cc28ff07
turnOffBacklightSync();
counter = 0;
limit = 2;
//cc 22 00 00 00 00 00 00 00 00 00 09 64 00 00 00 00 00 00 00 00 00 26 02 00 00 00 00 00 00 07
unsigned char dir1[64] = { 0xcc, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, };
if(64 != writeUsb(dir1))
return 1;
//cc2804
if(64 != writeUsb(end_alt_transaction))
return 1;
unsigned char dir1[64] = { 0xcc, };
printf("\rWave 1 (Sync) sequence sent\n");
return 0;
}
int wave2(){
//cc 20 ff 07 00 00 00 00 00 00 00 01 ff ← turns off backlight
//cc28ff07
turnOffBacklightSync();
counter = 0;
limit = 2;
//cc 22 00 00 00 00 00 00 00 00 00 0a 64 00 00 00 00 00 00 00 00 00 7d 00 00 00 00 00 00 00 20
unsigned char dir1[64] = { 0xcc, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x64, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, };
if(64 != writeUsb(dir1))
return 1;
//cc2804
if(64 != writeUsb(end_alt_transaction))
return 1;
printf("\rWave 2 (Sync) sequence sent\n");
return 0;
}

View file

@ -1,10 +1,10 @@
int writeUsb(unsigned char *message){
#ifndef DEBUG
#ifndef DEBUG
printf("\r%02d / %02d (write)", ++counter, limit);
#endif
#ifdef DEBUG
#endif
#ifdef DEBUG
print_array(message, 64);
#endif
#endif
int ret = libusb_control_transfer(dev_handle, 0x21, 9, 0x03cc, 1, message, 64, TIMEOUT);
if(ret != 64){
printf("\nFailure: %d\n", ret);
@ -14,9 +14,9 @@ int writeUsb(unsigned char *message){
}
int readUsb(){
#ifndef DEBUG
#ifndef DEBUG
printf("\r%02d / %02d (read)", ++counter, limit);
#endif
#endif
unsigned char buffer[64] = {};
int ret = libusb_control_transfer(dev_handle, 0xa1, 1, 0x03cc, 1, buffer, 64, TIMEOUT);
@ -25,9 +25,9 @@ int readUsb(){
print_array(buffer, 64);
}
#ifdef DEBUG
#ifdef DEBUG
printf("INPUT REQUEST\n");
#endif
#endif
return ret;
}