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

data: add the XP-Pen ACK05 Remote #777

Closed
wants to merge 1 commit into from

Conversation

whot
Copy link
Member

@whot whot commented Oct 7, 2024

Draft because currently missing:

  • sysinfo information (see what the bot says below)
  • the SVG

I'm going to punt both to @Deevad :)

@Deevad - if you save the SVG file as data/layouts/xp-pen-ack05-remote.svg then things should magically work once you install everything1. the layouts README has a list of things that are expected and it mostly relates to naming of leader lines etc.

You can use this file as-is on libwacom <= 2.11 but you'll have to change to this line:

DeviceMatch=usb:28bd:095b

(pipe | replaced to the older version with :)

Footnotes

  1. for testing you can also drop it directly into /usr/share/libwacom/layouts/ after dropping this .tablet file into /usr/share/libwacom.

@whot whot added the sysinfo needed Used to indicate sysinfo is missing from the PR label Oct 7, 2024
Copy link

github-actions bot commented Oct 7, 2024

Hi, there. I'm a bot and have been asked to have a look at this.

Please run the sysinfo script from https://github.com/linuxwacom/wacom-hid-descriptors and
file a new issue in that repo with the resulting sysinfo tarball. The README in that repo
has more information and instructions.

The .tablet files in this PR should then link to the sysinfo in this form:

# sysinfo.abCdE1234.tar.gz
# https://github.com/linuxwacom/wacom-hid-descriptors/issues/1234

A git grep sysinfo will show how this is currently used in existing data files.

See also https://github.com/linuxwacom/libwacom/wiki/Adding-a-new-device


This is an automated comment created by a bot. Responding to the bot or mentioning it won't have any effect.


[Buttons]
Left=A;B;C;D;E;F;G;H;I;J;
EvdevCodes=BTN_0;BTN_1;BTN_2;BTN_3;BTN_4;BTN_5;BTN_6;BTN_7;BTN_8
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTN_9 seems to be missing :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also a BTN_10 : the keypad part has 10 buttons (so 0 to 9) but the Dial has a middle button too.

I saw on the Wacom EKR this one (middle dial button) is counted as BTN_0 and "A" label.

So, I'll probably do that for the SVG (correct me if I'm wrong.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTN_9 seems to be missing :)

Counting is not my forte... fixed, thanks.

Maybe also a BTN_10 : the keypad part has 10 buttons (so 0 to 9) but the Dial has a middle button too.

does the dial button send BTN_0? If it does we shift all of them up and name the dial button A.

Copy link
Contributor

@bentiss bentiss Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my side I managed to get the dial button sending something sensible (and using currently BTN_LEFT because BTN_10 doesn't exist, opened to discussion).

On the official documentation of the product, it is said that the button on the dial is intended for "mode switching".

I think we should have something like that (completely untested):

[Features]
Stylus=false
NumRings=1
NumDials=1
NumStrips=0

[Buttons]
Left=A;B;C;D;E;F;G;H;I;J;K
EvdevCodes=BTN_0;BTN_1;BTN_2;BTN_3;BTN_4;BTN_5;BTN_6;BTN_7;BTN_8;BTN_9;BTN_LEFT;

#Note that no LEDs light up on the device itself
RingNumModes=4
Ring=K

@whot whot force-pushed the wip/xp-pen-remote branch from 8857472 to 2b02d4e Compare October 9, 2024 00:11
@Deevad
Copy link

Deevad commented Oct 10, 2024

Hey @whot , I finished the SVG, and tried to follow the README for using clean_svg.py (so I can only name the Groups). Unfortunately, the script has no effect on my side and exit this way:

~/2024-10-03_ACK05_XPPen_Remote_support »»» ./clean_svg.py xppen-ack05-remote.svg "XP-Pen ACK05 Remote"
Traceback (most recent call last):
  File "/home/deevad/2024-10-03_ACK05_XPPen_Remote_support/./clean_svg.py", line 323, in <module>
    clean_svg(root, args.tabletname[0])
  File "/home/deevad/2024-10-03_ACK05_XPPen_Remote_support/./clean_svg.py", line 299, in clean_svg
    traverse_and_clean(root)
  File "/home/deevad/2024-10-03_ACK05_XPPen_Remote_support/./clean_svg.py", line 58, in traverse_and_clean
    traverse_and_clean(child)
  File "/home/deevad/2024-10-03_ACK05_XPPen_Remote_support/./clean_svg.py", line 45, in traverse_and_clean
    apply_id_and_class_from_group(node)
  File "/home/deevad/2024-10-03_ACK05_XPPen_Remote_support/./clean_svg.py", line 264, in apply_id_and_class_from_group
    for child in group_node.getchildren():
                 ^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'
~/2024-10-03_ACK05_XPPen_Remote_support »»» 

What am I doing wrong?

(PS: I attach my SVG under)
xppen-ack05-remote
xppen-ack05-remote.svg (19Kb)

@whot
Copy link
Member Author

whot commented Oct 11, 2024

What am I doing wrong?

Not your fault, but in the script (which clearly hasn't been used in a while...), fixed in #782

@Deevad
Copy link

Deevad commented Oct 11, 2024

Hey @whot , thank you again for the quick fix on the *.py script.

So, I executed it and saw it directly output the svg code. So, I assumed I had to use it this way:

./clean_svg.py xppen-ack05-remote_inkscape-source.svg "XP-Pen ACK05 Remote" > xppen-ack05-remote.svg

But once I open the result on Inkscape to check it (maybe I shouldn't do that?) I have a rather weird result, and I have the feeling it isn't working as intended. Here is a screenshot:

2024-10-11_screenshot_060233_net

I attach my two files: the Inkscape source and the output (the one in the screenshot).

Comment on lines +1 to +35
# XP-Pen
# ACK05 Remote
#
# Reports as UGTABLET Artist Pro 16 (Gen2), for recordings
# etc. see https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/issues/32
#
# ┌────────┐────────────────────────┐
# / ┌────┐ \ ┌───┐┌───┐┌───┐┌───┐│
# │ │Dial│ │ │ A ││ B ││ C ││ ││
# │ └────┘ │ └───┘└───┘└───┘│ G ││
# │\________/ ┌───┐┌───┐┌───┐│ ││
# │ │ D ││ E ││ F ││ ││
# │ └───┘└───┘└───┘└───┘│
# │ ┌───┐┌────────┐┌───┐│
# │ │ H ││ I ││ J ││
# │ └───┘└────────┘└───┘│
# └──────────────────────────────────┘

[Device]
Name=UGTABLET Artist Pro 16 (Gen2)
ModelName=
DeviceMatch=usb|28bd|095b
Layout=xp-pen-ack05-remote.svg
Class=Remote

[Features]
Stylus=false
NumDials=1
NumRings=0
NumStrips=0
StatusLEDs=Ring

[Buttons]
Left=A;B;C;D;E;F;G;H;I;J;
EvdevCodes=BTN_0;BTN_1;BTN_2;BTN_3;BTN_4;BTN_5;BTN_6;BTN_7;BTN_8;BTN_9;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# XP-Pen
# ACK05 Remote
#
# Reports as UGTABLET Artist Pro 16 (Gen2), for recordings
# etc. see https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/issues/32
#
# ┌────────┐────────────────────────┐
# / ┌────┐ \ ┌───┐┌───┐┌───┐┌───┐│
# │ │Dial│ │ │ A ││ B ││ C ││ ││
# │ └────┘ │ └───┘└───┘└───┘│ G ││
# │\________/ ┌───┐┌───┐┌───┐│ ││
# │ │ D ││ E ││ F ││ ││
# │ └───┘└───┘└───┘└───┘│
# │ ┌───┐┌────────┐┌───┐│
# │ │ H ││ I ││ J ││
# │ └───┘└────────┘└───┘│
# └──────────────────────────────────┘
[Device]
Name=UGTABLET Artist Pro 16 (Gen2)
ModelName=
DeviceMatch=usb|28bd|095b
Layout=xp-pen-ack05-remote.svg
Class=Remote
[Features]
Stylus=false
NumDials=1
NumRings=0
NumStrips=0
StatusLEDs=Ring
[Buttons]
Left=A;B;C;D;E;F;G;H;I;J;
EvdevCodes=BTN_0;BTN_1;BTN_2;BTN_3;BTN_4;BTN_5;BTN_6;BTN_7;BTN_8;BTN_9;
# XP-Pen
# ACK05 Remote
#
# Reports as Hanvon Ugee Shortcut Remote, for recordings
# etc. see https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/issues/32
#
# ┌────────┐────────────────────────┐
# / ┌────┐ \ ┌───┐┌───┐┌───┐┌───┐│
# │ │ A │ │ │ B ││ C ││ D ││ ││
# │ └────┘ │ └───┘└───┘└───┘│ H ││
# \_________/ ┌───┐┌───┐┌───┐│ ││
# │ │ E ││ F ││ G ││ ││
# │ └───┘└───┘└───┘└───┘│
# │ ┌───┐┌────────┐┌───┐│
# │ │ I ││ J ││ K ││
# │ └───┘└────────┘└───┘│
# └─────────────────────────────────┘
[Device]
Name=Hanvon Ugee Shortcut Remote
ModelName=
DeviceMatch=usb:28bd:0202
Layout=xp-pen-ack05-remote.svg
Class=Remote
[Features]
Stylus=false
NumDials=1
NumRings=1
NumStrips=0
StatusLEDs=Ring
[Buttons]
Left=A;B;C;D;E;F;G;H;I;J;K;
EvdevCodes=BTN_LEFT;BTN_0;BTN_1;BTN_2;BTN_3;BTN_4;BTN_5;BTN_6;BTN_7;BTN_8;BTN_9;
#Note that no LEDs light up on the device itself
RingNumModes=4
Ring=A

Small changes to make my system happier:

  • DeviceMatch seems to be using :, not |`
  • the ring button is going to be A, and everything gets offset by 1
  • support for ring modes?

Libwacom is happy, but if I take @Deevad SVG, the panel doesn't show the svg, so I guess something is off....

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but if I take @Deevad SVG, the panel doesn't show the svg, so I guess something is off....

Hey, yes, I'm a bit stuck with the step where I have to run clean_svg.py script to autorename/autoclean elements in the SVG as noted on the documentation.

Unfortunately, my attempts are failing, I reported it here above: #777 (comment) : the script change the label of the buttons for Group A/ Group B, move the buttons around, delete the frame of the device, etc...

@bentiss
Copy link
Contributor

bentiss commented Oct 15, 2024

I found several bugs in clean_svg.py that were preventing to produce a proper SVG:

diff --git a/tools/clean_svg.py b/tools/clean_svg.py
index b84a48ec709e..658227ba0fb7 100755
--- a/tools/clean_svg.py
+++ b/tools/clean_svg.py
@@ -29,9 +29,10 @@ BRACKETS_NAMESPACE = "{" + NAMESPACE + "}"
 
 def human_round(number):
     """
-    Round to closest .5
+    Round to closest .5, keep integer values
     """
-    return round(number * 2) / 2.0
+    v = round(number * 2) / 2.0
+    return int(v) if v == int(v) else v
 
 
 def traverse_and_clean(node):
@@ -83,14 +84,21 @@ def round_if_number(value):
 def remove_non_svg_nodes_and_strip_namespace(root):
     if root.tag.startswith(BRACKETS_NAMESPACE):
         root.tag = root.tag[len(BRACKETS_NAMESPACE) :]
+
+    # we cannot remove while iterating on the same iterable,
+    # so we first get the list of nodes to remove, and then
+    # remove them in a second pass
+    cleanup_elems = [
+        elem
+        for elem in root
+        if not elem.tag.startswith(BRACKETS_NAMESPACE)
+        or elem.tag == BRACKETS_NAMESPACE + "metadata"
+    ]
+    for elem in cleanup_elems:
+        root.remove(elem)
+
     for elem in root:
-        if (
-            not elem.tag.startswith(BRACKETS_NAMESPACE)
-            or elem.tag == BRACKETS_NAMESPACE + "metadata"
-        ):
-            root.remove(elem)
-        else:
-            remove_non_svg_nodes_and_strip_namespace(elem)
+        remove_non_svg_nodes_and_strip_namespace(elem)
 
 
 def remove_transform_if_exists(node):

@whot, feel free to integrate them into your PR #782.

@Deevad , I took the liberty to edit your original inkscape file and produce the generated SVG:
xppen-ack05-remote_inkscape-source.svg
xp-pen-ack05-remote.svg

I've made a few changes:

  • renamed the groups with the correct id (inkscape is really painful here as it has a inkscape:label xml entry that overwrites the name in the UI
  • moved down the E key so the leader is correctly displayed
  • ungroup/regroup the Dial "buttons" (CCW and CW) to not have a transform at the group level

I still have issues with the Dials (running 2.11 locally here for now):

Apparently, dial support is included in 2.12, but the problem is more in the clean_svg.py. For Dials, it seems we need to have DialCCW Dial Leader for instance, when the svg cleaner forces DialCCW Leader (without the extra Dial). Should this be fixed in the clean_svg.py or does it matter at all?

So far, I've manually edited the resulting file, but it would be nice if we didn't have to.

@Deevad
Copy link

Deevad commented Oct 15, 2024

@Deevad , I took the liberty to edit your original inkscape file and produce the generated SVG:

No problem! I attached the SVG files for this.

Thank you for fixing clean_svg.py , it will be very useful for the future addition of layouts to the project 👍

@bentiss
Copy link
Contributor

bentiss commented Oct 15, 2024

FWIW, I've opened #788 to include my changes on top of this.

@whot if you don't mind, it might be easier if we move to #788...

@whot
Copy link
Member Author

whot commented Oct 16, 2024

nod Moved to #788

@whot whot closed this Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sysinfo needed Used to indicate sysinfo is missing from the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants