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

Fix "Device information ... not found" errors with modern libwacom versions #69

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
21 changes: 18 additions & 3 deletions wacom-gui/wacom_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,25 @@ def get_connected_tablets(self):
warning.exec_()


def __list_local_devices(self):
def aux(format_arg):
"""aux calls libwacom-list-local-devices with an optional format argument.

Returns the contents of the child's stdout, and its numeric exit code."""
p = subprocess.Popen(
"libwacom-list-local-devices --database '%s' %s" % (self.db_path, format_arg), shell=True, stdout=subprocess.PIPE
)
return p.communicate()[0], p.returncode

# This will fail for libwacom <1.10, which doesn't have the
# --format option.
stdout, returncode = aux("--format=datafile")
if returncode != 0: # Retry in <1.10 syntax
stdout, returncode = aux("")
return stdout.decode('utf-8').split('\n')

def __get_libwacom_data(self):
p = subprocess.Popen("libwacom-list-local-devices --database %s" % self.db_path, shell=True,
stdout=subprocess.PIPE)
output = p.communicate()[0].decode('utf-8').split('\n')
output = self.__list_local_devices()
cur_device = None
buttons = False
for line in output:
Expand Down