Project

General

Profile

PowerVR Graphics ยป mityarm_cputype.sh

Jonathan Cormier, 11/22/2013 02:26 PM

 
1
#!/bin/sh
2

    
3
# Read a char from the factory config
4
# $1 - /dev/i2c-$1
5
# $2 - byte offset, 28 to 42 is full model number
6
FactoryConfigReadChar()
7
{
8
    hex=$(i2cget -y $1 0x55 $2 2>/dev/null) || return 1
9
    echo $hex | awk '{printf "%c", $1}'
10
}
11

    
12
# Check /dev/i2c-1 through 3 for cpu speed char
13
# Print i2c device number
14
ProbeFactoryConfig()
15
{
16
    i2cDevice=$( 
17
	(FactoryConfigReadChar 1 28 >/dev/null && echo 1) || 
18
	(FactoryConfigReadChar 2 28 >/dev/null && echo 2) || 
19
	(FactoryConfigReadChar 3 28 >/dev/null && echo 3)
20
    ) || return 1
21
    echo $i2cDevice
22
}
23

    
24
# Read factory config for cpu type
25
# Prints 3352, 3354, or 3359
26
i2cDevice=$(ProbeFactoryConfig) || exit $?
27
for i in $(seq 28 31)
28
do
29
    code="$code$(FactoryConfigReadChar $i2cDevice $i)"
30
done
31
echo $code
32

    
    (1-1/1)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)