File: bcm_70012_run.sh

package info (click to toggle)
crystalhd 1%3A0.0~git20110715.fdd2f19-12
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,420 kB
  • sloc: ansic: 66,858; sh: 11,306; cpp: 9,812; makefile: 136
file content (47 lines) | stat: -rw-r--r-- 1,084 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
#
# Author: Prasad Bolisetty
#
# Script to load broadcom 70012 module and create device node.
# 
# 

bcm_dev_bin="crystalhd"
bcm_dev_bin_ko="crystalhd.ko"
bcm_dev_name="crystalhd"
bcm_node="/dev/crystalhd"

if  ! whoami | grep root > /dev/null ; then
	echo " Login as root and try.."	
	exit 1;
fi


if  /sbin/lsmod | grep $bcm_dev_bin > /dev/null ; then
	echo "Stopping Broadcom Crystal HD (BCM70012) Module"
	/sbin/rmmod $bcm_dev_bin >& /dev/null
	if [ $? -ne 0 ]; then
		echo "Failed to stop: Close applications and try again. "
		exit 1;
	fi
fi

bcm_major=`cat /proc/devices | grep "$bcm_dev_name" | cut -c1-3`

if [ -z "$bcm_major" ]; then
	/sbin/insmod $bcm_dev_bin_ko >& /dev/null
	bcm_major=`cat /proc/devices | grep "$bcm_dev_name" | cut -c1-3`
	if [ $? -ne 0 -o -z "$bcm_major" ]; then
		echo "Error($bcm_major): Loading Broadcom Crystal HD (BCM70012) Module"
		rmmod $bcm_dev_bin >& /dev/null
		exit 1;
	fi
fi
if [ -c $bcm_node ]; then
	rm -f $bcm_node >& /dev/null
fi

mknod -m 666 $bcm_node c $bcm_major 0

echo "Broadcom Crystal HD (BCM70012) Module loaded"