rc.pcmcia 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #!/bin/sh
  2. # BK jan 2008 for Puppy Linux GPL
  3. #based on script from slackware.
  4. DRIVER=probe
  5. DRIVER_OPTS=
  6. case "$1" in
  7. start)
  8. #/etc/rc.d/rc.modules should have already loaded a base PCMCIA module...
  9. if [ "`lsmod | grep -E '^yenta_socket|^i82365|^tcic'`" != "" ];then
  10. #w003 comment out, as this now done in /etc/udev/rules.d/85-pcmcia.rules
  11. #(which is in pcmciautils pkg, same as this script)
  12. #echo "Starting PCMCIA services:"
  13. #pcmcia-socket-startup
  14. echo #dummy line.
  15. #v4.01 now have /etc/rc.modules2 and /sbin/pup_eventd that load correct modules...
  16. # #v3.96 temp until get udev working...
  17. # if [ "`ls -1 /sys/bus/pcmcia/devices/`" != "" ];then
  18. # for ONEPCMCIA in `ls -1 /sys/bus/pcmcia/devices/ | tr '\n' ' '`
  19. # do
  20. # [ ! -e /sys/bus/pcmcia/devices/$ONEPCMCIA/modalias ] && continue #precaution
  21. # MODALIAS="`cat /sys/bus/pcmcia/devices/$ONEPCMCIA/modalias`"
  22. # REALMOD="`modprobe.bin --show-depends $MODALIAS | tail -n 1`"
  23. # if [ "$REALMOD" != "" ];then
  24. # REALNAME="`basename $REALMOD .ko`"
  25. # /sbin/modprobe $REALNAME
  26. # else
  27. # PROD_ID1="`cat /sys/bus/pcmcia/devices/$ONEPCMCIA/prod_id1`"
  28. # PROD_ID2="`cat /sys/bus/pcmcia/devices/$ONEPCMCIA/prod_id2`"
  29. # #database_old is a hacked file out of the old pcmcia-cs package...
  30. # cat /etc/pcmcia/database_old | grep "\"${PROD_ID1}\"" | grep "\"${PROD_ID2}\"" | grep -o '| bind .*' | tr ',' ' ' | tr ' ' '\n' | grep '^"' | tr '"' ' ' | tr '\n' ' ' > /tmp/pcmciamodules
  31. # sync
  32. # for ONEPCMOD in `cat /tmp/pcmciamodules`
  33. # do
  34. # modprobe $ONEPCMOD
  35. # done
  36. # fi
  37. # done
  38. # fi
  39. fi
  40. ;;
  41. stop)
  42. echo -n "Shutting down PCMCIA services: "
  43. echo -n "cards "
  44. /sbin/pccardctl eject
  45. MODULES=`/sbin/lsmod | grep "pcmcia " | awk '{print $4}' | tr , ' '`
  46. for i in $MODULES ; do
  47. echo -n "$i "
  48. /sbin/modprobe -r $i > /dev/null 2>&1
  49. done
  50. echo -n "pcmcia "
  51. /sbin/modprobe -r pcmcia > /dev/null 2>&1
  52. if [ "$DRIVER" = "probe" ]; then
  53. for DRV in yenta_socket i82365 tcic ; do
  54. grep -qw $DRV /proc/modules && modprobe -r $DRV && \
  55. echo -n "$DRV " && break
  56. done
  57. else
  58. /sbin/modprobe -r $DRIVER > /dev/null 2>&1
  59. fi
  60. echo -n "rsrc_nonstatic "
  61. /sbin/modprobe -r rsrc_nonstatic > /dev/null 2>&1
  62. echo "pcmcia_core"
  63. /sbin/modprobe -r pcmcia_core > /dev/null 2>&1
  64. ;;
  65. restart)
  66. $0 stop
  67. $0 start
  68. ;;
  69. esac