mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user