#!/bin/sh
#===============================================================================
#
#  ts
#
#  Copyright (C) 2013 by Digi International Inc.
#  All rights reserved.
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License version 2 as published by
#  the Free Software Foundation.
#
#  !Description: symlink known touchscreen devices
#
#   Values of '/sys/class/input/eventX/device/name':
#
#       i.MX5X: mxc_ts, da9052-tsi, ADS784x, fusion touch
#       i.MX28: mxs-lradc
#
#===============================================================================

# ${ACTION} is empty on scanning mode (mdev -s), exit otherwise
[ -n "${ACTION}" ] && exit

mdev=$(basename ${MDEV})

if grep -qs '\(mxc_ts\|da9052-tsi\|ADS784x\|fusion\|mxs-lradc\|[Tt]ouch\)' \
   /sys/class/input/${mdev}/device/name; then
	ln -sf ${mdev} /dev/input/touchscreen0
fi
