Skip to content

Commit

Permalink
guess: add guessing touchscreen modules
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Shestakov <ved@altlinux.org>
  • Loading branch information
Egor Shestakov committed Jul 26, 2024
1 parent b2850a6 commit 66ce1b7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions guess/touchscreen/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Guess module: touchscreen

This module tries to guess modules for touchscreen devices.
29 changes: 29 additions & 0 deletions guess/touchscreen/action
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash -eu
# SPDX-License-Identifier: GPL-3.0-or-later

. guess-functions

$TRACE_SOURCE "Processing ..."

# The idea comes from tslib. Touchscreen devices have
# the INPUT_PROP_DIRECT property, which is determined
# by the first from zero bit of the property number

INPUT_PROP_DIRECT=1
bitmask=$((1 << $INPUT_PROP_DIRECT))

for i in "$SYSFS_PATH"/class/input/event*/device/ ; do
readline prop "$i"/properties

if (($prop & $bitmask)); then
p="$(readlink -e "$i")"

while [ "$p" != "$SYSFS_PATH"/devices ]; do
if [ -f "$p"/modalias ]; then
readline alias "$p"/modalias
guess_modalias "$alias"
fi
p="${p%/*}"
done
fi
done
9 changes: 9 additions & 0 deletions guess/touchscreen/rules.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-3.0-or-later
.PHONY: guess-touchscreen

guess-touchscreen:
$V echo "Processing $@ ..."
@ GUESS_SUFFIX=rescue:$@ \
$(DETECTDIR)/touchscreen/action

guess: guess-touchscreen

0 comments on commit 66ce1b7

Please sign in to comment.