| 85 | } |
| 86 | |
| 87 | bool ZotacV2GPUController::GetMode(int zone, int idleActive, int& syncMode, ZotacV2GPUZone& zoneConfig, bool& on) |
| 88 | { |
| 89 | u8 data_pkt[] = |
| 90 | { |
| 91 | ZOTAC_V2_GPU_REG_RGB, |
| 92 | 0xF0, |
| 93 | 0x00, |
| 94 | 0x00, |
| 95 | 0x00, |
| 96 | (u8)idleActive, |
| 97 | (u8)zone, |
| 98 | 0x00, |
| 99 | }; |
| 100 | |
| 101 | if(bus->i2c_write_block(dev, sizeof(data_pkt), data_pkt) < 0) |
| 102 | { |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | |
| 107 | u8 rdata_pkt[I2C_SMBUS_BLOCK_MAX] = { 0x00 }; |
| 108 | int rdata_len = sizeof(rdata_pkt); |
| 109 | if(bus->i2c_read_block(dev, &rdata_len, rdata_pkt) < 0) |
| 110 | { |
| 111 | return false; |
| 112 | } |
| 113 | |
| 114 | bool readReset; |
| 115 | int readZone; |
| 116 | int readIdleActive; |
| 117 | if(!ParseCommand(on, readReset, readZone, readIdleActive, syncMode, zoneConfig)) |
| 118 | { |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | if(readReset != 0) |
| 123 | { |
| 124 | LOG_WARNING("Reset byte was not 0?!"); |
| 125 | } |
| 126 | |
| 127 | if(readZone != zone || readIdleActive != idleActive) |
| 128 | { |
| 129 | LOG_WARNING("Got unexpected data - expected to recieve data for (%d, %d) but got for (%d, %d)", zone, idleActive, readZone, readIdleActive); |
| 130 | return false; |
| 131 | } |
| 132 | |
| 133 | return true; |
| 134 | } |
| 135 | |
| 136 | bool ZotacV2GPUController::SendCommand(bool on, bool reset, int zone, int idleActive, int syncMode, ZotacV2GPUZone zoneConfig) |
| 137 | { |
no test coverage detected