diff options
-rw-r--r-- | interface-definitions/service_serial-proxy.xml.in | 6 | ||||
-rwxr-xr-x | src/conf_mode/system_serial-proxy.py | 15 |
2 files changed, 11 insertions, 10 deletions
diff --git a/interface-definitions/service_serial-proxy.xml.in b/interface-definitions/service_serial-proxy.xml.in index cedaae5ea..b027752b9 100644 --- a/interface-definitions/service_serial-proxy.xml.in +++ b/interface-definitions/service_serial-proxy.xml.in @@ -42,7 +42,7 @@ </leafNode> <leafNode name="data-bits"> <properties> - <help>Serial port data bits</help> + <help>Serial port data bits (default: 8)</help> <completionHelp> <list>7 8</list> </completionHelp> @@ -53,7 +53,7 @@ </leafNode> <leafNode name="stop-bits"> <properties> - <help>Serial port stop bits</help> + <help>Serial port stop bits (default: 1)</help> <completionHelp> <list>1 2</list> </completionHelp> @@ -64,7 +64,7 @@ </leafNode> <leafNode name="parity"> <properties> - <help>Parity setting</help> + <help>Parity setting (default: none)</help> <completionHelp> <list>even odd none</list> </completionHelp> diff --git a/src/conf_mode/system_serial-proxy.py b/src/conf_mode/system_serial-proxy.py index 83369d39d..007277918 100755 --- a/src/conf_mode/system_serial-proxy.py +++ b/src/conf_mode/system_serial-proxy.py @@ -43,12 +43,12 @@ def get_config(): for serial_port in conf.list_nodes(['device']): conf.set_level(base + ['device', serial_port]) serial = { - 'data_bits': '', - 'parity': '', + 'data_bits': '8', + 'parity': 'none', 'port': '', 'serial_port': '/dev/serial/by-bus/' + serial_port, 'speed': '', - 'stop_bits': '', + 'stop_bits': '1', 'timeout': '600' } @@ -80,10 +80,11 @@ def verify(proxy): raise ConfigError('Serial interface "{serial_port} does not exist"' .format(**device)) - for key in ['data_bits', 'parity', 'port', 'speed', 'stop_bits']: - if not device[key]: - value = key.replace('_','-') - raise ConfigError(f'{value} option must be defined!') + if not device['port']: + raise ConfigError(f'Port must be defined!') + + if not device['speed']: + raise ConfigError(f'Speed must be defined!') return None |