Subversion Repositories f9daq

Rev

Blame | Last modification | View Log | RSS feed

#!/bin/sh
#
# Copyright (C) 2005  ARW Elektronik, Germany
#
# This is a small script to generate device node entries at /dev for
# PCICC32 devices. The script uses the entries from /proc/devices.
# This means the driver have to be installed before using the script.
#
# Maintainer: Klaus Hitschler (klaus.hitschler@gmx.de)
#
# $Log: pcicc32_make_devices,v $
# Revision 1.1  2005/10/08 13:23:24  klaus
# release 6.7, added helper script for persistent installation
#
#

module="pcicc32"
device="cc32_"
group="root"
mode="666"

if test $UID -ne 0; then
  echo "ERROR: you must be root to use pcicc32_make_devices!"
  echo ""
  exit -1
fi

# check command line arguments
if test $# -le 0; then
  echo "ERROR: please provide the number of devices per interface type!"
  echo "usage: pcicc32_make_devices n"
  echo ""
  exit -1
fi

# get major number from /proc/devices
major=`cat /proc/devices | awk "\\$2==\"$module\" {print \\$1}"`

# make device nodes
if test "$major"; then
  i=0;
  while test $i -le $1; do
    rm -f /dev/$device$i;
    mknod /dev/$device$i c $major $i;
    chgrp $group /dev/$device$i;
    chmod $mode  /dev/$device$i;
    i=$[$i + 1];
  done;
else
  echo "Please do first a \"insmod pcicc32.ko or insmod pcicc32.o ...\"";
fi

# end of script