tb2097 / wacom-gui

Python/PyQt Wacom GUI for KDE
GNU General Public License v3.0
130 stars 35 forks source link

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

Open ocumo opened 11 months ago

ocumo commented 11 months ago

When running wacom-gui.py, the following Error pops up:

Device information for "Wacom Intuos Pro 2 L" not found

(or equivalent for different tablet devices).

This will happen on systems which have a relatively recent version of libwacom, i.e. >= 1.10. That means e.g. Ubuntu 22.04, Debian 12 (bookworm), CentOS 9, Fedora 36, Arch Linux, Gentoo and others.

The cause is that libwacom-list-local-devices, since April 28, 2021 (release 1.10) uses the YAML format by default, which looks like:

$ libwacom-list-local-devices --database /usr/share/libwacom/
devices:
- name: 'Wacom Intuos Pro L'
  bus: 'usb'
  vid: '0x056a'
  pid: '0x0317'
  nodes:
  - /dev/input/event30
  - /dev/input/event29
  - /dev/input/event28

...while wacom-gui expects a different format, thus the parsing is wrong, and the 'detected' dictionary in get_connected_tablets() is empty and an exception is thrown.

To get the format expected by wacom-gui, we need to add the --format=datafile argument.

I've fixed compatibility locally (from your master branch) and will attach a pull request shortly.

abcnorio commented 3 months ago

wacom one not recognized, but works on the Debian bullseye.

$ xsetwacom --list 
Wacom One by Wacom M Pen stylus     id: 14  type: STYLUS    
Wacom One by Wacom M Pen eraser     id: 15  type: ERASER  

starting the GUI it fails with error

Device information for "Wacom One by Wacom M" not found

and

$ libwacom-list-local-devices --database /usr/share/libwacom/
# Device node: /dev/input/event4
[Device]
Name=One by Wacom (medium)
ModelName=CTL-672
DeviceMatch=usb:056a:037b;
Class=Bamboo
Width=9
Height=5
IntegratedIn=
Styli=0xffffe;0xfffff;

[Features]
Reversible=true
Stylus=true
Ring=false
Ring2=false
Touch=false
TouchSwitch=false
# StatusLEDs=
NumStrips=0
Buttons=0

However, changing the file wacom_data.py with the changes outlined above leads to error

Unknown option --format=datafile

while starting the GUI with python wacom-gui.py

qt5 was installed via pip within a conda env with python = 3.11

env:

$ dpkg -l|grep wacom
ii  libwacom-bin                              1.8-2                          amd64        Wacom model feature query library -- binaries
ii  libwacom-common                    1.8-2                          all                Wacom model feature query library (common files)
ii  libwacom2:amd64                      1.8-2                          amd64        Wacom model feature query library
ii  libwacom2:i386                           1.8-2                          i386             Wacom model feature query library
ii  xserver-xorg-input-wacom       0.34.99.1-1+b1         amd64        X.Org X server -- Wacom input driver

Any ideas how to fix that?

ocumo commented 3 months ago

The error Unknown option --format=datafile happens because the version of libwacom (i.e., libwacom-bin) in your system is 1.8-2, which is the legacy version. I mentioned earlier "systems which have a relatively recent version of libwacom, i.e. >= 1.10", (and I included Debian 12 "bookworm" amongst them) need to use the --format=datafile to tell that newer version of libwacom what is the output format to use. But your system, being "bullseye"(old stable), doesn't have the newer version (>= 1.10), so libwacom won't understand the --format=datafile option, hence the error.

Frankly, that said, I just quit. I removed this program from my systems and switched to a (to me) much less interesting project: the OpenTabletDriver. That one still lacks a lot in terms of a nice GUI for any Wacom device: it has a confusing GUI, but at least it seems that they are trying. One thing I hate from it, is the fact that it relies on Windows .NET, with all the complications that come from it. That said, I have it working for one of my Wacom devices (Bamboo Fun) and have not yet tried on my bigger ones yet.

Looks like we're going to be stuck to command-line trickery for a long time to deal with Wacom tablets.

tb2097 commented 3 months ago

As noted by @ocumo, Bullseye is a really old OS version at this time. If you want to use a version of the GUI on it, my suggestion would be be use the last https://github.com/tb2097/wacom-gui/releases/tag/V0.2.2-2, which is the last version to support python2.7.

The issue, as noted in #31 and various other tickets is less with the UI and moreso with Wacom's inconsistency in naming their tablets between tools. As noted by you, xsetwacom presents the tablet at "Wacom One by Wacom M" but the database file presents it as "One by Wacom (medium)". The "hack" way to fix it is to modify the database file to have the name be "Wacom One by Wacom M", which will resolve the issue.

I have presented this to Wacom numerous times and admittedly they have not been receptive to fixing their naming as new tablets are released. I have been working on updates to the tool (currently trying to create the ability to target an area of the display vs a specific display/all) but real life has been keeping me busy.

I'm completely open to others proposing fixes to the code I have not yet resolved, but this is one that would require constant maintenance.

abcnorio commented 3 months ago

Thanks for the replies, some short update:

Tried on bullseye AND bookworm now and neither worked. Here the output of bookworm:

# dpkg -l|grep wacom
ii  libwacom-bin                                     2.10.0-1                                  amd64        Wacom model feature query library -- binaries
ii  libwacom-common                                  2.10.0-1                                  all          Wacom model feature query library (common files)
ii  libwacom9:amd64                                  2.10.0-1                                  amd64        Wacom model feature query library
ii  xserver-xorg-input-wacom                         1.2.1-1                                   amd64        X.Org X server -- Wacom input driver
# journalctl -b0 |grep wacom
Apr 08 16:11:14 avconv kernel: wacom 0003:056A:037B.0009: hidraw8: USB HID v1.10 Mouse [Wacom Co.,Ltd. CTL-672] on usb-0000:00:14.0-10.3/input0
$ lsusb|grep Wacom
Bus 001 Device 010: ID 056a:037b Wacom Co., Ltd CTL-672 [One by Wacom (M)]
# python3 --version
Python 3.11.8

as root (just to be curious whether it would work)

# python3 wacom-gui.py 
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
Traceback (most recent call last):
  File "/root/wacom-gui/wacom-gui/wacom-gui.py", line 766, in <module>
    main()
  File "/root/wacom-gui/wacom-gui/wacom-gui.py", line 758, in main
    form = WacomGui()
           ^^^^^^^^^^
  File "/root/wacom-gui/wacom-gui/wacom-gui.py", line 51, in __init__
    self.pad = Pad()
               ^^^^^
  File "/root/wacom-gui/wacom-gui/pad.py", line 36, in __init__
    desktop = os.environ["DESKTOP_SESSION"]
              ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 679, in __getitem__
KeyError: 'DESKTOP_SESSION'

as user

$ python wacom-gui.py 
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 0,0,0,100'
QCssParser::parseColorValue: Specified color without alpha value but alpha given: 'rgb 90,90,90,90'
unknown desktop environment
Traceback (most recent call last):
  File "/home/XXX/wacom-gui/wacom-gui/wacom-gui.py", line 211, in newConfig
    config = AddConfig.add_config(self.configs[self.dev].keys())
                                  ~~~~~~~~~~~~^^^^^^^^^^
KeyError: None

I also tried ALL patches by @ocumo (double-checked!) and none of them worked - always same error of not having a clue about the device and its specs. So looks like the problem is really the labeling of the tablet. Will see whether it makes sense for me to switch to opentabledriver and let dotnet on my computer. Originally, I am left-handed and I just needed it for that. Tried out in a win VM and it worked pretty well to change settings of the tablet in accordance to my needs to be able to use krita without the brush-palette popping up all the time. So will see how to do that on the commandline.