firmware icon indicating copy to clipboard operation
firmware copied to clipboard

[Bug]: setting device.serial_disabled to true does not disable serial console.

Open lesykm opened this issue 2 years ago • 1 comments

Category

Serial

Hardware

T-Lora v1

Firmware Version

1.3.40.e87ecc2-d

Description

  1. meshtastic --set device.serial_disabled true
  2. meshtastic --info | grep serial Preferences: { "device": { "serialDisabled": true, "debugLogEnabled": true, "ntpServer": "0.pool.ntp.org" }, "position": { "positionFlags": 3 }, "power": { "lsSecs": 300 }, "wifi": {}, "display": {}, "lora": {}, "bluetooth": { "enabled": true, "mode": "NoPin", "fixedPin": 123456 } } Module preferences: { "mqtt": {}, "serial": {}, "externalNotification": {}, "rangeTest": {}, "telemetry": {}, "cannedMessage": {} }

To my understanding "serialDisabled": true should make it impossible to use console

Relevant log output

No response

lesykm avatar Sep 21 '22 17:09 lesykm

Interestingly: https://github.com/meshtastic/Meshtastic-device/search?q=serial_disabled is empty instead we have: https://github.com/meshtastic/Meshtastic-device/search?q=serial_enabled However:

meshtastic --set device.serial_enabled false
Connected to radio
LocalConfig and LocalModuleConfig do not have attribute device.serial_enabled.

Something is off here ...

lesykm avatar Sep 21 '22 17:09 lesykm

you have to update your CLI. needs 1.3.35 - you can do that with pip3 install --upgrade meshtastic --pre

caveman99 avatar Sep 24 '22 21:09 caveman99

@caveman99 Still does not work:

meshtastic --version
1.3.35
meshtastic --info
Connected to radio

Owner: Meshtastic ea54 (ea54)
My info: { "myNodeNum": 2747853396, "maxChannels": 8, "firmwareVersion": "1.3.42.2f74f9ca", "errorCode": "NO_RADIO", "errorAddress": 421, "errorCount": 3, "rebootCount": 16, "messageTimeoutMsec": 300000, "minAppVersion": 20300, "hasWifi": true }
Nodes in mesh:  {'num': 2747853396, 'user': {'id': '!a3c8ea54', 'longName': 'Meshtastic ea54', 'shortName': 'ea54', 'macaddr': 'c8:c9:a3:c8:ea:54', 'hwModel': 'TLORA_V2_1_1P6'}, 'position': {}, 'deviceMetrics': {}}

Preferences: { "device": {}, "position": { "positionBroadcastSecs": 900, "positionBroadcastSmartEnabled": true, "gpsEnabled": true, "gpsUpdateInterval": 120, "gpsAttemptTime": 900, "positionFlags": 3 }, "power": { "waitBluetoothSecs": 60, "meshSdsTimeoutSecs": 7200, "sdsSecs": 4294967295, "lsSecs": 300, "minWakeSecs": 10 }, "network": { "ntpServer": "0.pool.ntp.org" }, "display": { "screenOnSecs": 600 }, "lora": { "hopLimit": 3, "txEnabled": true, "txPower": 30 }, "bluetooth": { "enabled": true, "mode": "FIXED_PIN", "fixedPin": 123456 } }

Module preferences: { "mqtt": {}, "serial": {}, "externalNotification": {}, "rangeTest": {}, "telemetry": { "deviceUpdateInterval": 900, "environmentUpdateInterval": 900 }, "cannedMessage": {} }

Channels:
  PRIMARY psk=default { "psk": "AQ==" }

Primary channel URL: https://www.meshtastic.org/e/#CgMSAQESBkADSAFQHg
meshtastic --set device.serial_enabled false
Connected to radio
Set device.serial_enabled to false
Writing modified preferences to device
meshtastic --info
Connected to radio

Owner: Meshtastic ea54 (ea54)
My info: { "myNodeNum": 2747853396, "maxChannels": 8, "firmwareVersion": "1.3.42.2f74f9ca", "errorCode": "NO_RADIO", "errorAddress": 421, "errorCount": 4, "rebootCount": 17, "messageTimeoutMsec": 300000, "minAppVersion": 20300, "hasWifi": true }
Nodes in mesh:  {'num': 2747853396, 'user': {'id': '!a3c8ea54', 'longName': 'Meshtastic ea54', 'shortName': 'ea54', 'macaddr': 'c8:c9:a3:c8:ea:54', 'hwModel': 'TLORA_V2_1_1P6'}, 'position': {}, 'deviceMetrics': {}}

Preferences: { "device": {}, "position": { "positionBroadcastSecs": 900, "positionBroadcastSmartEnabled": true, "gpsEnabled": true, "gpsUpdateInterval": 120, "gpsAttemptTime": 900, "positionFlags": 3 }, "power": { "waitBluetoothSecs": 60, "meshSdsTimeoutSecs": 7200, "sdsSecs": 4294967295, "lsSecs": 300, "minWakeSecs": 10 }, "network": { "ntpServer": "0.pool.ntp.org" }, "display": { "screenOnSecs": 600 }, "lora": { "hopLimit": 3, "txEnabled": true, "txPower": 30 }, "bluetooth": { "enabled": true, "mode": "FIXED_PIN", "fixedPin": 123456 } }

Module preferences: { "mqtt": {}, "serial": {}, "externalNotification": {}, "rangeTest": {}, "telemetry": { "deviceUpdateInterval": 900, "environmentUpdateInterval": 900 }, "cannedMessage": {} }

Channels:
  PRIMARY psk=default { "psk": "AQ==" }

Primary channel URL: https://www.meshtastic.org/e/#CgMSAQESBkADSAFQHg

hard_reboot_just_in_case

meshtastic --info
Connected to radio

Owner: Meshtastic ea54 (ea54)
My info: { "myNodeNum": 2747853396, "maxChannels": 8, "firmwareVersion": "1.3.42.2f74f9ca", "errorCode": "NO_RADIO", "errorAddress": 421, "errorCount": 4, "rebootCount": 25, "messageTimeoutMsec": 300000, "minAppVersion": 20300, "hasWifi": true }
Nodes in mesh:  {'num': 2747853396, 'user': {'id': '!a3c8ea54', 'longName': 'Meshtastic ea54', 'shortName': 'ea54', 'macaddr': 'c8:c9:a3:c8:ea:54', 'hwModel': 'TLORA_V2_1_1P6'}, 'position': {}, 'deviceMetrics': {}}

Preferences: { "device": {}, "position": { "positionBroadcastSecs": 900, "positionBroadcastSmartEnabled": true, "gpsEnabled": true, "gpsUpdateInterval": 120, "gpsAttemptTime": 900, "positionFlags": 3 }, "power": { "waitBluetoothSecs": 60, "meshSdsTimeoutSecs": 7200, "sdsSecs": 4294967295, "lsSecs": 300, "minWakeSecs": 10 }, "network": { "ntpServer": "0.pool.ntp.org" }, "display": { "screenOnSecs": 600 }, "lora": { "hopLimit": 3, "txEnabled": true, "txPower": 30 }, "bluetooth": { "enabled": true, "mode": "FIXED_PIN", "fixedPin": 123456 } }

Module preferences: { "mqtt": {}, "serial": {}, "externalNotification": {}, "rangeTest": {}, "telemetry": { "deviceUpdateInterval": 900, "environmentUpdateInterval": 900 }, "cannedMessage": {} }

Channels:
  PRIMARY psk=default { "psk": "AQ==" }

Primary channel URL: https://www.meshtastic.org/e/#CgMSAQESBkADSAFQHg

Am I doing something wrong?

Also, just in case:

meshtastic --set device.serial_disabled true
Connected to radio
LocalConfig and LocalModuleConfig do not have attribute device.serial_disabled.

lesykm avatar Sep 24 '22 21:09 lesykm

I'll have a look tomorrow, looks like it's not even saved. Anyway the value is only read during device startup, so you should See it after the reset but it's only active after a reboot. We can't de-init the console as of now.

caveman99 avatar Sep 24 '22 22:09 caveman99

This has been modified to meshtastic --set device.serial_enabled = false

garthvh avatar Sep 24 '22 22:09 garthvh

Device also reboots automatically after saving now as well in firmwares 1.3.41+

garthvh avatar Sep 24 '22 23:09 garthvh

#response_container_BBPPID{font-family: initial; font-size:initial; color: initial;} I'll have a look tomorrow, looks like it's not even saved. Anyway the value is only read during device startup, so you should See it after the reset but it's only active after a reboot. We can't de-init the console as of now. Gesendet über BlackBerry Hub+ Posteingang für Android

I did reset the device, including detaching of power.

lesykm avatar Sep 25 '22 00:09 lesykm

This has been modified to meshtastic --set device.serial_enabled = false

I did execute this command, please see my listings.

lesykm avatar Sep 25 '22 00:09 lesykm

Device also reboots automatically after saving now as well in firmwares 1.3.41+

I did all kind of reboots I can imagine just to be sure :)

lesykm avatar Sep 25 '22 00:09 lesykm

@caveman99 this issue is reproducible on many devices - can it be re-opened?

lesykm avatar Sep 27 '22 06:09 lesykm

we've had a bit of erratic behaviour with device filesystem. I'll revisit this after we get CI running again. Looks like an issue where the setting is not saved to the protobuf.

caveman99 avatar Sep 27 '22 07:09 caveman99

This is a tricky one. Here's the code in question:

if (!config.has_device || config.device.serial_enabled) {
    consoleInit(); // Set serial baud rate and init our mesh console
}

On a new flashed device the entire device structure is empty/default. and setting serial_enabled to 0 will effectively not save that info since it's also assumed to be the default. The way this is crafted now, you have to set another non-default value in device to actually disable the console.

@thebentern @sachaw maybe this is another case where we have to enforce the default of 1/enabled so we can change that if statement.

caveman99 avatar Sep 27 '22 10:09 caveman99

This is already true by default, implemented in https://github.com/meshtastic/Meshtastic-device/commit/60b4dbfdcd4d85355295756c0e3330b556020b61 or am I missing something here?

sachaw avatar Sep 27 '22 23:09 sachaw

It seems to accept the command but does not save the value

When I do --set device.serial_enabled false

and then meshtastic --info I get

Preferences: { "device": {},

garthvh avatar Oct 04 '22 18:10 garthvh

the 0/false value is not printed, but it is stored correctly. Problem is nodeDB is not loaded (yet) when we check for this. I will submit a proposed solution later on.

caveman99 avatar Oct 04 '22 19:10 caveman99