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

Pen not detected -XP-Pen Artist 22E Pro #18

Open
coffseducation opened this issue Feb 15, 2023 · 31 comments
Open

Pen not detected -XP-Pen Artist 22E Pro #18

coffseducation opened this issue Feb 15, 2023 · 31 comments

Comments

@coffseducation
Copy link

I have now managed to get the config gui to launch - but now the pen is no longer detected!
I have all this going on:

$ userspace_tablet_driver_daemon
Listening on socket /home/anarcho/.local/var/run/userspace_tablet_driver_daemon.sock
xp_pen_handler initialized
huion_handler initialized
Handling XP-Pen Artist 22E Pro
Setup completed on interface 0
Setup completed on interface 1
Device: XP-Pen Artist 22E Pro - Probed maxWidth: (47663) maxHeight: (26809) resolution: (2540)
Attached to interface 2
Sending init key on endpont 3
Setup completed on interface 2
Set up config for device 2315: (XP-Pen Artist 22E Pro)

$ ./gradlew run
Starting a Gradle Daemon (subsequent builds will be faster)

Configure project :
Project : => no module-info.java found

Task :run
Feb. 15, 2023 2:32:15 PM tornadofx.Stylesheet$Companion detectAndInstallUrlHandler
INFO: Installing CSS url handler, since it was not picked up automatically
Using layout us with variant common
<------> 83% executing
:run

Operating System: Kubuntu 22.10
KDE Plasma Version: 5.26.5
KDE Frameworks Version: 5.102.0
Qt Version: 5.15.6
Kernel Version: 5.19.0-1017-lowlatency (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700 CPU @ 3.40GHz
Memory: 31.2 GiB of RAM
Graphics Processor: Mesa Intel® HD Graphics 530
Manufacturer: Dell Inc.
Product Name: Precision 5720 AIO

@kurikaesu
Copy link
Owner

Does the pen work before you run the daemon? Does it stop working after running the daemon?

@coffseducation
Copy link
Author

Neither before or after.

@kurikaesu
Copy link
Owner

With the daemon running, could you in a terminal do:

sudo evtest

It should list a bunch of devices that you can "test". Pick the Pen Tablet device. It should be labelled XP-Pen instead of Ugee. If it says something like Ugee instead of XP-Pen then there is a different problem altogether.

Once it's done spitting out information, try using the pen on the screen and see if it is emitting messages like EV_ABS etc.
If it does, then the driver should be working but something else may be interfering with it.

@coffseducation
Copy link
Author

$ sudo evtest
[sudo] password for anarcho:
sudo: evtest: command not found

@kurikaesu
Copy link
Owner

You will need to install evtest with sudo apt install evtest

@coffseducation
Copy link
Author

coffseducation commented Feb 15, 2023

Thanks.

/dev/input/event5: XP-Pen Artist 22E Pro
/dev/input/event6: XP-Pen Artist 22E Pro

I selected both 5 and 6 and the pen is still not working.

Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x28bd product 0xf90b version 0x1
Input device name: "XP-Pen Artist 22E Pro"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 272 (BTN_LEFT)
Event code 273 (BTN_RIGHT)
Event code 274 (BTN_MIDDLE)
Event code 275 (BTN_SIDE)
Event code 276 (BTN_EXTRA)
Event code 320 (BTN_TOOL_PEN)
Event code 321 (BTN_TOOL_RUBBER)
Event code 322 (BTN_TOOL_BRUSH)
Event code 323 (BTN_TOOL_PENCIL)
Event code 324 (BTN_TOOL_AIRBRUSH)
Event code 326 (BTN_TOOL_MOUSE)
Event code 327 (BTN_TOOL_LENS)
Event code 330 (BTN_TOUCH)
Event code 331 (BTN_STYLUS)
Event code 332 (BTN_STYLUS2)
Event type 2 (EV_REL)
Event code 8 (REL_WHEEL)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 4
Min 0
Max 47663
Resolution 2540
Event code 1 (ABS_Y)
Value 0
Min 0
Max 26809
Resolution 2540
Event code 24 (ABS_PRESSURE)
Value 0
Min 0
Max 8191
Event code 26 (ABS_TILT_X)
Value 0
Min -60
Max 60
Event code 27 (ABS_TILT_Y)
Value 0
Min -60
Max 60
Event type 4 (EV_MSC)
Event code 0 (MSC_SERIAL)
Properties:
Testing ... (interrupt to exit)

@kurikaesu
Copy link
Owner

There shouldn't be two of the exact same device showing up.
At most, the second XP-Pen device should have a "Pad" description to refer to the shortcut keys/buttons available surrounding the display.

Can you check to see if you are accidentally running the driver twice?

ps auxww | grep daemon

@coffseducation
Copy link
Author

$ ps auxww | grep daemon
root 1394 0.0 0.0 240052 8220 ? Ssl 14:24 0:00 /usr/libexec/accounts-daemon
avahi 1398 0.0 0.0 8540 4404 ? Ss 14:24 0:00 avahi-daemon: running [Vampa.local]
message+ 1400 0.2 0.0 14560 8852 ? Ss 14:24 0:07 @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root 1420 0.0 0.0 239452 7448 ? Ssl 14:24 0:00 /usr/libexec/power-profiles-daemon
avahi 1454 0.0 0.0 8176 368 ? S 14:24 0:00 avahi-daemon: chroot helper
root 1470 0.1 0.0 261084 18768 ? Ssl 14:24 0:05 /usr/sbin/NetworkManager --no-daemon
root 1509 0.0 0.0 1983876 20124 ? Ssl 14:24 0:01 /usr/bin/mullvad-daemon -v --disable-stdout-timestamps
rtkit 1905 0.0 0.0 22740 1556 ? SNsl 14:24 0:00 /usr/libexec/rtkit-daemon
root 1964 0.0 0.0 6524 3172 ? Ss 14:24 0:00 /usr/lib/ipsec/starter --daemon charon --nofork
anarcho 2063 0.0 0.0 242280 9748 ? SLsl 14:24 0:00 /usr/bin/gnome-keyring-daemon --foreground --components=pkcs11,secrets --control-directory=/run/user/1000/keyring
anarcho 2064 0.1 0.0 11616 7220 ? Ss 14:24 0:04 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
anarcho 2481 0.0 0.0 9576 5124 ? S 14:24 0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 12 --address=unix:path=/run/user/1000/at-spi/bus_0
anarcho 6128 2.0 1.3 5618032 439976 ? Ssl 14:32 1:01 /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.invoke=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.prefs/java.util.prefs=ALL-UNNAMED --add-opens java.base/java.nio.charset=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=AU -Duser.language=en -Duser.variant -cp /home/anarcho/.gradle/wrapper/dists/gradle-7.2-bin/2dnblmf4td7x66yl1d74lt32g/gradle-7.2/lib/gradle-launcher-7.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 7.2
anarcho 6846 6.6 0.0 81440 5472 pts/3 Sl+ 14:38 2:53 userspace_tablet_driver_daemon
anarcho 10101 0.0 0.0 9060 2280 pts/2 S+ 15:22 0:00 grep --color=auto daemon

@coffseducation
Copy link
Author

In System Activity there appears to be only one.

@kurikaesu
Copy link
Owner

Ok, looks like only one instance is running. If you stop the driver daemon then run sudo evtest again, do both entries for the XP-Pen tablet disappear?

@coffseducation
Copy link
Author

ok, so I got some different options:

dev/input/event23: XP-PEN Artist22E Pro Stylus
/dev/input/event24: XP-PEN Artist22E Pro
/dev/input/event3: Video Bus
/dev/input/event4: Video Bus
/dev/input/event7: XP-PEN Artist22E Pro Mouse
/dev/input/event8: XP-PEN Artist22E Pro Keyboard

I tried all but still not pen detection. ; /

@coffseducation
Copy link
Author

Select the device event number [0-24]: 23
Input driver version is 1.0.1
Input device ID: bus 0x3 vendor 0x28bd product 0x90b version 0x100
Input device name: "XP-PEN Artist22E Pro Stylus"
Supported events:
Event type 0 (EV_SYN)
Event type 1 (EV_KEY)
Event code 320 (BTN_TOOL_PEN)
Event code 330 (BTN_TOUCH)
Event code 331 (BTN_STYLUS)
Event type 3 (EV_ABS)
Event code 0 (ABS_X)
Value 0
Min 0
Max 47663
Event code 1 (ABS_Y)
Value 0
Min 0
Max 26809
Event code 24 (ABS_PRESSURE)
Value 0
Min 0
Max 8191
Event code 26 (ABS_TILT_X)
Value 0
Min -127
Max 127
Event code 27 (ABS_TILT_Y)
Value 0
Min -127
Max 127
Event type 4 (EV_MSC)
Event code 4 (MSC_SCAN)
Properties:
Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)

@kurikaesu
Copy link
Owner

Odd that the device is able to display its proper name. Had to check to see if they had merged in my kernel code but that doesn't seem to be the case just yet: https://lore.kernel.org/linux-input/2068502.VLH7GnMWUR@adrastea/T/#ma508e0882c4d8b12bb520c11de73d7e84138f065

There is a bug in the daemon code that is causing the "Pad" to not be named properly which I will fix shortly. This does not fix your issue yet though.

In order to debug this a bit further, you'll need to get some of the raw USB dumps by copying these commented out lines:
https://github.com/kurikaesu/userspace-tablet-driver-daemon/blob/main/src/huion_tablet.cpp#L302-L306

And placing them just above this line:
https://github.com/kurikaesu/userspace-tablet-driver-daemon/blob/main/src/artist_22e_pro.cpp#L84

After compiling the code and running it, trying to draw on the tablet surface will cause the driver to start spitting out raw message dumps.

Could you please see if it is dumping those messages and paste a small snippet of them here if possible?

@coffseducation
Copy link
Author

Ok.
I was going through the gui files! Ugh!
I installed with the deb. Where can I locate [artist_22e_pro.cpp#L84] in the file system?

@kurikaesu
Copy link
Owner

It doesn't exist on the filesystem if you use the debian package. You will need to clone it directly from the Github repository.

Follow the instructions here: https://github.com/kurikaesu/userspace-tablet-driver-daemon#building

@coffseducation
Copy link
Author

Sorry - to clarify, will I need to add the lines before I cmake? Do the lines need to be un-commented? Remove the // ?
Thanks.

@kurikaesu
Copy link
Owner

You can run cmake first.

Each time you make a change to the code, you'll just need to run make

You are also correct that you just need to remove the // at the start of each line to uncomment them.

After the code has successfully built with make, you can run the build code by just executing ./userspace_tablet_driver_daemon

@coffseducation
Copy link
Author

ok

@coffseducation
Copy link
Author

Is this error an issue?

make
[ 2%] Building CXX object CMakeFiles/userspace_tablet_driver_daemon.dir/src/main.cpp.o
[ 5%] Building CXX object CMakeFiles/userspace_tablet_driver_daemon.dir/src/usb_devices.cpp.o
[ 7%] Building CXX object CMakeFiles/userspace_tablet_driver_daemon.dir/src/xp_pen_handler.cpp.o
[ 10%] Building CXX object CMakeFiles/userspace_tablet_driver_daemon.dir/src/event_handler.cpp.o
[ 12%] Building CXX object CMakeFiles/userspace_tablet_driver_daemon.dir/src/vendor_handler.cpp.o
[ 15%] Building CXX object CMakeFiles/userspace_tablet_driver_daemon.dir/src/artist_22r_pro.cpp.o
[ 17%] Building CXX object CMakeFiles/userspace_tablet_driver_daemon.dir/src/artist_22e_pro.cpp.o
/home/anarcho/bin/xppen/userspace-tablet-driver-daemon/src/artist_22e_pro.cpp: In member function ‘virtual bool artist_22e_pro::handleTransferData(libusb_device_handle*, unsigned char*, size_t, int)’:
/home/anarcho/bin/xppen/userspace-tablet-driver-daemon/src/artist_22e_pro.cpp:86:31: error: ‘setfill’ is not a member of ‘std’; did you mean ‘fill’?
86 | std::cout << std::hex << std::setfill('0') << std::setw(2) << (int)data[i] << ":";
| ^~~~~~~
| fill
/home/anarcho/bin/xppen/userspace-tablet-driver-daemon/src/artist_22e_pro.cpp:86:53: error: ‘setw’ is not a member of ‘std’
86 | std::cout << std::hex << std::setfill('0') << std::setw(2) << (int)data[i] << ":";
| ^~~~
make[2]: *** [CMakeFiles/userspace_tablet_driver_daemon.dir/build.make:160: CMakeFiles/userspace_tablet_driver_daemon.dir/src/artist_22e_pro.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/userspace_tablet_driver_daemon.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
anarcho@Vampa:~/bin/xppen/userspace-tablet-driver-daemon$

@kurikaesu
Copy link
Owner

At the top of artist_22e_pro.cpp, just above this line: https://github.com/kurikaesu/userspace-tablet-driver-daemon/blob/main/src/artist_22e_pro.cpp#L19

Add:

#include <set>
#include <iomanip>

This should hopefully be the only thing missing.

@coffseducation
Copy link
Author

$ ./userspace_tablet_driver_daemon
Listening on socket /home/anarcho/.local/var/run/userspace_tablet_driver_daemon.sock
xp_pen_handler initialized
huion_handler initialized
Saved updated configuration file
Handling XP-Pen Artist 22E Pro
Setup completed on interface 0
Setup completed on interface 1
Device: XP-Pen Artist 22E Pro - Probed maxWidth: (47663) maxHeight: (26809) resolution: (2540)
Attached to interface 2
Sending init key on endpont 3
Setup completed on interface 2
Set up config for device 2315: (XP-Pen Artist 22E Pro)
Got transfer of data length: 8 data: 02:b1:04:00:00:00:00:00:

@kurikaesu
Copy link
Owner

Keep moving the stylus around on the tablet. It should spit out more data transfers.
I'm curious to see if it is sending the correct messages.

@coffseducation
Copy link
Author

After compiling the code and running it, trying to draw on the tablet surface will cause the driver to start spitting out raw message dumps.

Could you please see if it is dumping those messages and paste a small snippet of them here if possible?

Should these be in the terminal or elsewhere?

@kurikaesu
Copy link
Owner

In the terminal itself.

@coffseducation
Copy link
Author

Nothing spitting out except the above.

@coffseducation
Copy link
Author

Sorry, my keyboard was playing up. New batteries now!

@kurikaesu
Copy link
Owner

If there is no other messages than that first
Got transfer of data length: 8 data: 02:b1:04:00:00:00:00:00:

then the problem is likely outside of this driver's code. Does the display tablet work on other OS? Do the official XP-Pen drivers for Linux work with it?

@coffseducation
Copy link
Author

I do not have any other OS's to test on. The official XP-Pen drivers were always problematic/flaky and took forever to get working each session - hence trying yours!

@coffseducation
Copy link
Author

Thank you for the time spent on this! Much appreciated!

@kurikaesu
Copy link
Owner

I unfortunately don't own or have access to an Artist 22E Pro so I can't further debug what is going on here but from what we've teased out of the device so far, it looks like there is a problem with either the device itself or the USB cables that are being used.

For the other XP-Pen devices that I do have like the Innovator 16, the changes we've made to the code would have had the USB messages absolutely filling the terminal with data transfer lines.

If the official XP-Pen drivers are also being weird, then it just reinforces that idea to me.

The only other way to confirm is to try the device on a different OS & preferably different computer altogether. If it fails on another system then you may need to look into getting the tablet repaired if not replaced.

I'm sorry that I can't offer you much more assistance.

@coffseducation
Copy link
Author

Thanks!
I have a laptop I can test on - but it also runs Kubuntu 20.10.
I have a Wacom Intuos which is plug and play - works great on this machine.
Thanks again for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants