Index: denali.qrc =================================================================== diff -u -r288fa90973888a57056998a7d645034b063ef893 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- denali.qrc (.../denali.qrc) (revision 288fa90973888a57056998a7d645034b063ef893) +++ denali.qrc (.../denali.qrc) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -19,6 +19,7 @@ sources/gui/qml/pages/settings/SettingsDeviceRegistration.qml sources/gui/qml/pages/settings/SettingsInformation.qml sources/gui/qml/pages/settings/SettingsROInput.qml + sources/gui/qml/pages/settings/SettingsRootSSHAccess.qml sources/gui/qml/pages/settings/SettingsServicePassword.qml sources/gui/qml/pages/settings/SettingsManufacturingSetup.qml Index: scripts/rootsshaccess_get.sh =================================================================== diff -u --- scripts/rootsshaccess_get.sh (revision 0) +++ scripts/rootsshaccess_get.sh (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -0,0 +1,25 @@ +#!/bin/sh +########################################################################### +# +# Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file rootsshaccess_get.sh +# +# @author (last) Behrouz NematiPour +# @date (last) 17-Jun-2023 +# @author (original) Behrouz NematiPour +# @date (original) 17-Jun-2023 +# +############################################################################ + +SSHD_CONFIG="/etc/ssh/sshd_config" + +if [ "$(grep -ir "^PermitRootLogin" $SSHD_CONFIG | tr -s ' ' | cut -f2 -d' ')" == "yes" ]; then + echo 1 +else + echo 0 +fi +exit 0 Index: scripts/rootsshaccess_set.sh =================================================================== diff -u --- scripts/rootsshaccess_set.sh (revision 0) +++ scripts/rootsshaccess_set.sh (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -0,0 +1,34 @@ +#!/bin/sh +########################################################################### +# +# Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file rootsshaccess_set.sh +# +# @author (last) Behrouz NematiPour +# @date (last) 17-Jun-2023 +# @author (original) Behrouz NematiPour +# @date (original) 17-Jun-2023 +# +############################################################################ + + +SSHD_CONFIG="/etc/ssh/sshd_config" +ERR_EXECUTION=201 + +if [ "$1" == "YES" ]; then + sed -i '/PermitRootLogin/c\PermitRootLogin yes' $SSHD_CONFIG +else + sed -i '/PermitRootLogin/c\PermitRootLogin no' $SSHD_CONFIG +fi + +if [ $? != 0 ]; then + echo "Execution Failed" + exit $ERR_EXECUTION +fi + +echo "" +exit 0 Index: sources/ApplicationController.cpp =================================================================== diff -u -r114e1def79a9c9d469c531b33f4514550ff113e7 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision 114e1def79a9c9d469c531b33f4514550ff113e7) +++ sources/ApplicationController.cpp (.../ApplicationController.cpp) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -574,7 +574,7 @@ emit didPOSTWireless (vPass); emit didPOSTWirelessData(_post.macWireless()); - qDebug() << " ---------- " << _post.macWireless(); + //DEBUG qDebug() << " ---------- " << _post.macWireless(); } /*! Index: sources/cloudsync/CloudSyncController.cpp =================================================================== diff -u -r6d76149dca70e879f33bf6ed44203d0d06bc523a -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision 6d76149dca70e879f33bf6ed44203d0d06bc523a) +++ sources/cloudsync/CloudSyncController.cpp (.../CloudSyncController.cpp) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -854,7 +854,7 @@ if ( mTxCode.isEmpty() ) { toLog(eError_TxCodeEmpty , {}); ok = false; goto lOut; } emit didTxCodeReceive ( mTxCode ); - qDebug() << " ---------- " << mTxCode; + //DEBUG qDebug() << " ---------- " << mTxCode; lOut: return ok; Index: sources/device/DeviceController.cpp =================================================================== diff -u -r1da89b0452b8ef9448847618e75c118f3f58bd0c -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision 1da89b0452b8ef9448847618e75c118f3f58bd0c) +++ sources/device/DeviceController.cpp (.../DeviceController.cpp) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -565,6 +565,74 @@ } } + +///////////////////////////////////////////// DeviceRootSSHAccess +/*! + * \brief DeviceController::onAttributeRequest + * \details Sets the RootSSHAccess + * \param vRootSSHAccess + */ +void DeviceController::onAttributeRequest(const DeviceRootSSHAccessRequestData &vData) +{ + // ----- initializing the member variable models + _deviceRootSSHAccessRequest._data = vData; + LOG_APPED( _deviceRootSSHAccessRequest.toString()); + + // ----- check that script exists. + QString script; + if ( checkError( DeviceError::checkScript(script, vData.mIsGet ? RootSSHAccess_Get : RootSSHAccess_Set), _deviceRootSSHAccessResponse, script) ) + return; + + // ----- check if the process is not running + if ( _processRootSSHAccess.state() != QProcess::NotRunning ) { + checkError(DeviceError::eDevice_Scripts_Error_IsRunning, _deviceRootSSHAccessResponse); + return; + } + + // ----- run the process + + TimedProcess *timedProcess = new TimedProcess(&_processRootSSHAccess, script, 1000, { _deviceRootSSHAccessRequest._data.mRootSSHAccess ? "YES": "no" }); + timedProcess->start(); +} + +/*! + * \brief DeviceController::onProcessRootSSHAccessFinished + * \details Called when the process to set the RootSSHAccess has finished + * \param vExitCode (int) the exit code + * \note exit code -> 0 : set Accept [MBase] -> Log -> emit + * !0 : set Attrib [MBrgh] -> Log -> emit + * 1 - get an error when in onAttributeRequest : scriptErrorText([Gui Enum ]) + * 2 - get an error when in onProcessRootSSHAccessExitCode : scriptErrorText([vExitCode]) + * 3 - get no error when in onProcessRootSSHAccessExitCode : MDeviceResponse.toString() + * - in case 3 the specific model _data has to be filled prior to the toString to have it in the log. + */ +void DeviceController::onProcessRootSSHAccessExitCode(int vExitCode, QProcess::ExitStatus) +{ + if ( ! checkError(static_cast(vExitCode), _deviceRootSSHAccessResponse, _deviceRootSSHAccessResponse.toString()) ) { // has no error + if (_deviceRootSSHAccessRequest._data.mIsGet) { + bool ok = false; + bool rootSSHAccess = _processRootSSHAccess.readLine().toUInt(&ok); + if ( ok ) { + _deviceRootSSHAccessResponse._data.mMessage = _deviceRootSSHAccessResponse.toString(); + _deviceRootSSHAccessResponse._data.mRootSSHAccess = rootSSHAccess; + } + else { + checkError(DeviceError::eDevice_Scripts_Error_Incorrect_Rsp, _deviceRootSSHAccessResponse, _deviceRootSSHAccessResponse.toString()); + return; + } + } + else { + _deviceRootSSHAccessResponse._data.mMessage = _deviceRootSSHAccessResponse.toString(); + _deviceRootSSHAccessResponse._data.mRootSSHAccess = _deviceRootSSHAccessRequest._data.mRootSSHAccess; + } + LOG_APPED(_deviceRootSSHAccessResponse._data.mMessage); + emit didAttributeResponse(_deviceRootSSHAccessResponse._data); + } + else { + // the error in this case is handled in the checkError + } +} + ///////////////////////////////////////////// DeviceCryptSetup /*! * \brief DeviceController::onAttributeRequest @@ -573,7 +641,7 @@ */ void DeviceController::onAttributeRequest(const DeviceCryptSetupRequestData &vData) { - qDebug() << " ---------- " << vData.mCommand << vData.mPassword; + //DEBUG qDebug() << " ---------- " << vData.mCommand << vData.mPassword; _deviceCryptSetupRequest._data = vData; @@ -754,7 +822,7 @@ void DeviceController::onEventThreadChange() { - qDebug() << " ---------- " << __FUNCTION__ << QThread::currentThread()->objectName() << QThread::currentThread() << qApp->thread(); + //DEBUG qDebug() << " ---------- " << __FUNCTION__ << QThread::currentThread()->objectName() << QThread::currentThread() << qApp->thread(); if ( QThread::currentThread() != &Threads::_DeviceController_Thread ) { qCritical() << " ***** Device controller thread not initialized correctly ***** "; return; Index: sources/device/DeviceController.h =================================================================== diff -u -r1da89b0452b8ef9448847618e75c118f3f58bd0c -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/device/DeviceController.h (.../DeviceController.h) (revision 1da89b0452b8ef9448847618e75c118f3f58bd0c) +++ sources/device/DeviceController.h (.../DeviceController.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -231,7 +231,8 @@ */ void didSDCardSpaceTooLow(quint8 vAvailablePercent); - void didActionReceive( const DeviceBrightnessResponseData &vBrightness ); + void didActionReceive( const DeviceBrightnessResponseData &vBrightness ); + void didActionReceive( const DeviceRootSSHAccessResponseData &vRootSSHAccess); void didWatchFileChange(const QString &vFile); Index: sources/device/DeviceError.h =================================================================== diff -u -r0e122c98700951af539d9f47c5578e26d640fcc7 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/device/DeviceError.h (.../DeviceError.h) (revision 0e122c98700951af539d9f47c5578e26d640fcc7) +++ sources/device/DeviceError.h (.../DeviceError.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -38,7 +38,7 @@ public: enum Scripts_Error_Enum { - eDevice_OK = 0 , + eDevice_OK = 0 , // The scripts can use the exit code of each commands they execute and the assumption is most of Linux commands exit codes are less than 1000. // so any error less that 1000 will be identified as device error Index: sources/device/DeviceGlobals.h =================================================================== diff -u -r389f028cb9d4d320eae393de7c4408a58a619356 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/device/DeviceGlobals.h (.../DeviceGlobals.h) (revision 389f028cb9d4d320eae393de7c4408a58a619356) +++ sources/device/DeviceGlobals.h (.../DeviceGlobals.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -175,49 +175,57 @@ DEVICE_DEV_PARENT ( BluetoothPairedReset ) \ DEVICE_DEV_PARENT ( BluetoothPairedQuery ) \ DEVICE_DEV_PARENT ( CryptSetup ) \ + DEVICE_DEV_PARENT ( RootSSHAccess ) \ #define DEVICE_DEV_INIT_CONNECTIONS_LIST \ DEVICE_DEV_INIT_CONNECTIONS ( Brightness ) \ DEVICE_DEV_INIT_CONNECTIONS ( BluetoothPairedReset ) \ DEVICE_DEV_INIT_CONNECTIONS ( BluetoothPairedQuery ) \ DEVICE_DEV_INIT_CONNECTIONS ( CryptSetup ) \ + DEVICE_DEV_INIT_CONNECTIONS ( RootSSHAccess ) \ #define DEVICE_DEV_DEFINITION_LIST \ DEVICE_DEV_DEFINITION ( Brightness ) \ DEVICE_DEV_DEFINITION ( BluetoothPairedReset ) \ DEVICE_DEV_DEFINITION ( BluetoothPairedQuery ) \ DEVICE_DEV_DEFINITION ( CryptSetup ) \ + DEVICE_DEV_DEFINITION ( RootSSHAccess ) \ /* ---------------------------- APP */ #define DEVICE_APP_INIT_CONNECTIONS_LIST \ DEVICE_APP_INIT_CONNECTIONS ( Brightness ) \ DEVICE_APP_INIT_CONNECTIONS ( BluetoothPairedReset ) \ DEVICE_APP_INIT_CONNECTIONS ( BluetoothPairedQuery ) \ DEVICE_APP_INIT_CONNECTIONS ( CryptSetup ) \ + DEVICE_APP_INIT_CONNECTIONS ( RootSSHAccess ) \ #define DEVICE_APP_BRIDGE_DEFINITION_LIST \ DEVICE_APP_BRIDGE_DEFINITION( Brightness ) \ DEVICE_APP_BRIDGE_DEFINITION( BluetoothPairedReset ) \ DEVICE_APP_BRIDGE_DEFINITION( BluetoothPairedQuery ) \ DEVICE_APP_BRIDGE_DEFINITION( CryptSetup ) \ + DEVICE_APP_BRIDGE_DEFINITION( RootSSHAccess ) \ /* ---------------------------- GUI */ #define DEVICE_GUI_BRIDGE_DEFINITION_LIST \ DEVICE_GUI_BRIDGE_DEFINITION( Brightness ) \ DEVICE_GUI_BRIDGE_DEFINITION( BluetoothPairedReset ) \ DEVICE_GUI_BRIDGE_DEFINITION( BluetoothPairedQuery ) \ DEVICE_GUI_BRIDGE_DEFINITION( CryptSetup ) \ + DEVICE_GUI_BRIDGE_DEFINITION( RootSSHAccess ) \ #define DEVICE_GUI_INIT_CONNECTIONS_LIST \ DEVICE_GUI_INIT_CONNECTIONS ( Brightness ) \ DEVICE_GUI_INIT_CONNECTIONS ( BluetoothPairedReset ) \ DEVICE_GUI_INIT_CONNECTIONS ( BluetoothPairedQuery ) \ DEVICE_GUI_INIT_CONNECTIONS ( CryptSetup ) \ + DEVICE_GUI_INIT_CONNECTIONS ( RootSSHAccess ) \ /* ---------------------------- VIEW */ #define DEVICE_VIEW_INIT_CONNECTIONS_LIST \ DEVICE_VIEW_INIT_CONNECTIONS( Brightness ) \ DEVICE_VIEW_INIT_CONNECTIONS( BluetoothPairedReset ) \ DEVICE_VIEW_INIT_CONNECTIONS( BluetoothPairedQuery ) \ DEVICE_VIEW_INIT_CONNECTIONS( CryptSetup ) \ + DEVICE_VIEW_INIT_CONNECTIONS( RootSSHAccess ) \ Index: sources/device/DeviceModels.h =================================================================== diff -u -r0e122c98700951af539d9f47c5578e26d640fcc7 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/device/DeviceModels.h (.../DeviceModels.h) (revision 0e122c98700951af539d9f47c5578e26d640fcc7) +++ sources/device/DeviceModels.h (.../DeviceModels.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -244,10 +244,43 @@ bool fromByteArray(const QByteArray &vByteArray, int *vExitCode = nullptr) override; }; +// ---------- MDeviceRootSSHAccess ---------- // +/*! + * \brief The MDeviceRootSSHAccessRequest class + * \details The model for the device RootSSHAccess value modification request. + */ +class MDeviceRootSSHAccessRequest : public MDeviceRequestBase { +public: + struct Data { + bool mRootSSHAccess = false; + bool mIsGet = true ; + } _data; + + QString toString() { + return MDeviceRequestBase::toString("RootSSHAccess", { _data.mRootSSHAccess }); + } +}; + +/*! + * \brief The MDeviceRootSSHAccessResponse class + * \details The model for the device RootSSHAccess value request. + */ +class MDeviceRootSSHAccessResponse : public MDeviceResponseBase { +public: + struct Data : MDeviceResponseBase::Data { + bool mRootSSHAccess = false; + } _data; + + QVariantList parameters () const override { return { _data.mRootSSHAccess }; } + QString infoText () const override { return QString("RootSSHAccess"); } + Data data () const { return _data; } +}; + } typedef Model::MDeviceResponseBase ::Data DeviceResponseBaseData ; + typedef Model::MDeviceBrightnessRequest ::Data DeviceBrightnessRequestData ; typedef Model::MDeviceBrightnessResponse::Data DeviceBrightnessResponseData ; @@ -259,3 +292,6 @@ typedef Model::MDeviceCryptSetupRequest ::Data DeviceCryptSetupRequestData ; typedef Model::MDeviceCryptSetupResponse::Data DeviceCryptSetupResponseData; + +typedef Model::MDeviceRootSSHAccessRequest ::Data DeviceRootSSHAccessRequestData ; +typedef Model::MDeviceRootSSHAccessResponse::Data DeviceRootSSHAccessResponseData ; Index: sources/device/DeviceView.cpp =================================================================== diff -u -r389f028cb9d4d320eae393de7c4408a58a619356 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision 389f028cb9d4d320eae393de7c4408a58a619356) +++ sources/device/DeviceView.cpp (.../DeviceView.cpp) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -144,3 +144,38 @@ emit bluetoothPairedQueryChanged(vData.mInfo); response(true); } + +/// ---------- RootSSHAccess +void VDevice::doInitRootSSHAccess() { + // DEBUG : qDebug() << "HERE Request" << vValue; + DeviceRootSSHAccessRequestData data; + data.mIsGet = true; + emit didAttributeRequest(data); +} + +void VDevice::rootSSHAccessRequest(const bool &vValue) { + // DEBUG : qDebug() << "HERE Request" << vValue; + DeviceRootSSHAccessRequestData data; + data.mIsGet = false; + data.mRootSSHAccess = vValue; + emit didAttributeRequest(data); +} + +void VDevice::onAttributeResponse(const DeviceRootSSHAccessResponseData &vData) { + // DEBUG : qDebug() << "HERE Response" << vData.mBrightnessPercent; + if ( vData.mAccepted ) { + rootSSHAccess(vData.mRootSSHAccess); + status(""); + } + else { + // this has to be called to let Gui to set to old value that device controller provided. + emit rootSSHAccessChanged(vData.mRootSSHAccess); + status(vData.mMessage); + } + + accepted(vData.mAccepted); + reason (vData.mReason ); + + // has to be the last one + response(true); +} Index: sources/device/DeviceView.h =================================================================== diff -u -r0e122c98700951af539d9f47c5578e26d640fcc7 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/device/DeviceView.h (.../DeviceView.h) (revision 0e122c98700951af539d9f47c5578e26d640fcc7) +++ sources/device/DeviceView.h (.../DeviceView.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -50,6 +50,8 @@ ATTRIBUTE ( QString , cryptSetup , "", CryptSetup ) PROPERTY ( bool , cryptSetupEnabled , true ) + ATTRIBUTE ( bool , rootSSHAccess , false, RootSSHAccess ) + VIEW_DEC_CLASS(VDevice) }; } Index: sources/gui/qml/pages/settings/SettingsRootSSHAccess.qml =================================================================== diff -u --- sources/gui/qml/pages/settings/SettingsRootSSHAccess.qml (revision 0) +++ sources/gui/qml/pages/settings/SettingsRootSSHAccess.qml (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -0,0 +1,100 @@ +/*! + * + * Copyright (c) 2021-2023 Diality Inc. - All Rights Reserved. + * \copyright + * THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN + * WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. + * + * \file SettingsRootSSH.qml + * \author (last) Behrouz NematiPour + * \date (last) 11-May-2023 + * \author (original) Behrouz NematiPour + * \date (original) 11-May-2023 + * + */ + +// Qt +import QtQuick 2.12 +import QtQuick.Controls 2.12 // Switch + + +// Qml imports +import "qrc:/globals" + +/*! + * \brief SettingsRootSSH is the screen + * which enables the Ro Water Input + */ +SettingsBase { id: _root + itemIndex : SettingsStack.RootSSHAccess + + confirmVisible : false + + Row { id: _settingsRootSSHRow + anchors.centerIn: parent + + Text { id : _settingsRootSSHLabel + text : qsTr("Root SSH Login") + width : 300 + height : _settingsRootSSHSwitch.height + color : Colors.white + font.pixelSize: Fonts.fontPixelButton + verticalAlignment : Text.AlignVCenter + horizontalAlignment : Text.AlignLeft + } + + Switch { id: _settingsRootSSHSwitch + property bool active: true + + checked : vDuetRoWaterDG.status + + width : 85 + height : 85 + + indicator: Rectangle { + implicitWidth : Variables.sliderCircleDiameter * 1.7 + implicitHeight : Variables.sliderCircleDiameter - ( Variables.progressbarHandlerBorderWidth * 2 ) + radius : implicitHeight + anchors.centerIn: parent + color : _settingsRootSSHSwitch.checked ? Colors.backgroundButtonSelect : Colors.createTreatmentInactive + border.color : _settingsRootSSHSwitch.checked ? Colors.borderButton : Colors.createTreatmentInactive + Rectangle { + property real diameter : Variables.sliderCircleDiameter + x: _settingsRootSSHSwitch.checked ? parent.width - width : 0 + anchors.verticalCenter: parent.verticalCenter + width : diameter + height : diameter + radius : diameter + color : _settingsRootSSHSwitch.active ? Colors.highlightProgressBar : Colors.createTreatmentInactive + border { + width: Variables.progressbarHandlerBorderWidth + color: Colors.textMain + } + } + } + + contentItem: Text { + width : parent.width + height : parent.height + // text : qsTr("Enabled")// _settingsRootSSHSwitch.checked ? qsTr("ON") : qsTr("OFF") + font.pixelSize: Fonts.fontPixelButton + color : _settingsRootSSHSwitch.active ? Colors.textMain : Colors.textDisableButton + verticalAlignment : Text.AlignTop + horizontalAlignment : Text.AlignHCenter + } + } + } + + Connections { target: _settingsRootSSHSwitch + function onClicked() { + vDevice.rootSSHAccess = _settingsRootSSHSwitch.checked + } + } + Connections { target: vDevice + // in case the value is rejecte it will be set to the previous value + // also the init value shall be set when navigate to the screen + function onRootSSHAccessChanged ( vValue ) { _settingsRootSSHSwitch.checked = vValue } + function onStatusChanged ( vValue ) { _root.notificationText = vValue } + } +} + Index: sources/gui/qml/pages/settings/SettingsStack.qml =================================================================== diff -u -rc73feffa73c7fe073a7a7581144f5806dfc91beb -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision c73feffa73c7fe073a7a7581144f5806dfc91beb) +++ sources/gui/qml/pages/settings/SettingsStack.qml (.../SettingsStack.qml) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -54,7 +54,8 @@ DeviceConfiguration , DeviceRegistration , SWUpdate , - FactoryReset + FactoryReset , + RootSSHAccess } property var itemsText : [ qsTr("Information" ), // Information @@ -72,6 +73,7 @@ qsTr("Device Registration" ), // DeviceRegistration qsTr("Software Update" ), // SWUpdate qsTr("Factory Reset" ), // FactoryReset + qsTr("Enable Root SSH" ), // RootSSHAccess ] property var itemsEnabled : [ true , // Information @@ -89,6 +91,7 @@ true , // DeviceRegistration false , // SWUpdate serviceMode , // FactoryReset + serviceMode , // RootSSHAccess ] property var itemsVisible : [ true , // Information @@ -106,6 +109,7 @@ _GuiView.manufactMode && serviceMode , // DeviceRegistration // && serviceMode added to make sure the service mode is confirmed by HD false /* serviceMode phase 1 */ , // SWUpdate serviceMode , // FactoryReset + serviceMode , // RootSSHAccess ] SettingsHome { id : _settingsHome @@ -169,6 +173,11 @@ push( _settingsDeviceConfiguration ) break + case SettingsStack.RootSSHAccess: + vDevice.doInitRootSSHAccess() + push( _SettingsRootSSHAccess) + break + default: console.debug("Unknown Index", vIndex) break @@ -186,6 +195,7 @@ SettingsROInput { id: _settingsRoInput } SettingsManufacturingSetup { id: _settingsDeviceConfiguration } SettingsDeviceRegistration { id: _settingsDeviceRegistration } + SettingsRootSSHAccess { id: _SettingsRootSSHAccess } SettingsServicePassword { id: _servicePassword } function gotoServiceMode( vservice ) { Index: sources/model/MModel.h =================================================================== diff -u -r0e122c98700951af539d9f47c5578e26d640fcc7 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/model/MModel.h (.../MModel.h) (revision 0e122c98700951af539d9f47c5578e26d640fcc7) +++ sources/model/MModel.h (.../MModel.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -286,6 +286,8 @@ REGISTER_METATYPE( DeviceBluetoothPairedQueryResponseData ) \ REGISTER_METATYPE( DeviceCryptSetupRequestData ) \ REGISTER_METATYPE( DeviceCryptSetupResponseData ) \ + REGISTER_METATYPE( DeviceRootSSHAccessRequestData ) \ + REGISTER_METATYPE( DeviceRootSSHAccessResponseData ) \ /* Settings */ \ REGISTER_METATYPE( SettingsData ) \ REGISTER_METATYPE( WifiNetworkData ) \ Index: sources/storage/StorageGlobals.cpp =================================================================== diff -u -r389f028cb9d4d320eae393de7c4408a58a619356 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision 389f028cb9d4d320eae393de7c4408a58a619356) +++ sources/storage/StorageGlobals.cpp (.../StorageGlobals.cpp) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -175,6 +175,10 @@ const char *Brightness_Set = "brightness_set.sh"; const char *Brightness_Get = "brightness_get.sh"; + // Brightness + const char *RootSSHAccess_Set = "rootsshaccess_set.sh"; + const char *RootSSHAccess_Get = "rootsshaccess_get.sh"; + // Bluetooth const char *Bluetooth_Paired_Reset = "bluetooth_paired_clear.sh"; const char *Bluetooth_Paired_Query = "bluetooth_paired_query.sh"; Index: sources/storage/StorageGlobals.h =================================================================== diff -u -r389f028cb9d4d320eae393de7c4408a58a619356 -rfb43510552969e9fb3c3f10ae693ba81ea7e8d52 --- sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision 389f028cb9d4d320eae393de7c4408a58a619356) +++ sources/storage/StorageGlobals.h (.../StorageGlobals.h) (revision fb43510552969e9fb3c3f10ae693ba81ea7e8d52) @@ -113,6 +113,10 @@ extern const char *Brightness_Set; extern const char *Brightness_Get; + // RootSSHAccess + extern const char *RootSSHAccess_Set; + extern const char *RootSSHAccess_Get; + // Bluetooth extern const char *Bluetooth_Paired_Reset; extern const char *Bluetooth_Paired_Query;