Reply
Thread Tools
qwerty12's Avatar
Posts: 4,274 | Thanked: 5,358 times | Joined on Sep 2007 @ Looking at y'all and sighing
#121
Johnx:

I hacked your a2dp script

I made the toggle function work for XMMS too so you can now toggle both XMMS and mplayer with one command

If you use Bundyo's build of Mplayer, it requires afm=libmad,dspmp3 line too otherwise you hear loud horrible screeching. I found this out at 12AM >.<

So I made script append that line too.

Also, I would find that disabling a2dp would not bring back my previous config, I would be left with a blank file, so I set symlink to the .bak file which was my previous config and it works perfectly

Code:
#!/bin/sh

if [ -h ~/.mplayer/config ]
then
	if $(grep -q bluetooth ~/.mplayer/config)
	then
		#echo "We are enabled."
		enabled=1
	fi
	rm ~/.mplayer/config
else
	if [ ! -d ~/.mplayer ]
	then
		mkdir -p ~/.mplayer
	else
		if [ -e ~/.mplayer/config ]
		then
			mv ~/.mplayer/config ~/.mplayer/config.bak
		else
			if [ ! -e ~/.mplayer/config.bt ] || [ ! -e ~/.mplayer/config.def ]
			then
				echo "ao=alsa:device=bluetooth" > ~/.mplayer/config.bt
				echo "afm=libmad,dspmp3" >> ~/.mplayer/config.bt
				echo "" > ~/.mplayer/config.def
			fi
		fi
	fi
fi
	
	
case "$1" in
	"firstrun" | "first" | "runfirst" )
		echo "Welcome to the A2DP setup program."
		echo "This program will help you get a2dp working on your N8x0."
		echo "If you already have it setup just hit Ctrl-c now to exit."
		echo "Before we get started:"
		echo "Have you paired your headphones to your N8x0 yet?"
		echo "Do you have their bluetooth address handy?"
		echo "If you answered yes to both of these questions, "
		echo "then type in that address now."
		echo "Otherwise just hit Ctrl-c to exit"
		echo -n "BT address:"
		read btaddress
		if [ -e ~/.asoundrc ] ; then
			mv ~/.asoundrc ~/.asoundrc.bak
		fi
		echo "pcm.bluetooth {" > ~/.asoundrc
		echo "profile a2dp" >> ~/.asoundrc
		echo "type bluetooth" >> ~/.asoundrc
		echo -n "device " >> ~/.asoundrc
		echo $btaddress >> ~/.asoundrc
		echo "}" >> ~/.asoundrc
		;;

	"enable" )
		sed -i 's/^pcm_device=default/pcm_device=bluetooth/' ~/.xmms/config
		ln -s ~/.mplayer/config.bt ~/.mplayer/config
		run-standalone.sh dbus-send --print-reply  \
 		--type=method_call --dest=org.freedesktop.Notifications  \
 		/org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog  \
 		string:'A2DP enabled!' uint32:0 string:'Rock on!' 2> /dev/null 1> /dev/null
		;;
	"disable" )
		sed -i 's/^pcm_device=bluetooth/pcm_device=default/' ~/.xmms/config
		ln -s ~/.mplayer/config.bak ~/.mplayer/config
		run-standalone.sh dbus-send --print-reply  \
                --type=method_call --dest=org.freedesktop.Notifications  \
                /org/freedesktop/Notifications org.freedesktop.Notifications.SystemNoteDialog  \
                string:'A2DP disabled.' uint32:0 string:'Ok' 2> /dev/null 1> /dev/null
		;;
	"toggle" )
		if [ $enabled  -eq 1 ] ; then
			#"Calling $0 to disable"
			$0 disable
		else
			#"Calling $0 to enable"
			$0 enable
		fi
		;;
	* )
		echo "$0 usage: runfirst | enable | disable | toggle | --help"
		;;
esac
EDIT: "mega" script uploaded. OTT for most ppl imho though.
Mega script working - tested just now.
Remove .zip

The "mega" script is NOT the one above. It has the code of the one above with some more added stuff in.
Attached Files
File Type: zip mega.tar.gz.zip (1.8 KB, 212 views)

Last edited by qwerty12; 2008-04-08 at 16:24.
 

The Following 3 Users Say Thank You to qwerty12 For This Useful Post:
Posts: 207 | Thanked: 31 times | Joined on Apr 2008
#122
Do anybody know how to setup AVRCP?
When I used a2dpd daemon I put in ~/.a2dprc
cmdplay=mpc play
cmdpause=mpc pause
cmdprev=mpc prev
cmdnext=mpc next
cmdnew=mpc play
cmdstop=mpc stop
Now I think it must be sets via dbus.
I found http://bluez.cvs.sourceforge.net/*ch.../audio-api.txt
....
org.bluez.audio.Control interface
=================================

[not yet implemented]

This interface is available for remote devices which implement support for a
AVRCP controller.
....
Does this means that AVRCP doesn't available

Last edited by svs57; 2008-04-08 at 16:53.
 
Posts: 58 | Thanked: 20 times | Joined on Nov 2007
#123
Originally Posted by IcelandDreams View Post
As for a BT dongle plugged into the audio jack, that is reasonable except again, the call/etc buttons don't work. If I have to pull the IT out of the pocket and find the answer call button and to speak into the mic then having BT serves little purpose except for music.
I use a Moto S9 with Moto Z6m and Sony A2DP dongle plugged into N800. With only the phone turned on, pair both functions with the S9. Then, shut down the phone so the S9 goes back in search mode. Pair the A2DP only dongle with the S9, which overwrites the phone paring A2DP profile only and pairs S9 with the dongle without destroying the phone's handsfree pairing. Turn off the S9 leaving the phone and dongle searching for its mate. Turn the S9 back on and it will pair handsfree with the phone and A2DP with the dongle, including the phone's controls. It even suspends the dongle's audio from the N8xx during the phone calls and restores it when the phone call is over.

From that point on, make sure the phone and dongle are on before turning on the S9 and it will always pair with both. It will no longer pair with the phone's A2DP profile if the dongle is off, but stops searching for the dongle as soon as the phone only pairs if the dongle isn't there to pair with.

The biggest advantage of the dongle is I can now play stereo from ANY audio device through the S9 without the constant pairing...mp3 players, my home stereo, even the phone with the dongle plugged into the phone's stereo jack. Too bad S9 is too stupid to only allow one pairing.

Works great...(c;
 
IcelandDreams's Avatar
Posts: 228 | Thanked: 30 times | Joined on Mar 2008 @ Ontario & Iceland
#124
^ that's all well and good but it still leaves the problem of using the S9 as a hands free *and* A2DP on the N8. As far as I can tell the nifty A2DP transmitters are A2DP only and with 3 conductors they aren't going to provide voice.

And here's why this won't work for me; I don't own a cell phone and likely never will as long as the providers remain braindead and evil in Canada. And don't even think about data services over cell. Luckily we have lots of WiFI.

I bought the N800 to be the do all be all device. I use a SIP account as my primary phone. This is working very well and when I'm in WiFI range the quality equals or surpasses that of any cell phone.

The thing I'd like to do now is to go wireless between the pocket and ear. I can do BT for voice but can't easily do BT for voice and stereo at the same time. The ear bud thing so far is the only thing that works well enough.
 
Posts: 58 | Thanked: 20 times | Joined on Nov 2007
#125
[QUOTE=IcelandDreams;167395]^ that's all well and good but it still leaves the problem of using the S9 as a hands free *and* A2DP on the N8. As far as I can tell the nifty A2DP transmitters are A2DP only and with 3 conductors they aren't going to provide voice. [QUOTE]

when I upgraded my N800 from os07 to 08, I was interested in paring the S9 to the tablet, directly. I was very disappointed to find it paired to the left earphone as a handsfree device....without paring as A2DP. I've read about all the hacking to make it A2DP.

After reading your post, I paired the tablet to the S9 and it pairs as a handsfree only. So, when I turned on the Sony A2DP transmitter and plugged it into the N800 phone jack, I got my stereo AND the handsfree audio from the N800, too. Not sure what good this will do, because Skype is MUCH better to use on A2DP with the Sony BT transmitter than on handsfree because the stupid S9 only uses the left earphone on handsfree, a gross error on Motorola's part, me thinks.

Even without the Sellphone, the N800 is MUCH better with the Sony plugged into its headphone jack to the S9....hands down.
 
Posts: 24 | Thanked: 4 times | Joined on Jan 2008
#126
This didn't work for me; have I missed something?

I have an N800 with a recent OS2008.

I created ~user/.asoundrc to look like this:
pcm.bluetooth {
type bluetooth
profile a2dp
device 00:EE:BB:15:81:BB
}

I've verified that the address is correct. although I've changed it for paranoia purposes.

Tried with and without the modifications to hcid.conf and audio.conf - but I'm still only getting the tinny sound in the left speaker of my Motorola stereo BT phones.

Running (as 'user'):

mplayer -ao alsa:device=bluetooth myvideo.avi

.. gives no sound and:

alsa-lib: pcm_bluetooth.c:1158bluetooth_cfg) Error 22 while configuring device
alsa-init: playback open error: Invalid argument
Could not open/initialize audio device -> no sound.
Audio: no sound


Have I missed a step?

Cheers
James
 
Johnx's Avatar
Posts: 643 | Thanked: 628 times | Joined on Mar 2007 @ Seattle (or thereabouts)
#127
Have you rebooted yet (after making the change to hcid.conf)?
 
Posts: 24 | Thanked: 4 times | Joined on Jan 2008
#128
Yes, I did restart it.
 
Posts: 24 | Thanked: 4 times | Joined on Jan 2008
#129
Apologies - it does actually work. I must have rolled back to a previous version of audio.config at some point - anyway, when I checked, I found that the Disable=Sink line wasn't commented out.

After fixing that, it's good & loud, and in acceptably clear stereo! No skipping so far, watching 400x280 video.

Still need to tweak the audio delay though.
 
Posts: 19 | Thanked: 3 times | Joined on Jun 2008
#130
Ok, I have a2dp working nearly flawlessly with kagu on an n810 it took me nearly 3 days to find a perfect install solution. I have no idea if anyone is still struggleing with this but please let me know if anyone would like a proper howto for it.

bear in mind the following:

1> it still eats up proc time...
2> it ONLY works with kagu, and excludes system sounds... so its only good for listening to music.
3> after installed and configured kicking over to BT headset is as easy as hitting a button inside kagu. all you have to do it open kagu, turn on your headphones and click a "Bluetooth" icon, that's it.

let me know.
 
Reply


 
Forum Jump


All times are GMT. The time now is 01:07.