Skip to content

Commit 6cf9d60

Browse files
committed
Merge branch 'github-pull-38'
Add guess module to detect modules for touchscreen devices. Link: #38 Signed-off-by: Alexey Gladkov <[email protected]>
2 parents b2850a6 + d90bd26 commit 6cf9d60

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

guess/touchscreen/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Guess module: touchscreen
2+
3+
This module tries to guess modules for touchscreen devices.
4+
5+
Touchscreen modules may be necessary, for example, if you
6+
need to enter a password to unlock an encrypted mobile device.

guess/touchscreen/action

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/bin/bash -eu
2+
# SPDX-License-Identifier: GPL-3.0-or-later
3+
4+
. guess-functions
5+
6+
$TRACE_SOURCE "Processing ..."
7+
8+
# The idea comes from tslib. Touchscreen devices have
9+
# the INPUT_PROP_DIRECT property, which is determined
10+
# by the first from zero bit of the property number
11+
12+
INPUT_PROP_DIRECT=1
13+
bitmask=$((1 << $INPUT_PROP_DIRECT))
14+
15+
for i in "$SYSFS_PATH"/class/input/event*/device/properties; do
16+
[ -f "$i" ] ||
17+
continue
18+
19+
readline prop "$i"
20+
21+
(($prop & $bitmask)) ||
22+
continue
23+
24+
p="$(readlink -e "$i")"
25+
26+
while [ "$p" != "$SYSFS_PATH"/devices ]; do
27+
if [ -f "$p"/modalias ]; then
28+
readline alias "$p"/modalias
29+
guess_modalias "$alias"
30+
fi
31+
p="${p%/*}"
32+
done
33+
done

guess/touchscreen/rules.mk

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: GPL-3.0-or-later
2+
.PHONY: guess-touchscreen
3+
4+
guess-touchscreen:
5+
$V echo "Processing $@ ..."
6+
@ GUESS_SUFFIX=rescue:$@ \
7+
$(DETECTDIR)/touchscreen/action
8+
9+
guess: guess-touchscreen

0 commit comments

Comments
 (0)