summaryrefslogtreecommitdiff
path: root/target/linux/au1000/base-files/lib/au1000.sh
blob: 556598dbc15deaad254cb37d20e5d59b6e7b2492 (plain)
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
57
58
59
#!/bin/sh

au1000_yamonenv_getvar()
{
	local varname="$1"
	local partition

	. /lib/functions.sh

	partition="$( find_mtd_part 'yamon env' )"
	YAMONENVFILE="$partition" yamonenv "$varname"
}

au1000_detect()
{
	local line board_name model

	while read line; do
		case "$line" in
			'system type'*)
				break
			;;
		esac
	done <'/proc/cpuinfo'

	case "$line" in
		*' MTX-1')
			# both models appear nearly similar: the 'InternetBox' has
			# the same design but shrinked to 1 PCB and only 1 x miniPCI
			# for WiFi/ath5k and 1 x miniPCI for CardBus/UMTS, they differ
			# in BogoMIPS but there are old MeshCubes with 330 Mhz instead
			# of 400 MHz and no Cube has 'imei' (for UMTS) set in bootloader-env

			if [ -n "$( au1000_yamonenv_getvar 'imei' )" ]; then
				board_name='internetbox'
				model='T-Mobile InternetBox TMD SB1-S'
			else
				board_name='meshcube'
				model='4G Systems AccessCube/MeshCube'
			fi
		;;
		*)
			board_name='unknown'
			model='unknown'
		;;
	esac

	mkdir -p '/tmp/sysinfo'
	echo "$board_name" >'/tmp/sysinfo/board_name'
	echo "$model" >'/tmp/sysinfo/model'
}

au1000_board_name()
{
	local file='/tmp/sysinfo/board_name'

	[ -e "$file" ] || au1000_detect
	cat "$file"
}