diff options
author | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
---|---|---|
committer | Adrian Dudau <adrian.dudau@enea.com> | 2013-12-12 17:36:38 +0100 |
commit | 2a7348129a42f21095fcd62e47a035f78d254130 (patch) | |
tree | 544dc8019a8f8cb684ace8674193605e607f9964 /recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c | |
download | meta-enea-2a7348129a42f21095fcd62e47a035f78d254130.tar.gz |
Migrated from the internal git server on the dora-enea branch
Signed-off-by: Adrian Dudau <adrian.dudau@enea.com>
Diffstat (limited to 'recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c')
-rwxr-xr-x | recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c new file mode 100755 index 0000000..c4acd8e --- /dev/null +++ b/recipes-test/ddt-runner/files/scripts/bsc9131rdb/i2c | |||
@@ -0,0 +1,75 @@ | |||
1 | #!/bin/sh | ||
2 | # This script is used to test i2c interface for bsc9131rdb | ||
3 | |||
4 | I2C_DETECT=`which i2cdetect` | ||
5 | if [ "x$I2C_DETECT" != "x" ]; then | ||
6 | echo "PASS: i2cdetect found" | ||
7 | else | ||
8 | echo "FAIL: i2cdetect not found" | ||
9 | exit 1 | ||
10 | fi | ||
11 | |||
12 | I2C_SET=`which i2cset` | ||
13 | if [ "x$I2C_SET" != "x" ]; then | ||
14 | echo "PASS: i2cset found" | ||
15 | else | ||
16 | echo "FAIL: i2cset not found" | ||
17 | exit 1 | ||
18 | fi | ||
19 | |||
20 | I2C_GET=`which i2cget` | ||
21 | if [ "x$I2C_GET" != "x" ]; then | ||
22 | echo "PASS: i2cget found" | ||
23 | else | ||
24 | echo "FAIL: i2cget not found" | ||
25 | exit 1 | ||
26 | fi | ||
27 | |||
28 | if I2C_ADAPTERS=`$I2C_DETECT -l |wc -l`; then | ||
29 | echo "PASS: $I2C_ADAPTERS i2c adapters found" | ||
30 | else | ||
31 | echo "FAIL: no i2c adapters found" | ||
32 | exit 1 | ||
33 | fi | ||
34 | |||
35 | adapters=0 | ||
36 | while [ $adapters -lt $I2C_ADAPTERS ] | ||
37 | do | ||
38 | $I2C_DETECT -y $adapters | ||
39 | if [ $? -ne 0 ]; then | ||
40 | echo "FAIL: detect i2c adapter $adapters fail" | ||
41 | else | ||
42 | echo "PASS: detect i2c adapter $adapters success" | ||
43 | fi | ||
44 | adapters=`expr $adapters + 1` | ||
45 | sleep 1 | ||
46 | done | ||
47 | |||
48 | # Area of bus:i2c-0 addr:0x52 is free to read and write | ||
49 | $I2C_SET -y 0 0x52 0 0x55 | ||
50 | if [ $? -eq 0 ]; then | ||
51 | echo "PASS: i2c_set -y 0 0x52 0 0x55 success" | ||
52 | else | ||
53 | echo "FAIL: i2c_set -y 0 0x52 0 0x55 fail" | ||
54 | fi | ||
55 | |||
56 | num=`$I2C_GET -y 0 0x52 0 | grep -c '0x55'` | ||
57 | if [ $num -eq 1 ]; then | ||
58 | echo "PASS: i2c_get -y 0 0x52 0 success" | ||
59 | else | ||
60 | echo "FAIL: i2c_get -y 0 0x52 0 fail" | ||
61 | fi | ||
62 | |||
63 | $I2C_SET -y 0 0x52 0 0xaa | ||
64 | if [ $? -eq 0 ]; then | ||
65 | echo "PASS: i2c_set -y 0 0x52 0 0xaa success" | ||
66 | else | ||
67 | echo "FAIL: i2c_set -y 0 0x52 0 0xaa fail" | ||
68 | fi | ||
69 | |||
70 | num=`$I2C_GET -y 0 0x52 0 | grep -c '0xaa'` | ||
71 | if [ $num -eq 1 ]; then | ||
72 | echo "PASS: i2c_get -y 0 0x52 0 success" | ||
73 | else | ||
74 | echo "FAIL: i2c_get -y 0 0x52 0 fail" | ||
75 | fi | ||