From 6a257bed36fc8efd745c9cd5febd5653ecbf8ffe Mon Sep 17 00:00:00 2001 From: James Churchill Date: Tue, 6 Feb 2024 14:53:12 +1100 Subject: [PATCH] Add option to skip version check. --- gpdconfig/app.py | 3 ++- gpdconfig/wincontrols/hardware.py | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/gpdconfig/app.py b/gpdconfig/app.py index a23cde0..9f33666 100644 --- a/gpdconfig/app.py +++ b/gpdconfig/app.py @@ -22,6 +22,7 @@ def main(): parser.add_argument("-d","--dump", metavar="FILE", help="Dump config to FILE") parser.add_argument("-r","--reset", action="store_true", help="Reset to defaults") parser.add_argument("-v","--verbose", action="store_true", help="Output current config to stdout") + parser.add_argument("-x","--disable-version-check", dest="fwcheck", action="store_true", help="Disable FW version check") group = parser.add_argument_group("Informational options") group.add_argument("-c","--fields", action="store_true", help="List available fields") @@ -55,7 +56,7 @@ def main(): return # Read the current configuration from the device - wc = WinControls() + wc = WinControls(disableFwCheck=options.fwcheck) if wc.loaded and options.dump: with open(options.dump,"w") as wf: diff --git a/gpdconfig/wincontrols/hardware.py b/gpdconfig/wincontrols/hardware.py index 8109592..fdd928c 100755 --- a/gpdconfig/wincontrols/hardware.py +++ b/gpdconfig/wincontrols/hardware.py @@ -5,7 +5,7 @@ from .config import * from . import hid -class WinControls(object): +class WinControls(): """Class for reading and writing configuration to the GPD Win controller hardware.""" # Map of fields and their offsets in the binary configuration @@ -73,7 +73,8 @@ class WinControls(object): field = {f.name: f for f in _fields} - def __init__(self, read=True): + def __init__(self, read=True, disableFwCheck=False): + self.disableFwCheck = disableFwCheck self._openHid() self.loaded = False if read: @@ -119,6 +120,8 @@ def _parseResponse(self, response): } def _checkDevice(self): + if self.disableFwCheck: + return supported = ['K504', 'K407'] info = self._parseResponse(self._response) if info['Kfirmware'] not in supported: