diff --git a/app/device_manager.py b/app/device_manager.py index 2bbd8aa..6123639 100644 --- a/app/device_manager.py +++ b/app/device_manager.py @@ -1923,6 +1923,19 @@ class DeviceManager: # ── Device Management ──────────────────────────────────────── + def query_device(self) -> Dict: + """Query device for firmware version and hardware info.""" + if not self.is_connected: + return {'success': False, 'error': 'Device not connected'} + try: + event = self.execute(self.mc.commands.send_device_query(), timeout=5) + if event and hasattr(event, 'payload'): + return {'success': True, 'data': event.payload} + return {'success': False, 'error': 'No device query response'} + except Exception as e: + logger.error(f"query_device failed: {e}") + return {'success': False, 'error': str(e)} + def get_clock(self) -> Dict: """Get device clock time.""" if not self.is_connected: diff --git a/app/main.py b/app/main.py index a977325..0b27879 100644 --- a/app/main.py +++ b/app/main.py @@ -767,11 +767,20 @@ def _execute_console_command(args: list) -> str: return f"Error: {result.get('error')}" elif cmd == 'ver': - info = device_manager.get_device_info() - if info: - fw = info.get('firmware', info.get('fw_ver', '?')) - return f"Firmware: {fw}" - return "Version info unavailable" + result = device_manager.query_device() + if result.get('success'): + data = result['data'] + fw_ver = data.get('fw ver', 0) + if fw_ver >= 3: + lines = ["Device info:"] + lines.append(f" Model: {data.get('model', '?')}") + lines.append(f" Version: {data.get('ver', '?')}") + lines.append(f" Build date: {data.get('fw_build', '?')}") + if 'repeat' in data: + lines.append(f" Repeat: {'on' if data['repeat'] else 'off'}") + return "\n".join(lines) + return f"Firmware version: {fw_ver}" + return f"Error: {result.get('error')}" elif cmd == 'scope' and len(args) >= 2: scope = ' '.join(args[1:])