特殊:Badtitle/NS100:BluetoothHeadset
文章出处: |
{{#if: | {{{2}}} | https://help.ubuntu.com/community/BluetoothHeadset }} |
点击翻译: |
English {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/af | • {{#if: UbuntuHelp:BluetoothHeadset|Afrikaans| [[::BluetoothHeadset/af|Afrikaans]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ar | • {{#if: UbuntuHelp:BluetoothHeadset|العربية| [[::BluetoothHeadset/ar|العربية]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/az | • {{#if: UbuntuHelp:BluetoothHeadset|azərbaycanca| [[::BluetoothHeadset/az|azərbaycanca]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/bcc | • {{#if: UbuntuHelp:BluetoothHeadset|جهلسری بلوچی| [[::BluetoothHeadset/bcc|جهلسری بلوچی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/bg | • {{#if: UbuntuHelp:BluetoothHeadset|български| [[::BluetoothHeadset/bg|български]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/br | • {{#if: UbuntuHelp:BluetoothHeadset|brezhoneg| [[::BluetoothHeadset/br|brezhoneg]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ca | • {{#if: UbuntuHelp:BluetoothHeadset|català| [[::BluetoothHeadset/ca|català]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/cs | • {{#if: UbuntuHelp:BluetoothHeadset|čeština| [[::BluetoothHeadset/cs|čeština]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/de | • {{#if: UbuntuHelp:BluetoothHeadset|Deutsch| [[::BluetoothHeadset/de|Deutsch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/el | • {{#if: UbuntuHelp:BluetoothHeadset|Ελληνικά| [[::BluetoothHeadset/el|Ελληνικά]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/es | • {{#if: UbuntuHelp:BluetoothHeadset|español| [[::BluetoothHeadset/es|español]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/fa | • {{#if: UbuntuHelp:BluetoothHeadset|فارسی| [[::BluetoothHeadset/fa|فارسی]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/fi | • {{#if: UbuntuHelp:BluetoothHeadset|suomi| [[::BluetoothHeadset/fi|suomi]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/fr | • {{#if: UbuntuHelp:BluetoothHeadset|français| [[::BluetoothHeadset/fr|français]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/gu | • {{#if: UbuntuHelp:BluetoothHeadset|ગુજરાતી| [[::BluetoothHeadset/gu|ગુજરાતી]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/he | • {{#if: UbuntuHelp:BluetoothHeadset|עברית| [[::BluetoothHeadset/he|עברית]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/hu | • {{#if: UbuntuHelp:BluetoothHeadset|magyar| [[::BluetoothHeadset/hu|magyar]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/id | • {{#if: UbuntuHelp:BluetoothHeadset|Bahasa Indonesia| [[::BluetoothHeadset/id|Bahasa Indonesia]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/it | • {{#if: UbuntuHelp:BluetoothHeadset|italiano| [[::BluetoothHeadset/it|italiano]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ja | • {{#if: UbuntuHelp:BluetoothHeadset|日本語| [[::BluetoothHeadset/ja|日本語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ko | • {{#if: UbuntuHelp:BluetoothHeadset|한국어| [[::BluetoothHeadset/ko|한국어]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ksh | • {{#if: UbuntuHelp:BluetoothHeadset|Ripoarisch| [[::BluetoothHeadset/ksh|Ripoarisch]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/mr | • {{#if: UbuntuHelp:BluetoothHeadset|मराठी| [[::BluetoothHeadset/mr|मराठी]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ms | • {{#if: UbuntuHelp:BluetoothHeadset|Bahasa Melayu| [[::BluetoothHeadset/ms|Bahasa Melayu]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/nl | • {{#if: UbuntuHelp:BluetoothHeadset|Nederlands| [[::BluetoothHeadset/nl|Nederlands]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/no | • {{#if: UbuntuHelp:BluetoothHeadset|norsk| [[::BluetoothHeadset/no|norsk]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/oc | • {{#if: UbuntuHelp:BluetoothHeadset|occitan| [[::BluetoothHeadset/oc|occitan]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/pl | • {{#if: UbuntuHelp:BluetoothHeadset|polski| [[::BluetoothHeadset/pl|polski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/pt | • {{#if: UbuntuHelp:BluetoothHeadset|português| [[::BluetoothHeadset/pt|português]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ro | • {{#if: UbuntuHelp:BluetoothHeadset|română| [[::BluetoothHeadset/ro|română]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/ru | • {{#if: UbuntuHelp:BluetoothHeadset|русский| [[::BluetoothHeadset/ru|русский]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/si | • {{#if: UbuntuHelp:BluetoothHeadset|සිංහල| [[::BluetoothHeadset/si|සිංහල]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/sq | • {{#if: UbuntuHelp:BluetoothHeadset|shqip| [[::BluetoothHeadset/sq|shqip]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/sr | • {{#if: UbuntuHelp:BluetoothHeadset|српски / srpski| [[::BluetoothHeadset/sr|српски / srpski]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/sv | • {{#if: UbuntuHelp:BluetoothHeadset|svenska| [[::BluetoothHeadset/sv|svenska]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/th | • {{#if: UbuntuHelp:BluetoothHeadset|ไทย| [[::BluetoothHeadset/th|ไทย]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/tr | • {{#if: UbuntuHelp:BluetoothHeadset|Türkçe| [[::BluetoothHeadset/tr|Türkçe]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/vi | • {{#if: UbuntuHelp:BluetoothHeadset|Tiếng Việt| [[::BluetoothHeadset/vi|Tiếng Việt]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/yue | • {{#if: UbuntuHelp:BluetoothHeadset|粵語| [[::BluetoothHeadset/yue|粵語]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/zh | • {{#if: UbuntuHelp:BluetoothHeadset|中文| [[::BluetoothHeadset/zh|中文]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/zh-hans | • {{#if: UbuntuHelp:BluetoothHeadset|中文(简体)| [[::BluetoothHeadset/zh-hans|中文(简体)]]}}|}} {{#ifexist: {{#if: UbuntuHelp:BluetoothHeadset | UbuntuHelp:BluetoothHeadset | {{#if: | :}}BluetoothHeadset}}/zh-hant | • {{#if: UbuntuHelp:BluetoothHeadset|中文(繁體)| [[::BluetoothHeadset/zh-hant|中文(繁體)]]}}|}} |
{{#ifeq:UbuntuHelp:BluetoothHeadset|:BluetoothHeadset|请不要直接编辑翻译本页,本页将定期与来源同步。}} |
{{#ifexist: :BluetoothHeadset/zh | | {{#ifexist: BluetoothHeadset/zh | | {{#ifeq: {{#titleparts:BluetoothHeadset|1|-1|}} | zh | | }} }} }} {{#ifeq: {{#titleparts:BluetoothHeadset|1|-1|}} | zh | | }}
Stolen from HyRax1 on the Overclockers forum. Don't forget to send him a nice thank you note for this.
Purpose
This guide should help you redirect music, audio and media players to your Bluetooth headset. To make this work properly, all audio will have to be redirected through the PulseAudio Server
Prerequisites
- Bluetooth interface to your PC
- Ubuntu Hardy
- Internet access or other such access to the Ubuntu repositories to install extra software from
- Suitable Bluetooth headset. Should support Bluetooth 1.2 and 2.0, and the headset, handsfree A2DP and AVRCP profiles (typical function set of any headset/handsfree unit these days)
Instructions
These instructions should be adaptable to other distributions.
- Plug in or enable your Bluetooth adapter. Your Bluetooth adapter will be automatically detected and drivers loaded - there is nothing for you to do manually here.
- If you have NEVER used Bluetooth on your Ubuntu setup before, then go to the next step, otherwise skip to Step 11 because you're probably already setup properly.
- Open a terminal window
- Verify that your Bluetooth adapter is running with:
hciconfig -a
If you get details about hci0 listed including manufacturer's name, then your adapter is working
- Type in the following to edit your Bluetooth configuration file:
sudo gedit /etc/bluetooth/hcid.conf
This will bring up the Bluetooth configuration into the GEdit text editor
- Change the following:
- security user line to read security auto
- passkey “1234” to passkey “0000”
- Save and exit
- Restart Bluetooth by typing the following into the Terminal window:
sudo /etc/init.d/bluetooth restart
When you do this, an informational bubble will appear in your task bar saying <hostname>-0 Device has been made connectable E.g.: If your PC's name is gordon, the message would say gordon-0 Device has been made connectable
- Turn on your Bluetooth headset, but don't go into pairing mode just yet
10. Scan for Bluetooth devices by typing the following into a terminal:
hcitool scan
Your PC will now scan for local Bluetooth devices and your headset should appear in the resulting list after a few seconds (along with anyone's Bluetooth-enabled mobile phones that are in range). The output will look something like:
$ hcitool scan Scanning ... 00:11:22:AA:BB:CC Nokia N95 00:33:44:DD:EE:FF BT81
In this example, my PC has found my Nokia mobile phone and my Bluetooth headset and shown me the MAC addresses for both of them. NOTE: If your headset does NOT appear, you probably already have it paired with something else, like your mobile phone. In this case, switch the headset to pairing mode and then run the scan again. 11. Copy the MAC address of the headset. Then type into a Terminal window:
sudo gedit ~/.asoundrc
Note the period before asoundrc. This will create a new hidden text file called .asoundrc in the root of your Home directory and open GEdit so you can add to it. The file is hidden because of the leading period. 12. In the text editor, type in the following, replacing the MAC address with the one you copied earlier:
pcm.bluetooth { type bluetooth device 00:33:44:DD:EE:FF profile “auto” }
13. Save and exit 14. Enable sound drivers by typing the following into a terminal:
sudo hciconfig hci0 voice 0x0060 sudo modprobe snd_bt_sco sudo modprobe sco
This will enable sound on your adapter and load the modules necessary to carry bluetooth audio. Note that the two modprobe lines will only enable Bluetooth audio temporarily until you reboot. If you would like to load the drivers automatically on each boot, only add the two modprobe lines above to the end of the /etc/modules file (sudo gedit /etc/modules). Save and exit. 15. Now we need to tell PulseAudio that your Bluetooth headset exists by running the following commands in a terminal:
pactl load-module module-alsa-sink device=bluetooth pactl load-module module-alsa-source device=bluetooth
This is only temporary. Make an executable script to run just after you pair your Bluetooth headset by copying the previous commands into a text file and saving it with executable permissions. Right mouse click on the Bluetooth icon in your system tray and choose Preferences, select the Services tab and ensure Audio Service is enabled. If not, check the box and then close the window. 16. Check soundcards by typing the following into a terminal:
sudo cat /proc/asound/cards
You should see similar output:
0 [I82801DBICH4 ]: ICH4 - Intel 82801DB-ICH4 Intel 82801DB-ICH4 with STAC9750,51 at irq 5 1 [Headset ]: Bluetooth SCO - BT Headset BT Headset 1
This shows us that the system is ready to use the Bluetooth headset as device 1 (but we haven't paired it yet, so technically it won't be able to use it just yet). 17. Switch your headset into pairing mode (refer to your headset's manual) 18. Play a test sound by typing the following into a terminal:
aplay -D bluetooth -f s16_le /usr/share/sounds/login.wav
This will attempt direct communication with your headset and you should hear the familiar Ubuntu login sound play through your headset. Unfortunately only aplay will play anything through your headset. All other sounds are still coming through your speakers. Unless the application in question can redirect audio to another detected device, it will always play through the standard-out, so applications such as Totem and Rhythmbox will still output via your speakers and not give a hoot about your Bluetooth headset. To fix this, we need to make use of the PulseAudio Server which can redirect output to another device. The PulseAudio Server is already installed by default in Ubuntu Hardy, so we just need to install some tools to manipulate it. 19. Install new PulseAudio-related software by typing the following in a terminal:
sudo apt-get install paprefs paman padevchooser
20. Switch to PulseAudio by going into System | Preferences | Sound. Go into the Devices tab and change the Sound playback option for everything from Autodetect to PulseAudio Sound Server. Close 21. Test the PulseAudio sound by playing an MP3 or video or anything. This confirms that PulseAudio is working in general. 22. Open the PulseAudio Device Chooser by going to Applications | Sound & Video | PulseAudio Device Chooser. This will add a black microphone jack icon to your system tray 23. Open the PulseAudio Manager by left-clicking on the jack icon and choosing Manager. If not already connected, click on the Connect button. 24. Check the Devices tab and under Sinks you should see an entry for alsa_output.bluetoot. This is picked up directly from your .asoundrc file. Now go to the Sample Cache tab. At the bottom is a Playback on drop-down. Choose Bluetooth from this list and click on the Play button. You should hear the Ubuntu login sound through your speakers. This proves to us that PulseAudio can play through your Bluetooth headset (but this is NOT the redirection - this is just a test) 25. Close the PulseAudio Manager 26. Do another left-click on the mic jack icon in your system tray and go to Default Sink and then choose Other from the sub-menu. In the new window that opens type in:
alsa_output.bluetooth
Click OK 27. Test the redirection by playing an MP3 or video or anything. You should now hear sound from your Bluetooth headset. 28. Switch back to your speakers by left-clicking on the mic jack icon in your system tray and go to Default Sink and then choose Default