From 4f74b8b63af6d896369b3c6bcd87eafa665e8b64 Mon Sep 17 00:00:00 2001 From: Alexander Sosedkin Date: Sat, 26 Jun 2021 12:05:54 +0200 Subject: [PATCH] onenetbook/4: update stylus patch for 5.12.12 --- .../5.12.12.patch.patch | 17 +++++++++ .../4/goodix-stylus-mastykin/default.nix | 35 ++++++++++++------- 2 files changed, 39 insertions(+), 13 deletions(-) create mode 100644 onenetbook/4/goodix-stylus-mastykin/5.12.12.patch.patch diff --git a/onenetbook/4/goodix-stylus-mastykin/5.12.12.patch.patch b/onenetbook/4/goodix-stylus-mastykin/5.12.12.patch.patch new file mode 100644 index 0000000..8cd8f31 --- /dev/null +++ b/onenetbook/4/goodix-stylus-mastykin/5.12.12.patch.patch @@ -0,0 +1,17 @@ +--- orig/patch1 ++++ updated/patch1 +@@ -10,11 +10,11 @@ + /* quirks to control the device */ + #define MT_QUIRK_NOT_SEEN_MEANS_UP BIT(0) + #define MT_QUIRK_SLOT_IS_CONTACTID BIT(1) +-@@ -70,6 +73,7 @@ +- #define MT_QUIRK_WIN8_PTP_BUTTONS BIT(18) ++@@ -71,6 +74,7 @@ + #define MT_QUIRK_SEPARATE_APP_REPORT BIT(19) + #define MT_QUIRK_FORCE_MULTI_INPUT BIT(20) +-+#define MT_QUIRK_NON_MT_PEN BIT(21) ++ #define MT_QUIRK_DISABLE_WAKEUP BIT(21) +++#define MT_QUIRK_NON_MT_PEN BIT(22) + + #define MT_INPUTMODE_TOUCHSCREEN 0x02 + #define MT_INPUTMODE_TOUCHPAD 0x03 diff --git a/onenetbook/4/goodix-stylus-mastykin/default.nix b/onenetbook/4/goodix-stylus-mastykin/default.nix index 2f534a9..d80749c 100644 --- a/onenetbook/4/goodix-stylus-mastykin/default.nix +++ b/onenetbook/4/goodix-stylus-mastykin/default.nix @@ -1,5 +1,25 @@ -{ stdenv, lib, kernel, fetchpatch }: +{ stdenv, lib, kernel, fetchpatch, runCommandNoCC, patch }: +let + patch1_original = fetchpatch { + url = "https://marc.info/?l=linux-input&m=161847127221531&q=p3"; + name = "goodix-stylus-mastykin-1-pen-support.patch"; + sha256 = "sha256-1oc8OvfhScYvtsMeV9A4hU+09i59tEJ6HZS6jspsJR8="; + }; + patch1_updated_5_12_12 = runCommandNoCC + "goodix-stylus-mastykin-1-pen-support-5.12.12.patch" {} + '' + cat ${patch1_original} > $out + ${patch}/bin/patch $out < ${./5.12.12.patch.patch} + ''; + patch1 = if (lib.versionAtLeast kernel.version "5.12.12") then + patch1_updated_5_12_12 else patch1_original; + patch2 = fetchpatch { + url = "https://marc.info/?l=linux-input&m=161847127221531&q=p4"; + name = "goodix-stylus-mastykin-2-buttons.patch"; + sha256 = "sha256-HxmR8iEgoj4PJopGWJdWsjFxbfISwTMzz+HyG81mRG4="; + }; +in stdenv.mkDerivation rec { name = "hid-multitouch-onenetbook4-${version}"; version = kernel.version; @@ -8,18 +28,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = kernel.moduleBuildDependencies; src = ./.; - patches = [ - (fetchpatch { - url = "https://marc.info/?l=linux-input&m=161847127221531&q=p3"; - name = "goodix-stylus-mastykin-1-pen-support.patch"; - sha256 = "sha256-1oc8OvfhScYvtsMeV9A4hU+09i59tEJ6HZS6jspsJR8="; - }) - (fetchpatch { - url = "https://marc.info/?l=linux-input&m=161847127221531&q=p4"; - name = "goodix-stylus-mastykin-2-buttons.patch"; - sha256 = "sha256-HxmR8iEgoj4PJopGWJdWsjFxbfISwTMzz+HyG81mRG4="; - }) - ]; + patches = [ patch1 patch2 ]; postUnpack = '' tar -C goodix-stylus-mastykin \