OpenCores
URL https://opencores.org/ocsvn/gecko3/gecko3/trunk

Subversion Repositories gecko3

[/] [gecko3/] [trunk/] [GECKO3COM/] [gecko3com-fw/] [examples/] [usbtmc_init.sh] - Blame information for rev 33

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 33 nussgipfel
#! /bin/sh
2
#
3
# usbtmc_init
4
#               a quick and dirty init script for the usbtmc_load
5
#               script. by christoph zimmermann <zac1@bfh.ch>
6
#
7
### BEGIN INIT INFO
8
# Provides:          usbtmc
9
# Default-Start:     2 3 4 5
10
# Default-Stop:      0 1 6
11
# Short-Description: loads the usbtmc kernel module and creates the devnodes
12
# Description:       http://labs.ti.bfh.ch/gecko/wiki/
13
### END INIT INFO
14
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
15
DESC="usbtmc init"
16
NAME="usbtmc"
17
module="usbtmc"
18
 
19
test -x $DAEMON || exit 1
20
 
21
case "$1" in
22
  start|restart)
23
        echo -n "Starting $DESC: "
24
        # Remove module from kernel (just in case it is still running)
25
        /sbin/rmmod $module 2> /dev/null
26
 
27
        # Install module
28
        /sbin/modprobe $module
29
 
30
        # Find major number used
31
        major=$(cat /proc/devices | grep USBTMCCHR | awk '{print $1}')
32
        echo Using major number $major
33
 
34
        # Remove old device files
35
        rm -f /dev/${module}[0-9]
36
 
37
        # Ceate new device files
38
        mknod /dev/${module}0 c $major 0
39
        mknod /dev/${module}1 c $major 1
40
        mknod /dev/${module}2 c $major 2
41
        mknod /dev/${module}3 c $major 3
42
        mknod /dev/${module}4 c $major 4
43
        mknod /dev/${module}5 c $major 5
44
        mknod /dev/${module}6 c $major 6
45
        mknod /dev/${module}7 c $major 7
46
        mknod /dev/${module}8 c $major 8
47
        mknod /dev/${module}9 c $major 9
48
 
49
        # Change access mode
50
        chmod 666 /dev/${module}0
51
        chmod 666 /dev/${module}1
52
        chmod 666 /dev/${module}2
53
        chmod 666 /dev/${module}3
54
        chmod 666 /dev/${module}4
55
        chmod 666 /dev/${module}5
56
        chmod 666 /dev/${module}6
57
        chmod 666 /dev/${module}7
58
        chmod 666 /dev/${module}8
59
        chmod 666 /dev/${module}9
60
 
61
        echo "$NAME."
62
        ;;
63
  stop)
64
        echo -n "Stopping $DESC: "
65
        # Remove module from kernel
66
        /sbin/rmmod $module
67
        echo "$NAME."
68
        ;;
69
  *)
70
        echo "Usage: $0 {start|stop|restart}" >&2
71
        exit 1
72
        ;;
73
esac
74
 
75
exit 0

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.