#!/bin/sh
#
#   Copyright (C) 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.
#
#****************************************************************************

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/home/QtPalmtop/bin
DEV=/dev/mmcda1
MNT=/mnt/card

BUSTYPE=$1
EVENT=$2

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

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

     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
     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

