Skip to content

Commit

Permalink
Add command to regenerate the channels conf file
Browse files Browse the repository at this point in the history
  • Loading branch information
blockstreamsatellite committed Mar 16, 2021
1 parent 4679b28 commit 38a2ca1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
Release Date: 2021-03-16

### Added
- Command `blocksat-cli cfg show` to show the local configuration.
- Configuration of the Novra S400 (pro kit receiver) via SNMP through command
`blocksat-cli standalone cfg`.
- Command `blocksat-cli cfg show` to show the local configuration.
- Command `blocksat-cli cfg channel` to regenerate the channels configuration
file used by Linux USB receivers.

### Changed
- CLI configuration and instructions to use DVB-S2 in CCM mode with the QPSK 3/5
Expand Down
29 changes: 28 additions & 1 deletion blocksatcli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def _cfg_frequencies(sat, lnb, setup):
def _cfg_chan_conf(info, chan_file):
"""Generate the channels.conf file"""

util._print_header("Channel Configurations for Linux USB Rx")
util._print_header("Channel Configuration")

print(textwrap.fill("This step will generate the channel configuration "
"file that is required when launching the USB "
Expand Down Expand Up @@ -617,6 +617,13 @@ def subparser(subparsers):
help='Display the local configuration',
formatter_class=ArgumentDefaultsHelpFormatter)
p2.set_defaults(func=show)

p3 = subsubparsers.add_parser(
'channel',
description="Configure the channels file used by the USB receiver",
help='Configure the channels file used by the USB receiver',
formatter_class=ArgumentDefaultsHelpFormatter)
p3.set_defaults(func=channel)
return p


Expand Down Expand Up @@ -702,3 +709,23 @@ def show(args):
if (pr_cfg[2] is not None):
val = pr_cfg[2](val)
print("| {:30s} | {:25s} |".format(label, str(val) + " " + unit))


def channel(args):
"""Configure the channels.conf file directly"""
user_info = read_cfg_file(args.cfg, args.cfg_dir)
if (user_info is None):
return

# Channel configuration file
if (user_info['setup']['type'] != defs.linux_usb_setup_type):
raise TypeError("Invalid command for {} receivers".format(
user_info['setup']['type']))

chan_file = os.path.join(args.cfg_dir, args.cfg + "-channel.conf")
_cfg_chan_conf(user_info, chan_file)

# Overwrite the channels.conf path in case it is changing from a previous
# version of the CLI when the conf file name was not bound to the cfg name
user_info['setup']['channel'] = chan_file
write_cfg_file(args.cfg, args.cfg_dir, user_info)

0 comments on commit 38a2ca1

Please sign in to comment.