#!/bin/sh
#===============================================================================
#
#  adc
#
#  Copyright (C) 2009 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: handle ADC nodes
#
#===============================================================================

dev_table="
/dev/adc     d    755    0    0
/dev/adc/    c    644    0    0    %s    0    0    1    %s
"

case "${ACTION}" in
add)
	major="$(sed -ne 's,\([^[:blank:]\+]\)[[:blank:]].*adc.*,\1,g;T;p' /proc/devices)"
	[ "${MDEV}" = "s3c2443-adc" ] && channels="10"
	[ "${MDEV}" = "adc-ns9215" ] && channels="8"
	if [ -n "${major}" -a -n "${channels}" ]; then
		printf "${dev_table}" "${major}" "${channels}" | makedevs / >/dev/null 2>&1
	fi
	;;
remove)
	[ -d "/dev/adc" ] && rm -rf /dev/adc
	;;
esac
