linuxwacom / wacom-hid-descriptors

Database of HID descriptors for Wacom pen/touch digitizers
Open Data Commons Open Database License v1.0
64 stars 37 forks source link

Lenovo ThinkPad X1 Yoga Gen 7 (Wacom HID 5309) #353

Open fahlb opened 9 months ago

fahlb commented 9 months ago

Here is the sysinfo of my X1 Yoga Gen 7 with 1080p screen: sysinfo.up1aDlcShX.tar.gz

EDIT: The sysinfo above was created under Wayland. I created another one under X.org (see comment): sysinfo.Vy5OTYeU2H.tar.gz

My device reports the devices 'Wacom HID 5309 Pen' and 'Wacom HID 5309 Finger' in the output of # libinput list-devices. This number is different from the 'Wacom HID 52B5', reported in issue #255.

Sadly I cannot generate a .tablet-file from this via scripts/git-update.sh. It's simply missing in the generated files. Because I'm on Wayland I installed xinput and xrandr in the hopes their output would help fix this but it didn't. Maybe I'll try it manually from the information generated.

fahlb commented 9 months ago

Okay, I having read in the libwacom documentation it should be sufficient to change an existing .tablet file of similar/identical hardware. Compared to the existing X1 Yoga Gen 6 entries and PR for issue #255, only my productID (PID) should be different. Thus I copied them and only changed the Name and DeviceMatch entries. This seems indeed sufficient when also taking a look at the extensive libwacom/data/wacom.example.

I propose the creation of a file called isdv4-5309.tablet, containing the following:

# Lenovo ThinkPad X1 Yoga Gen 7
# Sensor Type: AES
# Features: Touch (Integrated), Tilt
# HW Resolution: 30159 x 18850 (2540 x 2540 lpi)
#
# Manually generated from sysinfo.up1aDlcShX
# https://github.com/linuxwacom/wacom-hid-descriptors/issues/353

[Device]
Name=ISDv4 5309
ModelName=
DeviceMatch=i2c:056a:5309
Class=ISDV4
Width=12
Height=7
IntegratedIn=Display;System
Styli=@isdv4-aes;

[Features]
Stylus=true
Touch=true

EDIT: Fixed VID hex to be lowercase. Needed to pass testing of libwacom as mentioned in my latest comment.

fahlb commented 9 months ago

I was able to install my isdv4-5309.tablet file as described in the libwacom/README.md. My device is now recognized:

$ libwacom-list-local-devices
devices:
- name: 'ISDv4 5309'
  bus: 'i2c'
  vid: '0x056a'
  pid: '0x5309'
  nodes: 
  - /dev/input/event7: 'Wacom HID 5309 Pen'

The device is now also displayed in gnome settings and can be configured there. I call this a success and will create a pull request next!

EDIT: It looks like button 1 can not be configured. I select 'Right Mouse Button Click' but it still behaves like a middle click (as is default in my Fedora 39 install...).

EDIT2: In an X.org session the button configuration works fine! I guess it has something to do with xsetwacom not working under Wayland.

fahlb commented 9 months ago

According to the discussion in #279 and the related pull request #280, running sysinfo under X.org provides additional data (in xsetwacom.txt). So I did just that.

Here is my sysinfo generated in an X.org session (after temporarily removing the custom .tablet file from above) : sysinfo.Vy5OTYeU2H.tar.gz

There is still no .tablet file generated with scripts/git-update.sh. Since the above works 100% in the X.org session (including remapping button 1). So I'll copy my .tablet file over and create a PR with the data from the X.org session.

EDIT: Since there is already an open pull request #256 for 'Lenovo ThinkPad X1 Yoga Gen 7' with a 4k screen, I'll call mine 'Lenovo ThinkPad X1 Yoga Gen 7 (Version A)' to avoid any conflicts.

fahlb commented 9 months ago

Please ignore the previous commits on my fork with the typos. I should have worn my glasses. A coffee wouldn't have hurt either lol.

fahlb commented 9 months ago

Compiling and testing libwacom revealed that the vendor id (VID) hex needs to be lowercase. So in isdv4-5309.tablet, the line DeviceMatch=i2c:056A:5309 needs to be changed to DeviceMatch=i2c:056a:5309 only then do all tests pass.

EDIT: This has been fixed in my pull requests here (#355) and over at https://github.com/linuxwacom/libwacom/pull/626 EDIT2: Or so I thought...