From bffbb611fb844c754b681bd26171cc93239e8aec Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 18:12:41 +0100 Subject: [PATCH] update autorotate patch for python3 pyudev 0.22 [release 20180914git-6mamba;Sat Jul 24 2021] --- ...tools-20180914git-autorotate-python3.patch | 44 +++++++++++++++++++ surface-tools-20180914git-python3.patch | 16 ------- surface-tools.spec | 11 ++--- 3 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 surface-tools-20180914git-autorotate-python3.patch delete mode 100644 surface-tools-20180914git-python3.patch diff --git a/surface-tools-20180914git-autorotate-python3.patch b/surface-tools-20180914git-autorotate-python3.patch new file mode 100644 index 0000000..87a5f71 --- /dev/null +++ b/surface-tools-20180914git-autorotate-python3.patch @@ -0,0 +1,44 @@ +diff -Nru surface-tools-20180914git/autorotate/autorotate surface-tools-20180914git.patched/autorotate/autorotate +--- surface-tools-20180914git/autorotate/autorotate 2021-07-24 19:55:05.572617055 +0200 ++++ surface-tools-20180914git.patched/autorotate/autorotate 2021-07-24 19:52:10.136395281 +0200 +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + #####CONFIGURATION##### + #sensorname="accel_3d" +@@ -55,7 +55,6 @@ + val = val * scale / 9.8 + else: + # Microsoft Surface (unsupported) +- print 1 << 16 + if val & (1 << (16-1)) != 0: + val = val - (1 << 16) + return val +@@ -108,7 +107,7 @@ + + def checkRotation(): + device = pyudev.Device.from_path(context, path) +- scale = float(device.attributes.__getitem__("in_accel_scale")) ++ scale = float(device.attributes.get("in_accel_scale")) + accelX = twos_comp(device.attributes.asint("in_accel_x_raw"), scale) + accelY = twos_comp(device.attributes.asint("in_accel_y_raw"), scale) + accelZ = twos_comp(device.attributes.asint("in_accel_z_raw"), scale) +@@ -131,7 +130,7 @@ + + """Find which output to rotate, and get its current rotation""" + # Cache the xrandr info as we'll use it several times +-XRANDR_INFO = run_shell_cmd('xrandr --verbose') ++XRANDR_INFO = run_shell_cmd('xrandr --verbose').decode('utf-8') + + # Find the display we are interested to move (= the laptop panel) + POSSIBLE_OUTPUT = [ "DSI1", "DSI-1", "eDP1", "LVDS", "LVDS1" ] +@@ -145,7 +144,7 @@ + break + + # Cache the xinput info +-XINPUT_INFO = run_shell_cmd('xinput --list --name-only') ++XINPUT_INFO = run_shell_cmd('xinput --list --name-only').decode('utf-8') + + # Find the display we are interested to move (= the laptop panel) + POSSIBLE_OUTPUT = [ "CHPN0001:00" ] diff --git a/surface-tools-20180914git-python3.patch b/surface-tools-20180914git-python3.patch deleted file mode 100644 index 1c2d584..0000000 --- a/surface-tools-20180914git-python3.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- surface-tools-20180914git/autorotate/autorotate.orig 2020-12-21 17:06:09.847647891 +0000 -+++ surface-tools-20180914git/autorotate/autorotate 2020-12-21 17:06:37.699162556 +0000 -@@ -1,4 +1,4 @@ --#!/usr/bin/python -+#!/usr/bin/python3 - - #####CONFIGURATION##### - #sensorname="accel_3d" -@@ -55,7 +55,6 @@ - val = val * scale / 9.8 - else: - # Microsoft Surface (unsupported) -- print 1 << 16 - if val & (1 << (16-1)) != 0: - val = val - (1 << 16) - return val diff --git a/surface-tools.spec b/surface-tools.spec index d5ed549..1999051 100644 --- a/surface-tools.spec +++ b/surface-tools.spec @@ -1,20 +1,19 @@ Name: surface-tools Version: 20180914git -Release: 5mamba +Release: 6mamba Summary: Tools for using the Microsoft Surface with Linux Group: System/Kernel and Hardware Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco -URL: https://github.com/Surface-Pro-3/surface-tools -## GITSOURCE https://github.com/Surface-Pro-3/surface-tools.git master +URL: https://github.com/freundTech/surface-tools Source: https://github.com/Surface-Pro-3/surface-tools.git/master/surface-tools-%{version}.tar.bz2 Source1: autorotate.desktop Patch0: surface-tools-20180914git-autorotate-autodetect.patch Patch1: surface-tools-20180914git-check-and-fork.patch Patch2: surface-tools-20180914git-penmon-autodetect.patch Patch3: surface-tools-20180914git-autorotate-chuwi-fix-and-touchscreen.patch -Patch4: surface-tools-20180914git-python3.patch +Patch4: surface-tools-20180914git-autorotate-python3.patch License: GPL ## AUTOBUILDREQ-BEGIN ## AUTOBUILDREQ-END @@ -23,7 +22,6 @@ Requires: python3 Requires: pygobject-py3 Requires: xrandr Requires: xinput -BuildRoot: %{_tmppath}/%{name}-%{version}-root %description Tools for using the Microsoft Surface with Linux. @@ -62,6 +60,9 @@ install -D -m0755 penmon/penmon %{buildroot}%{_datadir}/penmon/penmon %doc LICENSE %changelog +* Sat Jul 24 2021 Silvan Calarco 20180914git-6mamba +- update autorotate patch for python3 pyudev 0.22 + * Mon Dec 21 2020 Silvan Calarco 20180914git-5mamba - rebuilt with python3