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

xp-pen-artist-pro-14-gen-2-driver: init at 4.0.4-240815 #347984

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gepbird
Copy link
Contributor

@gepbird gepbird commented Oct 11, 2024

Fixes #347116

@HangedFool please test how it works, I saw the GUI open but don't have a tablet for it. You can run this and the GUI should open: NIXPKGS_ALLOW_UNFREE=1 nix run github:gepbird/nixpkgs/xp-pen-init#xp-pen-artist-pro-14-gen-2-driver --impure

Postponed to an upcoming follow up PR: If the latest xp-pen driver is backwards compatible with all the previously released tablets, we could merge all the 2 old (xp-pen-deco-01-v2-driver and xp-pen-g430-driver) and this (xp-pen-artist-pro-14-gen-2-driver) package into a single one called xp-pen-driver. What do you think about it @virchau13 ?

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@HangedFool
Copy link

I am currently using a virtual machine to utilize NixOS because I don't have time to distro hop, I plan to switch in a couple weeks. That being said my VM is acting very funky with the package but I am unsure if that is because of an issue with the package or the VM, I am getting

[demo@nixos:~]$ NIXPKGS_ALLOW_UNFREE=1 nix run github:gepbird/nixpkgs/xp-pen-init#xp-pen-artist-pro-14-gen-2-driver --impure --extra-experimental-features nix-command --extra-experimental-features flakes
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
Qt: Session management error: None of the authentication protocols specified are supported
QtLockedFile::lock(): file is not opened
QtLockedFile::lock(): file is not opened

Can I setup Nix on my current machine (Arch) to test it?

@HangedFool
Copy link

HangedFool commented Oct 11, 2024

Upon trying to run

sudo NIXPKGS_ALLOW_UNFREE=1 nix run github:gepbird/nixpkgs/xp-pen-init#xp-pen-artist-pro-14-gen-2-driver --impure --extra-experimental-features nix-command --extra-experimental-features flakes

on my Arch system with nix I got this,

Authorization required, but no authorization protocol specified

qt.qpa.xcb: could not connect to display :1
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

[1]    5439 IOT instruction  sudo NIXPKGS_ALLOW_UNFREE=1 nix run  --impure --extra-experimental-features  

Am I missing something obvious?

@HangedFool
Copy link

HangedFool commented Oct 11, 2024

I can confirm, I was missing something obvious. Upon uninstalling my already existing drivers and then running the command the gui did appear... I feel very silly now

That being said, I think there does seem to be a problem with this

Funny

"Please connect device."

Here is the terminal

sudo NIXPKGS_ALLOW_UNFREE=1 nix run github:gepbird/nixpkgs/xp-pen-init#xp-pen-artist-pro-14-gen-2-driver --impure --extra-experimental-features nix-command --extra-experimental-features flakes
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
QLocale::English
QObject::connect: Incompatible sender/receiver arguments
        QDesktopWidget::primaryScreenChanged() --> MainWindow::onDeskScreenChanged(int)
Function  EnumDisplay nScreenCount: 2
Device.AllScreen "(0,0,3840,1200)"
Device.Screen 1 : "1(0,0,1920,1080)"
Device.Screen 2 : "2(1920,0,1920,1200)"
qt.glx: qglx_findConfig: Failed to finding matching FBConfig for QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize -1, redBufferSize 1, greenBufferSize 1, blueBufferSize 1, alphaBufferSize 0, stencilBufferSize -1, samples -1, swapBehavior QSurfaceFormat::SingleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile  QSurfaceFormat::NoProfile)
-------type: 4
manufacturer:Hanvon Ugee product:Shortcut Remote Get Max X:0xd8cc64 Y:0x1373a0  Press:0x1fff

Function  LoadConfig Error: open file "/usr/lib/pentablet/conf/xppen/config.xml" failed, error: "No such file or directory"
ReadXml Failed!
------------------load xml failed: ACK05
-------type: 2
manufacturer:UGTABLET product:Artist Pro 14 (Gen2) Get Max X:0xeba0 Y:0x9342  Press:0x3fff

Function  LoadConfig Error: open file "/usr/lib/pentablet/conf/xppen/config.xml" failed, error: "No such file or directory"
ReadXml Failed!
------------------load xml failed: LPH1416F-A
DeviceListLabel: ""
open uinput ok 

open uinput ok 

open uinput ok 

@gepbird
Copy link
Contributor Author

gepbird commented Oct 12, 2024

@HangedFool thanks for the quick reply! I'll be more active today as I went to sleep soon after I opened the PR.

The last issue where it doesn't find the config.xml should be fixed now, please try again.

Nix might not pull the latest commit using the previous test command, adding --refresh fixes it: sudo NIXPKGS_ALLOW_UNFREE=1 nix run github:gepbird/nixpkgs/xp-pen-init#xp-pen-artist-pro-14-gen-2-driver --impure --extra-experimental-features nix-command --extra-experimental-features flakes --refresh

Edit: oops, looks like it segfaults, give me a few minutes

@gepbird
Copy link
Contributor Author

gepbird commented Oct 12, 2024

Segfault is fixed, you can try it now.

@HangedFool
Copy link

HangedFool commented Oct 12, 2024

The GUI Successfully connects
    In Tablet Settings
        In Device Settings
            Calibration works
                But can be difficult to utilize if the calibration is already far off as you cannot click the calibrators
                But you can export config file then edit it then import if it is too far off to fix with the app
            The work area setter has functionality (it is hard to test extensively with my setup but it looks good)
            In display setting
                Brightness works
                Contrast works
                All Prebuilt Color profiles work
                User Color Profiles work
                    Color temperature adjustment works
                    RGB adjustments work
                    Reset to Default Works
        In Pen Settings
            Pressure works
                Pressure Adjustment works
                Pressure indicator works
                Pressure test zone does not work (This is very minor, I just tested with Krita)
            Tilt works
            Mouse Mode has functionality (It is hard for me to tell)
            Pen Buttons work
            Pen Eraser works
            Shortcut Rebindings Seems to work (I didn't test extensively but all the tests I did do succeeded)
            Reset to Default works
        In Settings
            Common
                Export config works
                Import config works
    Shortcut Remote
        Battery Indicator works
        Rotation works
        Wheel
            Wheel Setter works
            Wheel works
        Keys work
        Key rebinds work
        Key group switching works
    Current Device
        Diagnostic Tool works
        Feedback Works
        Default Works
        Prompt Toggle Works
        Shortcut Keys Toggle does not work
            That being said you can manually disable all of them or import a config where they are all disabled so whatever

These tests were done on an Artist Pro 14 (Gen 2) on Arch Linux

All in all fantastic job, this works nearly perfectly and the bugs I did find are incredibly minor. In fact, I would say it has a fraction of as many bugs as the AUR version had, how much of that is due to it being an updated version compared to the AUR version and how much is packaging I am unsure, but the end all be all is that I am very happy with this. The only thing I think it is missing is that it isn't in the application launcher, but I assume that that will be in the final package.

@gepbird
Copy link
Contributor Author

gepbird commented Oct 12, 2024

@HangedFool Great to hear it works, and thanks for your detailed testing!

I used most of the dependencies from one of the older xp-pen drivers, but I don't think they are being used.

I just removed those, the GUI opens up the same for me, would you mind testing the basics? (checking whether it detects your tablet, and some basic features work is enough, no need to go through that long list)

The bugs are most likely fixed by the newer version and not by packaging, but I'm curious what issues you had with the AUR package.

@HangedFool
Copy link

Should I just rerun the command to test this?

@gepbird
Copy link
Contributor Author

gepbird commented Oct 12, 2024

Should I just rerun the command to test this?

Yes, rerun the last test command (that has --refresh at the end)

@HangedFool
Copy link

I believe all functionalities are intact

Also, the "Shortcut Keys Toggle" actually does work, I miss-tested that

And the problems with the original AUR package I felt were just quality of life stuff that I had to manually fix. Their was a problem with launching it through an application launcher, I had problems with prompts, and some other stuff
(it has been awhile since I resolved most of the problems so I can't super well remember)

@HangedFool
Copy link

HangedFool commented Oct 12, 2024

I am unsure if this is just because it isn't a full package yet or if you even have control over this but I have noticed that when closing the gui the process doesn't end (it shouldn't so that is good) but it doesn't go into the application tray, which it should.
Also I made brief mention of this in my last post but a concern I have is that in the AUR package it had a bug wherein the application path it would create would launch a script that would launch the program, but that script wouldn't launch properly so application launchers like rofi would just not launch it. In the original AUR package my solution to this was just making the application path point directly to the application instead of the weird script.

@gepbird
Copy link
Contributor Author

gepbird commented Oct 12, 2024

I decided instead of adding this driver in a single PR and doing some refactors, I will do the refactors in a seperate PR.
This way the package could get merged faster as reviewers have to look at less code.

Also I have some other ideas regarding to all xp-pen drivers in nixpkgs. First of all with this we'd have 3 xp-pen device names: artist-pro-14-gen-2, g430 and deco-01-v2. But similar to the AUR, we could have a v3 (for g430, deco-01-v2 and many others) and a v4 (for artist-pro-14-gen-2 and many other) drivers. Currently for example if someone wants to to use an Innovator 16 device, he'd need to install deco-01-v2 because that has the same major version 3, which is quite confusing.

Another idea: to improve security, instead of giving sudo to a proprietary driver (needed because of udev rules), we could make a NixOS module that loads the udev rule (just like with the OpenTabletDriver module. This would also make it possible to add a desktop entry, so people who prefer to start it from a GUI application launcher rather than CLI can. However only people on NixOS would benefit from that.

With these future refactors, this would change from a user's perspective. Rather than

environment.systemPackages = [ pkgs.xp-pen-artist-pro-14-gen-2-driver ];

you'd do

services.xp-pen = {
  enable = true;
  package = xp-pen-v3; # this is optional, omitting it would use the latest v4 driver
};

Everything should work as before since I just deleted the refactor commits, but just to be sure, a final short and quick test wouldn't hurt.
@HangedFool I'd love to see you test the upcoming follow PR :)

@gepbird
Copy link
Contributor Author

gepbird commented Oct 12, 2024

I have noticed that when closing the gui the process doesn't end (it shouldn't so that is good) but it doesn't go into the application tray, which it should.

I noticed that too, I usually xkill-ed it or Ctrl+C-d it from the terminal, actually I'm not sure how the application tray works since I haven't been using it on my WM, but I might look into it later.

Also I made brief mention of this in my last post but a concern I have is that in the AUR package it had a bug wherein the application path it would create would launch a script that would launch the program, but that script wouldn't launch properly so application launchers like rofi would just not launch it.

Yes, I noticed that too, it will be fixed it in the follow up PR.

@gepbird gepbird marked this pull request as ready for review October 12, 2024 16:10
@gepbird gepbird changed the title xp-pen-artist-pro-14-gen-2-driver: init at 4.0.4-240815; xp-pen-*: refactor xp-pen-artist-pro-14-gen-2-driver: init at 4.0.4-240815 Oct 12, 2024
@HangedFool
Copy link

HangedFool commented Oct 12, 2024

In regard to closing it the expected behavior is that you right click it in the application tray and hit quit, so you would not be able to close it without the tray unless you manually kill it.

That is also typically how you would access it when it is already open, with the current system I think that relaunching the gui would make you have two instances of it open, the one you just launched and the one in the background, but you should be able to just click it in the application tray to recall it.

So not having access to it in the tray makes it somewhat awkward to work with.

@HangedFool
Copy link

Everything should work as before since I just deleted the refactor commits, but just to be sure, a final short and quick test wouldn't hurt. @HangedFool I'd love to see you test the upcoming follow PR :)

Just tell me when <3

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

Successfully merging this pull request may close these issues.

Package request: xp-pen-tablet
2 participants