[hal] Use better error for when console out is enabled while attempting to use onboard serial port (#3622)

This commit is contained in:
Thad House
2021-10-10 15:52:50 -07:00
committed by GitHub
parent cc31079a11
commit d347928e4d
4 changed files with 12 additions and 0 deletions

View File

@@ -84,6 +84,9 @@ HAL_SerialPortHandle HAL_InitializeSerialPortDirect(HAL_SerialPort port,
serialPort->portId = open(portName, O_RDWR | O_NOCTTY);
if (serialPort->portId < 0) {
*status = errno;
if (*status == EACCES) {
*status = HAL_CONSOLE_OUT_ENABLED_ERROR;
}
serialPortHandles->Free(handle);
return HAL_kInvalidHandle;
}