← Back to team overview

multi-touch-dev team mailing list archive

Re: script to detect MT devices

 

On 08/16/2010 12:52 PM, Henrik Rydberg wrote:
> Hi all, please find enclosed a script that answers the question
>
> "Do I have any MT devices installed?"
>
> The script checks the kernel event devices for their actual capabilities, so any
> driver which uses ABS_MT_POSITION_X, the corner stone of the MT protocol, will
> be listed.
Some polish if you want to include the script in a package.
No MT device on my thinkpad unfortunately :-(

David
--- scan-for-mt-devices.sh.orig	2010-08-16 13:43:12.000000000 +0100
+++ scan-for-mt-devices.sh	2010-08-16 14:31:39.000000000 +0100
@@ -2,6 +2,9 @@
 #
 # This script reports the MT-capable devices present in your system
 #
+
+pushd . > /dev/null
+
 cd /sys/class/input
 typeset -i nbit=64
 typeset -i nhex=$nbit/4
@@ -32,6 +35,15 @@
     done
     has_mt=${mask[0x35]}
     if [ $has_mt = 1 ]; then
+	if [ "X$dev_detected" = "X" ]; then
+		dev_detected = 1
+		echo "Found device(s):" >&2
+	fi
 	echo $name: $dev
     fi
 done
+if [ "X$dev_detected" = "X" ]; then
+	echo "No MT-capable device found..." >&2
+fi
+
+popd > /dev/null

Follow ups

References