Skip to content

Commit

Permalink
Add option to skip version check.
Browse files Browse the repository at this point in the history
  • Loading branch information
pelrun committed Feb 6, 2024
1 parent ce3288d commit 6a257be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion gpdconfig/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down
7 changes: 5 additions & 2 deletions gpdconfig/wincontrols/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6a257be

Please sign in to comment.