LED-Device updates (#1315)

* SPI Fix - Free allocated memory in case of invert

* Remove development statement

* UI updates

* Minor corrections

* Tpm2net Fix - Free allocated memory

* LGTM Finding

* Add config directory and user type to SysInfo

* WS281x - Ensure that device runs with root priviliges

* WS281x - Update DMA defauls as per rpi_ws281x recommendation

* Support Sysinfo for Qt < 5.10

* Address LGTM finding
This commit is contained in:
LordGrey
2021-09-15 10:31:56 +02:00
committed by GitHub
parent 8fb3d76b9c
commit 8a785e70c8
18 changed files with 214 additions and 53 deletions

View File

@@ -144,12 +144,14 @@ int ProviderSpi::writeBytes(unsigned size, const uint8_t * data)
return -1;
}
uint8_t * newdata {nullptr};
_spi.tx_buf = __u64(data);
_spi.len = __u32(size);
if (_spiDataInvert)
{
uint8_t * newdata = (uint8_t *)malloc(size);
newdata = static_cast<uint8_t *>(malloc(size));
for (unsigned i = 0; i<size; i++) {
newdata[i] = data[i] ^ 0xff;
}
@@ -159,6 +161,8 @@ int ProviderSpi::writeBytes(unsigned size, const uint8_t * data)
int retVal = ioctl(_fid, SPI_IOC_MESSAGE(1), &_spi);
ErrorIf((retVal < 0), _log, "SPI failed to write. errno: %d, %s", errno, strerror(errno) );
free (newdata);
return retVal;
}