castalla wrote: 
> 1.  What procedure did you finally use for pairing & trusting?

Open 2 terminals
Start bluez-simple-agent in one terminal

In the other pair the device with the following:

Code:
--------------------
    hcitool -i hci0 cc 00:11:22:33:44:55 && hcitool auth 00:11:22:33:44:55
  
  bluez-test-audio connect 00:11:22:33:44:55
  bluez-test-device trusted 00:11:22:33:44:55 yes
--------------------


castalla wrote: 
> 2.  Are you running the monitor script on boot?  How do you call it?   I
> have to run it from the command line.

I'm using VAMP as the base image, so Andrew had already created a script
/etc/network/if-up.d/vampstartup that gets fired when the network
interfaces come up and calls /opt/vamp/startup.sh.

I modified it because on Debian 7 it was getting called twice, so I
amended it as follows:


Code:
--------------------
    #!/bin/sh
  # VAMP startup
  
  # Don't bother to do anything for lo.
  if [ "$IFACE" = lo ]; then
  exit 0
  fi
  
  # Only run from ifup.
  if [ "$MODE" != start ]; then
  exit 0
  fi
  
  if mkdir /var/lock/vampstartup
  then
  /opt/vamp/startup.sh &
  fi
  
  exit 0
--------------------


This relies on your OS deleting the contents of /var/lock at startup, so
you want to check that.  Otherwise it'll only launch your startup.sh
script the first time it boots.

/opt/vamp/startup.sh does a number of things, but the key is that it
starts SqueezeLite.  I took the SqueezeLite command out and instead
created another script which I call from startup.sh backgrounded.

So it startup.sh I have a line as follows:


Code:
--------------------
    /opt/vamp/btsqueeze.sh &
--------------------


btsqueeze.sh looks like this:


Code:
--------------------
    #!/bin/bash
  
  # SqueezeLite on Bluetooth script
  
  deviceaddress="00:11:22:33:44:55"
  devicename="BTDEVICENAME"
  
  pid=0
  squeezelite_started=false
  
  sleep 5
  bluez-test-audio connect ${deviceaddress}
  sleep 1
  
  while (sleep 1)
  do
  if [[ $squeezelite_started == false ]] ; then
  connected=$(hcitool con) > /dev/null
  if [[ $connected =~ .*${deviceaddress}.* ]] ; then
  nice -n -5 /usr/sbin/squeezelite -a 10:4 -b 4096:8192 -c flac,pcm,mp3 -o 
${devicename} -r 48000 &
  echo $! > /tmp/squeezelite.pid
  squeezelite_started=true
  echo "${deviceaddress} connected; SqueezeLite started"
  fi
  fi
  
  if [[ $squeezelite_started == true ]] ; then
  connected=$(hcitool con) > /dev/null
  if [[ ! $connected =~ .*${deviceaddress}.* ]] ; then
  pid=$(cat /tmp/squeezelite.pid)
  kill -9 $pid
  rm /tmp/squeezelite.pid
  squeezelite_started=false
  echo "${deviceaddress} disconnected; SqueezeLite stopped"
  fi
  fi
  done
--------------------



Two track 1's and no track 2 after a scan for new and changed? Please
vote for serious scanning bug '17782'
(http://bugs.slimdevices.com/show_bug.cgi?id=17782)
Receiver stuck at blue LED state after reboot? Please vote for bug
'17462' (http://bugs.slimdevices.com/show_bug.cgi?id=17462)
------------------------------------------------------------------------
paulster's Profile: http://forums.slimdevices.com/member.php?userid=23073
View this thread: http://forums.slimdevices.com/showthread.php?t=101872

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix

Reply via email to