update autorotate patch for python3 pyudev 0.22 [release 20180914git-6mamba;Sat Jul 24 2021]

This commit is contained in:
Silvan Calarco 2024-01-05 18:12:41 +01:00
parent 1fff217ccd
commit bffbb611fb
3 changed files with 50 additions and 21 deletions

View File

@ -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" ]

View File

@ -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

View File

@ -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 <silvan.calarco@mambasoft.it>
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 <silvan.calarco@mambasoft.it> 20180914git-6mamba
- update autorotate patch for python3 pyudev 0.22
* Mon Dec 21 2020 Silvan Calarco <silvan.calarco@mambasoft.it> 20180914git-5mamba
- rebuilt with python3