﻿#!/bin/sh
#
# Copyright © 2004 By C-guys, Inc.
# 1-6-3, Roppongi, Minato-ku, Tokyo Japan
#
# This software is protected by the law and the agreement concerning
# a Japanese country copyright method, an international agreement,
# and other intellectual property right and may be used and copied
# only in accordance with the terms of such license and with the inclusion
# of the above copyright notice.
#
# This software or any other copies thereof may not be provided
# or otherwise made available to any other person. No title to
# and ownership of the software is hereby transferred.
#
# The information in this software is subject to change without
# notice and should not be construed as a commitment by C-guys, Inc.
#
#****************************************************************************

export PATH=/sbin:/bin:/usr/sbin:/usr/bin:/home/QtPalmtop/bin
DEV=/dev/mmcda1
MNT=/usr/mnt.rom/card
SDCONTROL=/etc/sdcontrol

BUSTYPE=$1
EVENT=$2

INSTALL_DIR=/home/root/Settings/sd-link11b/res

LOGFILE=/tmp/sd
if [ -f $LOGFILE ]; then

cat >> $LOGFILE << EOF
----------

this is $0

BUSTYPE = $BUSTYPE
EVENT = $EVENT

current environment:
EOF
env >> $LOGFILE

fi

if [ "x"$BUSTYPE != "xsdcard" ]; then exit 0; fi

if [ "x"$BUS = "x" ]; then exit 0; fi
if [ "x"$SLOT = "x" ]; then exit 0; fi

case "x"$EVENT in
xattach)
if [ "x"$HAVE_SDMEMORY != "x" ]; then
if [ "x"$BUS":"$SLOT = "x0:0" ]; then 

#do_umount
#umount $MNT
#mount -o uid=500,gid=500 $DEV $MNT

# for zaurus SL-Cxxx series
$SDCONTROL compeject
$SDCONTROL insert
fi
fi

if [ "x"$HAVE_SDIO != "x" ]; then
if [ "y"$VENDOR":"$PRODUCT = "y0x0092:0x0001" ]; then 
echo "0" > $INSTALL_DIR/qcop.lock
echo "1" > $INSTALL_DIR/status.inf
# qcop QPE/Network 'up()'
fi
fi

;; 

xdetach)
if [ "x"$HAVE_SDMEMORY != "x" ]; then
if [ "x"$BUS":"$SLOT = "x0:0" ]; then 

#do_umount
#umount $MNT

# for zaurus SL-Cxxx series
$SDCONTROL compeject
fi
fi

if [ "x"$HAVE_SDIO != "x" ]; then
if [ "y"$VENDOR":"$PRODUCT = "y0x0092:0x0001" ]; then 
echo "-1" > $INSTALL_DIR/qcop.lock
echo "0" > $INSTALL_DIR/status.inf
# qcop QPE/Network 'down()'
fi
fi

;; 

*)
;;
esac