S12remoteaccessory 673 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. ### BEGIN INIT INFO
  3. # Provides:
  4. # Short-Description: Remote USB Accessory Support
  5. # Description: If enabled, support remote usb accessories using socat
  6. ### END INIT INFO
  7. . /opt/wz_mini/etc/rc.common
  8. . /opt/wz_mini/wz_mini.conf
  9. remote() {
  10. wait_for_wlan_ip $(basename "$0")
  11. echo "#####$(basename "$0")#####"
  12. if [[ "$REMOTE_SPOTLIGHT" == "true" ]]; then
  13. /opt/wz_mini/bin/socat pty,link=/dev/ttyUSB0,raw tcp:"$REMOTE_SPOTLIGHT_HOST":9000 &
  14. echo "Remote accessory support enabled"
  15. else
  16. echo "Remote accessory support disabled"
  17. fi
  18. }
  19. case "$1" in
  20. start)
  21. remote &
  22. ;;
  23. stop)
  24. pkill socat
  25. ;;
  26. *)
  27. echo "Usage: $0 {start}"
  28. exit 1
  29. ;;
  30. esac