{"id":42,"date":"2009-03-26T10:59:20","date_gmt":"2009-03-26T10:59:20","guid":{"rendered":"http:\/\/ccgi.ekers.free-online.co.uk\/wordpress\/?p=42"},"modified":"2009-03-26T10:59:20","modified_gmt":"2009-03-26T10:59:20","slug":"linux-bluetooth-audio-using-alsa-and-a2dp","status":"publish","type":"post","link":"https:\/\/ekers.co.uk\/index.php\/2009\/03\/26\/linux-bluetooth-audio-using-alsa-and-a2dp\/","title":{"rendered":"Linux bluetooth audio: using alsa and a2dp"},"content":{"rendered":"<p>I got a pair of bluetooth headphones for Christmas, and they have made listening to music so much easier. The model is Zoom 4380. I used them with my phone, and the absence of wires from the phone (and the little drop-down speaker stalk) makes calling cool too.<\/p>\n<p>The only problem I have atm is resuming music from the headphones, once it has stopped.<\/p>\n<p>Anyway, the purpose of this thing here is using these headphones with Gentoo. In the end, the setup seemed easy. The journey wasn&#8217;t&#8230;<br \/>\n<!--more--><br \/>\nSimple steps:<\/p>\n<ol class=\"numbered-list\">\n<li class=\"cat-item\">Get alsa working. See the gentoo howto <a href=\"http:\/\/www.gentoo.org\/doc\/en\/alsa-guide.xml\">here<\/a><\/li>\n<li>Get normal bluetooth working: <a href=\"http:\/\/www.gentoo.org\/doc\/en\/bluetooth-guide.xml\">here<\/a>. I needed to make bluez-utils with the &#8220;test-programs&#8221; USE flag, so passkey-agent is built.<\/li>\n<li>Get the address for the headphones. Use the command<br \/>\n<blockquote><p>hcitool scan<\/p><\/blockquote>\n<\/li>\n<li>Create a local alsa settings file, ~\/.asoundrc. The <em>XX:XX..<\/em> should be replaced with address you found in the last step.<br \/>\n<blockquote><p>\npcm.bluetooth {<br \/>\n  type bluetooth<br \/>\n  device XX:XX:XX:XX:XX:XX<br \/>\n  profile &#8220;auto&#8221;<br \/>\n}\n<\/p><\/blockquote>\n<\/li>\n<li>The main problem I had for quite a while was getting the pin into system, when you start playing a file. Eventually, I tried the following passkey-agent line:<br \/>\n<blockquote><p>passkey-agent &#8211;default 0000 XX:XX:XX:XX:XX:XX<\/p><\/blockquote>\n<p>The XX:XX.. is the address from above, again. The 0000 is the pin for the headphones. You don&#8217;t have to run this as root.\n<\/li>\n<li>Finally, play something. I use mplayer for mp3 and videos, so here is a command line I used:<br \/>\n<blockquote><p>mplayer -ao alsa:device=bluetooth &lt;mp3 file&gt;<\/p><\/blockquote>\n<p>You should hear your music in your headphones.<\/li>\n<li>See <a href=\"http:\/\/wiki.bluez.org\/wiki\/HOWTO\/AudioDevices\">here<\/a> for a much more complete list of supported players using this method.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>I got a pair of bluetooth headphones for Christmas, and they have made listening to music so much easier. The model is Zoom 4380. I used them with my phone, and the absence of wires from the phone (and the little drop-down speaker stalk) makes calling cool too. The only problem I have atm is [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":0,"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"wp:attachment":[{"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekers.co.uk\/index.php\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}