Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UVK5 Firmware updates #1093

Merged
merged 6 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions chirp/chirp_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1572,8 +1572,11 @@ def get_memory_extra(self, memory):
rf = self.get_features()
if not rf.has_comment and isinstance(memory.number, int):
self._metadata.setdefault('mem_extra', {})
memory.comment = self._metadata['mem_extra'].get(
'%04i_comment' % memory.number, '')
try:
memory.comment = self._metadata['mem_extra'].get(
'%04i_comment' % memory.number, '')
except ImmutableValueError:
pass
return memory

def set_memory_extra(self, memory):
Expand Down
2 changes: 1 addition & 1 deletion chirp/drivers/ft70.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ def get_features(self):
rf.valid_bands = [(500000, 999900000)]
rf.valid_skips = SKIPS
rf.valid_power_levels = POWER_LEVELS
rf.valid_characters = "".join(CHARSET)
rf.valid_characters = "".join(CHARSET).upper()
rf.valid_name_length = 6
rf.memory_bounds = (1, 900)
rf.can_odd_split = True
Expand Down
38 changes: 36 additions & 2 deletions chirp/drivers/uvk5.py
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ class UVK5Radio(UVK5RadioBase):
@classmethod
def k5_approve_firmware(cls, firmware):
approved_prefixes = ('k5_2.01.', 'app_2.01.', '2.01.',
'1o11', '4.00.', 'k5_4.00.')
'1o11', '4.00.', 'k5_4.00.', '5.00.')
return any(firmware.startswith(x) for x in approved_prefixes)

@classmethod
Expand All @@ -2053,11 +2053,45 @@ def detect_from_serial(cls, pipe):
for rclass in cls.detected_models():
if rclass.k5_approve_firmware(firmware):
return rclass
raise errors.RadioError('Firmware %r not supported' % firmware)

return UVK5RestrictedRadio


@directory.register
class RA79Radio(UVK5Radio):
"""Retevis RA79"""
VENDOR = "Retevis"
MODEL = "RA79"


@directory.register
@directory.detected_by(UVK5Radio)
class UVK5RestrictedRadio(UVK5RadioBase):
VARIANT = 'unsupported'

@classmethod
def k5_approve_firmware(cls, firmware):
return False

def process_mmap(self):
firmware = self.metadata.get('uvk5_firmware', '<unknown>')
LOG.warning('Firmware %s is not supported by CHIRP. '
'Image data will be read-only.', firmware)
self._memobj = bitwise.parse(MEM_FORMAT, self._mmap)

def sync_out(self):
raise errors.RadioError(
_('Upload is disabled due to unsupported firmware version'))

def get_memory(self, n):
mem = super().get_memory(n)
mem.immutable = dir(mem)
return mem

def set_memory(self, m):
raise errors.InvalidValueError(
_('Memories are read-only due to unsupported firmware version'))

def set_settings(self, settings):
raise errors.InvalidValueError(
_('Settings are read-only due to unsupported firmware version'))
Loading
Loading