parport 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. #
  3. # serial 1.7 2001/01/01 21:13:55 (David Hinds)
  4. #
  5. # Initialize or shutdown a PCMCIA parallel device
  6. #
  7. # The first argument should be either 'start' or 'stop'. The second
  8. # argument is the base name for the device.
  9. #
  10. # The script passes an extended device address to 'parallel.opts' in the
  11. # ADDRESS variable, to retrieve device-specific configuration options.
  12. # The address format is "scheme,socket,instance" where "scheme" is the
  13. # PCMCIA configuration scheme, "socket" is the socket number, and
  14. # "instance" is used to number multiple ports on a single card.
  15. #
  16. if [ -r ./shared ] ; then . ./shared ; else . /etc/pcmcia/shared ; fi
  17. # Get device attributes
  18. get_info $DEVICE
  19. # Load site-specific settings
  20. ADDRESS="$SCHEME,$SOCKET,$INSTANCE"
  21. . $0.opts
  22. LP="lp$MINOR"
  23. case "$ACTION" in
  24. 'start')
  25. [ -n "$VERBOSE" -a -n "$INFO" ] && echo "$INFO"
  26. if [ ! -c /dev/$LP ] ; then
  27. log mknod /dev/$LP c $MAJOR $MINOR
  28. fi
  29. if [ -n "$LINK" ] ; then
  30. if [ -L $LINK ] ; then rm $LINK ; fi
  31. log ln -s /dev/$LP $LINK
  32. fi
  33. if [ -n "$LP_OPTS" ] ; then
  34. log tunelp /dev/$LP $LP_OPTS
  35. fi
  36. ;;
  37. 'check')
  38. is_true $NO_CHECK && exit 0
  39. do_fuser -s /dev/$LP /dev/$LP $LINK && exit 1
  40. ;;
  41. 'cksum')
  42. chk_simple "$NEW_SCHEME,$SOCKET,$INSTANCE" || exit 1
  43. ;;
  44. 'stop')
  45. do_fuser -k /dev/$LP $LINK > /dev/null
  46. if [ -L "$LINK" ] ; then rm $LINK ; fi
  47. ;;
  48. 'suspend')
  49. do_fuser -k -STOP /dev/$LP > /dev/null
  50. ;;
  51. 'resume')
  52. if [ -n "$LP_OPTS" ] ; then
  53. tunelp /dev/$LP $LP_OPTS
  54. fi
  55. do_fuser -k -CONT /dev/$LP $LINK > /dev/null
  56. ;;
  57. *)
  58. usage
  59. ;;
  60. esac
  61. exit 0