Project

General

Profile

PowerVR Graphics ยป mityarm_cputype.sh

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

 
#!/bin/sh

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

# Check /dev/i2c-1 through 3 for cpu speed char
# Print i2c device number
ProbeFactoryConfig()
{
i2cDevice=$(
(FactoryConfigReadChar 1 28 >/dev/null && echo 1) ||
(FactoryConfigReadChar 2 28 >/dev/null && echo 2) ||
(FactoryConfigReadChar 3 28 >/dev/null && echo 3)
) || return 1
echo $i2cDevice
}

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

    (1-1/1)