Extend logging and error reporting (#1149)

- ProviderRs232: Be more verbose about correct device in error case
Rearrange Debug Information and additionalclean-ups

- Webconfig: better error description, if Kodi is not found
This commit is contained in:
Gerion Entrup 2021-02-23 20:40:20 +01:00 committed by GitHub
parent 2b66754997
commit 74a6795991
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 16 deletions

View File

@ -869,7 +869,7 @@
"wiz_cc_chooseid": "Wähle einen Namen für dieses Farb-Profil.", "wiz_cc_chooseid": "Wähle einen Namen für dieses Farb-Profil.",
"wiz_cc_intro1": "Der Assistent wird dich durch die Kalibrierung deiner LEDs leiten. Sofern du Kodi nutzt, können die Bilder und Testvideos direkt an Kodi geschickt werden. Andernfalls musst du das Material selbst herunterladen und anwenden.", "wiz_cc_intro1": "Der Assistent wird dich durch die Kalibrierung deiner LEDs leiten. Sofern du Kodi nutzt, können die Bilder und Testvideos direkt an Kodi geschickt werden. Andernfalls musst du das Material selbst herunterladen und anwenden.",
"wiz_cc_kodicon": "Kodi Webserver gefunden, fahre mit Kodi-Unterstützung fort.", "wiz_cc_kodicon": "Kodi Webserver gefunden, fahre mit Kodi-Unterstützung fort.",
"wiz_cc_kodidiscon": "Kodi Webserver nicht gefunden, fahre ohne Kodi-Unterstützung fort.", "wiz_cc_kodidiscon": "Kodi Webserver nicht gefunden, fahre ohne Kodi-Unterstützung fort (prüfe, ob Fernsteuerung durch Programme auf anderen Rechnern erlaubt ist).",
"wiz_cc_kodidisconlink": "Download Link Bilder:", "wiz_cc_kodidisconlink": "Download Link Bilder:",
"wiz_cc_kodimsg_start": "Test bestanden - Zeit zu beginnen", "wiz_cc_kodimsg_start": "Test bestanden - Zeit zu beginnen",
"wiz_cc_kodishould": "Kodi sollte jetzt folgendes Bild anzeigen: $1", "wiz_cc_kodishould": "Kodi sollte jetzt folgendes Bild anzeigen: $1",

View File

@ -871,7 +871,7 @@
"wiz_cc_chooseid": "Define a name for this color profile.", "wiz_cc_chooseid": "Define a name for this color profile.",
"wiz_cc_intro1": "This wizard will guide you through your led calibration. If you are using Kodi, the calibration pictures and videos can be sent directly to it. Prerequisite: You need to enable \"Allow remote control from applications on other systems\" in Kodi.<br />Alternatively, you might want downloading these files yourself and display them when the wizard asks you to adjust the setting.", "wiz_cc_intro1": "This wizard will guide you through your led calibration. If you are using Kodi, the calibration pictures and videos can be sent directly to it. Prerequisite: You need to enable \"Allow remote control from applications on other systems\" in Kodi.<br />Alternatively, you might want downloading these files yourself and display them when the wizard asks you to adjust the setting.",
"wiz_cc_kodicon": "Kodi found, proceed with Kodi support.", "wiz_cc_kodicon": "Kodi found, proceed with Kodi support.",
"wiz_cc_kodidiscon": "Kodi not found, proceed without Kodi support.", "wiz_cc_kodidiscon": "Kodi not found, proceed without Kodi support (please check, if remote control by other systems is activated).",
"wiz_cc_kodidisconlink": "Download link pictures:", "wiz_cc_kodidisconlink": "Download link pictures:",
"wiz_cc_kodimsg_start": "Test success - time to proceed!", "wiz_cc_kodimsg_start": "Test success - time to proceed!",
"wiz_cc_kodishould": "Kodi should show the following picture: $1", "wiz_cc_kodishould": "Kodi should show the following picture: $1",

View File

@ -43,7 +43,9 @@ bool ProviderRs232::init(const QJsonObject &deviceConfig)
// If device name was given as unix /dev/ system-location, get port name // If device name was given as unix /dev/ system-location, get port name
if ( _deviceName.startsWith(QLatin1String("/dev/")) ) if ( _deviceName.startsWith(QLatin1String("/dev/")) )
{
_deviceName = _deviceName.mid(5); _deviceName = _deviceName.mid(5);
}
_isAutoDeviceName = _deviceName.toLower() == "auto"; _isAutoDeviceName = _deviceName.toLower() == "auto";
_baudRate_Hz = deviceConfig["rate"].toInt(); _baudRate_Hz = deviceConfig["rate"].toInt();
@ -141,18 +143,16 @@ bool ProviderRs232::tryOpen(int delayAfterConnect_ms)
Debug(_log, "_rs232Port.open(QIODevice::ReadWrite): %s, Baud rate [%d]bps", QSTRING_CSTR(_deviceName), _baudRate_Hz); Debug(_log, "_rs232Port.open(QIODevice::ReadWrite): %s, Baud rate [%d]bps", QSTRING_CSTR(_deviceName), _baudRate_Hz);
QSerialPortInfo serialPortInfo(_deviceName); QSerialPortInfo serialPortInfo(_deviceName);
if (!serialPortInfo.isNull() )
QJsonObject portInfo; {
Debug(_log, "portName: %s", QSTRING_CSTR(serialPortInfo.portName())); Debug(_log, "portName: %s", QSTRING_CSTR(serialPortInfo.portName()));
Debug(_log, "systemLocation: %s", QSTRING_CSTR(serialPortInfo.systemLocation())); Debug(_log, "systemLocation: %s", QSTRING_CSTR(serialPortInfo.systemLocation()));
Debug(_log, "description: %s", QSTRING_CSTR(serialPortInfo.description())); Debug(_log, "description: %s", QSTRING_CSTR(serialPortInfo.description()));
Debug(_log, "manufacturer: %s", QSTRING_CSTR(serialPortInfo.manufacturer())); Debug(_log, "manufacturer: %s", QSTRING_CSTR(serialPortInfo.manufacturer()));
Debug(_log, "productIdentifier: %s", QSTRING_CSTR(QString("0x%1").arg(serialPortInfo.productIdentifier(), 0, 16)));
Debug(_log, "vendorIdentifier: %s", QSTRING_CSTR(QString("0x%1").arg(serialPortInfo.vendorIdentifier(), 0, 16))); Debug(_log, "vendorIdentifier: %s", QSTRING_CSTR(QString("0x%1").arg(serialPortInfo.vendorIdentifier(), 0, 16)));
Debug(_log, "productIdentifier: %s", QSTRING_CSTR(QString("0x%1").arg(serialPortInfo.productIdentifier(), 0, 16)));
Debug(_log, "serialNumber: %s", QSTRING_CSTR(serialPortInfo.serialNumber())); Debug(_log, "serialNumber: %s", QSTRING_CSTR(serialPortInfo.serialNumber()));
if (!serialPortInfo.isNull() )
{
if ( !_rs232Port.open(QIODevice::ReadWrite) ) if ( !_rs232Port.open(QIODevice::ReadWrite) )
{ {
this->setInError(_rs232Port.errorString()); this->setInError(_rs232Port.errorString());
@ -163,6 +163,18 @@ bool ProviderRs232::tryOpen(int delayAfterConnect_ms)
{ {
QString errortext = QString("Invalid serial device name: [%1]!").arg(_deviceName); QString errortext = QString("Invalid serial device name: [%1]!").arg(_deviceName);
this->setInError( errortext ); this->setInError( errortext );
// List available device
for (auto &port : QSerialPortInfo::availablePorts() ) {
Debug(_log, "Avail. serial device: [%s]-(%s|%s), Manufacturer: %s, Description: %s",
QSTRING_CSTR(port.portName()),
QSTRING_CSTR(QString("0x%1").arg(port.vendorIdentifier(), 0, 16)),
QSTRING_CSTR(QString("0x%1").arg(port.productIdentifier(), 0, 16)),
QSTRING_CSTR(port.manufacturer()),
QSTRING_CSTR(port.description())
);
}
return false; return false;
} }
} }
@ -215,7 +227,7 @@ int ProviderRs232::writeBytes(const qint64 size, const uint8_t *data)
{ {
if ( _rs232Port.error() == QSerialPort::TimeoutError ) if ( _rs232Port.error() == QSerialPort::TimeoutError )
{ {
Debug(_log, "Timeout after %dms: %d frames already dropped", WRITE_TIMEOUT, _frameDropCounter); Debug(_log, "Timeout after %dms: %d frames already dropped", WRITE_TIMEOUT.count(), _frameDropCounter);
++_frameDropCounter; ++_frameDropCounter;
@ -245,7 +257,7 @@ int ProviderRs232::writeBytes(const qint64 size, const uint8_t *data)
QString ProviderRs232::discoverFirst() QString ProviderRs232::discoverFirst()
{ {
// take first available USB serial port - currently no probing! // take first available USB serial port - currently no probing!
for (auto const & port : QSerialPortInfo::availablePorts()) for (auto & port : QSerialPortInfo::availablePorts())
{ {
if (!port.isNull() && !port.isBusy()) if (!port.isNull() && !port.isBusy())
{ {
@ -266,7 +278,7 @@ QJsonObject ProviderRs232::discover(const QJsonObject& /*params*/)
// Discover serial Devices // Discover serial Devices
for (auto &port : QSerialPortInfo::availablePorts() ) for (auto &port : QSerialPortInfo::availablePorts() )
{ {
if ( !port.isNull() ) if ( !port.isNull() && !port.portName().startsWith("ttyS"))
{ {
QJsonObject portInfo; QJsonObject portInfo;
portInfo.insert("description", port.description()); portInfo.insert("description", port.description());