diff options
| author | Christoph Berg <myon@debian.org> | 2022-11-06 21:01:26 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2022-11-06 21:01:26 +0100 |
| commit | 40c9ab872fbdd8b7d2b1cb630ea324b7a3b01e4a (patch) | |
| tree | 60edba4b7a503cb639f603b9239192321bd78f6f /chirpc | |
| parent | a1b9c5b655ec5b0bba958c41ebdabffb564eb7ee (diff) | |
| parent | 14581c70e561f9f350a4d5ad86924a5d466028d4 (diff) | |
Update upstream source from tag 'upstream/20211015+py3'
Update to upstream version '20211015+py3'
with Debian dir 0e6663ccd1c5a83c6b464f7b78532a8a4d2b0f98
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: |
