From 717c093a78524186ef2714c4d1c1618c18e0e0b3 Mon Sep 17 00:00:00 2001
From: Walmes Zeviani <walmes@ufpr.br>
Date: Sun, 3 Sep 2023 22:33:24 -0400
Subject: [PATCH] Faz a mesa da Huion funcionar.

---
 huion_h1060p_configure.sh | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/huion_h1060p_configure.sh b/huion_h1060p_configure.sh
index 715c990..2ea515b 100644
--- a/huion_h1060p_configure.sh
+++ b/huion_h1060p_configure.sh
@@ -32,9 +32,12 @@ lsusb | grep '256c:006d'
 # Dispositivos Wacom conectados.
 xsetwacom --list devices
 
+ls | head -n 1
+
 # Nome da mesa digitalizadora.
 # WACOM=$(xsetwacom --list devices | grep "STYLUS" | awk '{print gensub(/(.+) stylus.*/, "\\1", "g")}')
-WACOM=$(xsetwacom --list devices | grep "HID 256c:006d stylus" | awk '{print gensub(/(.+) stylus.*/, "\\1", "g")}')
+# WACOM=$(xsetwacom --list devices | grep "HID 256c:006d" | head -n 1 | awk '{print gensub(/(.+) Pen stylus.*/, "\\1", "g")}')
+WACOM="HID 256c:006d"
 echo $WACOM
 
 # Monitores disponíveis.
@@ -57,21 +60,21 @@ echo "Monitor escolhido:"
 echo $MAINMONITOR
 
 # Mapeia a Wacom para o monitor principal.
-if xsetwacom --list devices | grep -q "STYLUS"; then
-    xsetwacom --set "$WACOM stylus" MapToOutput $MAINMONITOR
+if xsetwacom --list devices | grep -q "HID 256c:006d .* STYLUS"; then
+    xsetwacom --set "$WACOM Pen stylus" MapToOutput $MAINMONITOR
 fi
-if xsetwacom --list devices | grep -q "PAD"; then
+if xsetwacom --list devices | grep -q "HID 256c:006d .* PAD"; then
     xsetwacom --set "$WACOM Pad pad" MapToOutput $MAINMONITOR
 fi
 
 # Configura para manter mapeamento isométrico. -------------------------
 
-if xsetwacom --list devices | grep -q "STYLUS"; then
+if xsetwacom --list devices | grep -q "HID 256c:006d .* STYLUS"; then
     # Determina a área do tablet.
     AREALEFT=0
     AREATOP=0
     $(
-        xinput list-props "$WACOM stylus" | \
+        xinput list-props "$WACOM Pen stylus" | \
             grep 'Wacom Tablet Area' | \
             awk '{print gensub(/.*0, 0, ([0-9]+), ([0-9]+)/, "export AREARIGHT=\\1\nexport AREABOTTOM=\\2", "g")}'
     )
@@ -112,7 +115,7 @@ if xsetwacom --list devices | grep -q "STYLUS"; then
     # xsetwacom set "$WACOM" MapToOutput $MAINMONITOR
     # Define a área de trabalho para ter escala 1:1.
     echo "Define área de trabalho para escala isométrica."
-    xsetwacom set "$WACOM stylus" \
+    xsetwacom set "$WACOM Pen stylus" \
               Area $AREALEFT $AREATOP $RESULTRIGHT $RESULTBOTTOM
 fi
 
-- 
GitLab