#!/bin/sh
#
# MAKEDEV
#
# Create staic Adtec '/dev/*' stuff.
# These are to be retired/removed as each mdoule gets a class device that udev has handle 
#
# Adtec Digital, Inc. (c) 2003-2013
# Andre G Ancelin
# Mike Goins

. /etc/env.global


##############################################################################
# Make sure running as root.
#
  if [ "$UID" -ne 0 ] ; then
   echo "Must run this script as root."
	exit $E_NOT_ROOT
  fi    


cd /dev


##############################################################################
# PAR   - iolite only.
#
#
if [ "$ADTEC_PLATFORM" == "iolite" ]; then

owner_group="0:0"
permission="755"

# Create 'parport' subdirectory.
subdir="parport"
/bin/mkdir $subdir
/bin/chmod $permission $subdir
/bin/chown $owner_group $subdir

# Devices: major & minor.
permission="666"
parallelport="parallelport 233 0"
parchar="parchar 233 10"
for device in "$parallelport" "$parchar"; do
  set -- $device
  /bin/mknod -m$permission $subdir/$1 c $2 $3
done

pars="1 2 3 4 5 6 7 8 9"
for par in $pars; do
  /bin/mknod -m${permission} ${subdir}/parpin${par} c 233 ${par}
done
/bin/chown $owner_group $subdir/*
fi

##################################################
# LEDS   Does not appear to be used
#owner_group="0:0"
#permission="666"

#leds="0 1 2 3 4 5 6 7"
#for led in $leds; do
#  /bin/mknod -m${permission} led${led} c 60 ${led}
#done
#/bin/chown $owner_group led*


##################################################
# SIGMA
#
/bin/mknod -m644 mum0 c 126 0
/bin/mknod -m644 mum1 c 126 1
/bin/mknod -m644 em8xxx0 c 127 0




