File: bcm_70012_dev.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 (56 lines) | stat: -rw-r--r-- 1,262 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
48
49
50
51
52
53
54
55
56
#!/bin/bash
#
# Author: Prasad Bolisetty
#
# Script to load broadcom 70012 module and create device node.
# 
# 

bcm_dev_bin="bcm70012"
bcm_dev_name="crystalhd"
bcm_node="/dev/crystalhd"

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

bcm_pci_id=`lspci -d 14e4:1612`
if [ $? -ne 0 -o -z "$bcm_pci_id" ]; then
	echo "BCM 70012 not installed.."
	exit 1;
fi

if  lsmod | grep $bcm_dev_bin > /dev/null ; then
	echo "Stopping Broadcom MediaPC 70012 Module"
	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
	modinfo $bcm_dev_bin >& /dev/null
	if [ $? -ne 0 ]; then
		echo "Broadcom MediaPC 70012 Kernel Module not installed"
		exit 1;
	fi
	modprobe $bcm_dev_bin >& /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 MediaPC 70012 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 MediaPC 70012 Module loaded"