test-speaker 435 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. # Turn on Power Amplifier
  3. gpioset $(gpiofind "PA")=1
  4. if [ $? -ne 0 ]; then
  5. echo "ERROR SPEAKER ON"
  6. else
  7. # Play 1kHz sine wave
  8. speaker-test -t sine -s 1 -f 1000 >/dev/null 2>&1
  9. if [ $? -ne 0 ]; then
  10. echo "ERROR SPEAKER SINE"
  11. gpioset $(gpiofind "PA")=0
  12. else
  13. # Turn off Power Amplifier
  14. gpioset $(gpiofind "PA")=0
  15. if [ $? -ne 0 ]; then
  16. echo "ERROR SPEAKER OFF"
  17. else
  18. echo "OK"
  19. fi
  20. fi
  21. fi