Root/binaries/sie_rootfs_files/root/binaries/test-memory-card.sh

1#!/bin/sh
2# Program:
3# Program trys firstly to detect if uSD card inserted and then
4# mount data
5# History:
6# Author:
7# 2010-08-19 XiangFu Liu, xiangfu@sharism.cc
8
9if [ -b "/dev/mmcblk0" ] ; then
10    echo "there is a memory card present"
11else
12    echo "ERROR - there is no memory card inserted"
13    exit 1
14fi
15
16#make multi-layer directory
17mkdir -p /tmp/card
18
19echo "try to mount mmc card"
20mount /dev/mmcblk0p1 /tmp/card/
21if [ $? == 0 ] ; then
22    echo "mount ok"
23else
24    echo "ERROR - can not do a real mount on memory card"
25    exit 1
26fi
27
28echo "testing ..."
29dd if=/dev/zero of=/tmp/card/testfile bs=1024 count=3096
30if [ $? == 0 ] ; then
31    echo "mount ok"
32else
33    echo "ERROR - can not do a real test for mounting memory card"
34    exit 1
35fi
36
37rm -rf /tmp/card/testfile
38umount /tmp/card
39echo "test done"
40
41
42

Archive Download this file

Branches:
master



interactive