webosbrew / hyperion.ng-webos-loader

11 stars 7 forks source link

autostart: If executed too early, starting hyperiond fails #1

Closed tuxuser closed 2 years ago

tuxuser commented 2 years ago

Problem

When the luna-command to the /start endpoint is sent too early after bootup (e.g. by executing it as part of init.d/ scripts), startup of the hyperiond service fails with the error response below.

See: https://github.com/webosbrew/hyperion.ng-webos-loader/blob/master/assets/autostart.sh

Command

luna-send -n 1 -f 'luna://org.webosbrew.hyperion.ng.loader.service/start' '{}'

Response

{
    "errorCode": -1,
    "returnValue": false,
    "errorText": "Message status unknown."
}

Expected response

{
    "result": "2022-03-11T22:03:33.215 |__| DAEMON            : <DEBUG> hyperiond.cpp:822:createCecHandler() | The CEC handler is not supported on this platform\n2022-03-11T22:03:33.336 |I0| SETTINGSMGR       : <DEBUG> SettingsManager.cpp:186:SettingsManager() | Settings database initialized\n2022-03-11T22:03:33.363 |I0| BLACKBORDER       : <DEBUG> BlackBorderProcessor.cpp:72:handleSettingsUpdate() | Set mode to: default\n2022-03-11T22:03:33.363 |I0| COMPONENTREG      : <DEBUG> ComponentRegister.cpp:82:setNewComponentState() | Blackborder detector: enabled\n2022-03-11T22:03:33.408 |__| DAEMON            : <INFO> No platform capture supported on this platform\n2022-03-11T22:03:33.409 |__| DAEMON            : <DEBUG> hyperiond.cpp:735:createGrabberQt() | The Qt grabber is not supported on this platform\n2022-03-11T22:03:33.410 |__| DAEMON            : <DEBUG> hyperiond.cpp:636:handleSettingsUpdate() | The v4l2 grabber is not supported on this platform\n2022-03-11T22:03:33.413 |__| JSONSERVER        : <DEBUG> JsonServer.cpp:28:JsonServer() | Created instance\n2022-03-11T22:03:33.417 |__| JSONSERVER        : <INFO> Started on port 19444\n2022-03-11T22:03:33.419 |__| FLATBUFSERVER     : <INFO> Started on port 19400\n2022-03-11T22:03:33.420 |__| WEBSERVER         : <DEBUG> WebServer.cpp:33:initServer() | Initialize Webserver\n2022-03-11T22:03:33.420 |__| WEBSERVER         : <DEBUG> WebServer.cpp:33:initServer() | Initialize Webserver\n2022-03-11T22:03:33.425 |I0| COMPONENTREG      : <DEBUG> ComponentRegister.cpp:82:setNewComponentState() | Smoothing: enabled\n2022-03-11T22:03:33.425 |I0| SMOOTHING         : <DEBUG> LinearColorSmoothing.cpp:685:selectConfig() | cfg [0]:  Type: linear - Time: 200 ms, outputRate 25.000000 Hz, interpolationRate: 25.000000 Hz, timer: 40 ms, Dithering: 0, Decay: 1.000000 -> HalfTime: 100.000000 ms\n2022-03-11T22:03:33.426 |I0| SMOOTHING         : <DEBUG> LinearColorSmoothing.cpp:685:selectConfig() | Previous line repeats 1 times\n2022-03-11T22:03:33.427 |I0| MUXER             : <DEBUG> PriorityMuxer.cpp:177:registerInput() | Register new input 'System/COLOR' () with priority 1 as inactive\n2022-03-11T22:03:33.427 |I0| MUXER             : <DEBUG> PriorityMuxer.cpp:401:updatePriorities() | Set visible priority to 1\n2022-03-11T22:03:33.427 |I0| HYPERION          : <DEBUG> Hyperion.cpp:632:handleSourceAvailability() | new source available -> Resume output processing and switch LED-Device on\n2022-03-11T22:03:33.429 |I0| HYPERION          : <INFO> Initial foreground color set (0 0 255)\n2022-03-11T22:03:33.431 |I0| LEDDEVICE         : <INFO> Start LedDevice 'adalight'.\n2022-03-11T22:03:33.432 |I0| BOBLIGHT          : <DEBUG> BoblightServer.cpp:31:BoblightServer() | Instance created\n2022-03-11T22:03:33.436 |__| HYPERION-INSTMGR  : <INFO> Hyperion instance 'First LED Hardware instance' has been started\n2022-03-11T22:03:33.438 |I0| LEDDEVICE         : <DEBUG> LedDevice.cpp:148:init() | deviceConfig: [{\"colorOrder\":\"rgb\",\"currentLedCount\":225,\"delayAfterConnect\":0,\"hardwareLedCount\":225,\"latchTime\":30,\"lightberry_apa102_mode\":false,\"output\":\"ttyACM0\",\"rate\":115200,\"rewriteTime\":1000,\"type\":\"adalight\"}]\n2022-03-11T22:03:33.440 |I0| LEDDEVICE         : <DEBUG> LedDevice.cpp:414:setLatchTime() | LatchTime updated to 30ms\n2022-03-11T22:03:33.440 |I0| LEDDEVICE         : <DEBUG> LedDevice.cpp:439:setRewriteTime() | Refresh interval = 1000ms\n2022-03-11T22:03:33.441 |I0| LEDDEVICE         : <DEBUG> LedDevice.cpp:445:setRewriteTime() | RewriteTime updated to 1000ms\n2022-03-11T22:03:33.442 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:48:init() | DeviceType   : adalight\n2022-03-11T22:03:33.442 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:49:init() | LedCount     : 225\n2022-03-11T22:03:33.443 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:50:init() | ColorOrder   : rgb\n2022-03-11T22:03:33.443 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:51:init() | RefreshTime  : 1000\n2022-03-11T22:03:33.444 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:52:init() | LatchTime    : 30\n2022-03-11T22:03:33.449 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:73:init() | DeviceName   : ttyACM0\n2022-03-11T22:03:33.451 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:75:init() | AutoDevice   : 0\n2022-03-11T22:03:33.453 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:76:init() | baudRate_Hz  : 115200\n2022-03-11T22:03:33.454 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:77:init() | delayAfCon ms: 0\n2022-03-11T22:03:33.455 |I0| LEDDEVICE         : <DEBUG> LedDeviceAdalight.cpp:58:init() | Adalight header for 225 leds: Ada 0x00 0xe0 0xb5\n2022-03-11T22:03:33.456 |I0| LEDDEVICE         : <INFO> Opening UART: ttyACM0\n2022-03-11T22:03:33.457 |I0| LEDDEVICE         : <DEBUG> ProviderRs232.cpp:170:tryOpen() | _rs232Port.open(QIODevice::ReadWrite): ttyACM0, Baud rate [115200]bps\n2022-03-11T22:03:33.461 |__| WEBSERVER         : <DEBUG> WebServer.cpp:92:handleSettingsUpdate() | Apply Webserver settings\n2022-03-11T22:03:33.461 |__| WEBSERVER         : <DEBUG> WebServer.cpp:110:handleSettingsUpdate() | Set document root to: :/webconfig\n2022-03-11T22:03:33.462 |__| WEBSERVER         : <DEBUG> WebServer.cpp:92:handleSettingsUpdate() | Apply Webserver settings\n2022-03-11T22:03:33.462 |__| WEBSERVER         : <DEBUG> WebServer.cpp:110:handleSettingsUpdate() | Set document root to: :/webconfig\n2022-03-11T22:03:33.463 |__| WEBSERVER         : <INFO> 'Hyperion Webserver' started on port 8090\n",
    "returnValue": true
}

Could it be overflowing the response body?? :thinking:

tuxuser commented 2 years ago

Fixed by using a native service instead of JS.