diff options
| author | Christoph Berg <myon@debian.org> | 2022-11-06 21:01:21 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2022-11-06 21:01:21 +0100 |
| commit | 14581c70e561f9f350a4d5ad86924a5d466028d4 (patch) | |
| tree | 64306df1c9a8980acbb455c2d4d794658764f6e1 /chirpc | |
| parent | c2bdd8f8d96bf5329672163cc0905a22589d26d3 (diff) | |
New upstream version 20211015+py3upstream/20211015+py3
Diffstat (limited to 'chirpc')
| -rw-r--r--[-rwxr-xr-x] | chirpc | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -44,29 +44,30 @@ def fail_missing_mmap(): class ToneAction(argparse.Action): - def __call__(self, parser, namespace, value, option_string=None): - if value in chirp_common.TONES: - raise argparse.ArgumentError("Invalid tone valeu: %.1f" % value) + def __call__(self, parser, namespace, values, option_string=None): + value = values[0] + if value not in chirp_common.TONES: + raise argparse.ArgumentError( + self, "Invalid tone value: %.1f" % value) setattr(namespace, self.dest, value) class DTCSAction(argparse.Action): - def __call__(self, parser, namespace, value, option_string=None): - try: - value = int(value, 10) - except ValueError: - raise argparse.ArgumentError("Invalid DTCS value: %s" % value) - + def __call__(self, parser, namespace, values, option_string=None): + value = values[0] if value not in chirp_common.DTCS_CODES: - raise argparse.ArgumentError("Invalid DTCS value: %03i" % value) + raise argparse.ArgumentError( + self, "Invalid DTCS value: %03i" % value) setattr(namespace, self.dest, value) class DTCSPolarityAction(argparse.Action): - def __call__(self, parser, namespace, value, option_string=None): + def __call__(self, parser, namespace, values, option_string=None): + value = values[0] if value not in ["NN", "RN", "NR", "RR"]: - raise optparse.OptionValueError("Invaid DTCS polarity: %s" % value) - setattr(parser.values, option.dest, value) + raise argparse.ArgumentError( + self, "Invaid DTCS polarity: %s" % value) + setattr(namespace, self.dest, value) def parse_memory_number(radio, args): @@ -199,10 +200,9 @@ if __name__ == "__main__": sys.exit(0) if options.id: - from chirp import icf - s = serial.Serial(port=options.serial, baudrate=9600, timeout=0.5) - md = icf.get_model_data(s) - print("Model:\n%s" % util.hexprint(md)) + from chirp import detect + md = detect.detect_icom_radio(options.serial) + print("Model:\n%s" % md.MODEL) sys.exit(0) if not options.radio: |
