个人工具

“UbuntuHelp:BluetoothSetup”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
 
(未显示同一用户的2个中间版本)
第1行: 第1行:
 
{{From|https://help.ubuntu.com/community/BluetoothSetup}}
 
{{From|https://help.ubuntu.com/community/BluetoothSetup}}
 
{{Languages|UbuntuHelp:BluetoothSetup}}
 
{{Languages|UbuntuHelp:BluetoothSetup}}
 +
<<Include(Tag/ContentCleanup)>>
 
== Introduction ==
 
== Introduction ==
[http://en.wikipedia.org/wiki/Bluetooth Bluetooth] is finally emerging as a robust and widely supported local area communications technology for short-distance wireless data transfer. Bluetooth is being used for communications with cellphones, cameras, headsets and microphones, keyboards, mice, PDA's and storage devices.
+
[http://en.wikipedia.org/wiki/Bluetooth Bluetooth] is a widely supported local area communications technology for communications with cellphones, headsets, keyboards, mice, PDAs, and storage devices.
 
See also [[UbuntuHelp:BluetoothRemoteControl|BluetoothRemoteControl]] and [[UbuntuHelp:BluetoothAudio|BluetoothAudio]] on Ubuntu.
 
See also [[UbuntuHelp:BluetoothRemoteControl|BluetoothRemoteControl]] and [[UbuntuHelp:BluetoothAudio|BluetoothAudio]] on Ubuntu.
=== Devices ===
+
== Requirements ==
A lot of newer laptops come with Bluetooth support built right in. If you are using a desktop or do not have Bluetooth support built in, you can use a USB Bluetooth dongle to get Bluetooth support.
+
For a desktop or laptop without Bluetooth support use a Bluetooth dongle that connects through a USB.
On some Dell laptops it appears to be necessary to install newest drivers from Dell's support pages in '''Windows''' to get the bluetooth module working under Linux. (At least D430 for with Gutsy / Hardy and D830 and D630 (http://ubuntuforums.org/showthread.php?t=572335 and https://wiki.ubuntu.com/LaptopTestingTeam/DellLatitudeD430#bluetooth)
+
For Dell laptops install the latest drivers from Dell's website in '''Windows''' in order for the bluetooth module to work in Linux. (Required for D430 with Gutsy / Hardy and D830 and D630)
On some Dell laptops which have Dell Wireless 355 Bluetooth card if you turn off the card you have to enable it before you can install it again, this affects both Windows and Linux. You have to use [http://support.euro.dell.com/support/topics/global.aspx/support/dsn/en/document?docid=2D785CBB1BBFF5F1E040A68F5B282502 an utility] in Windows to turn it on before you can install its driver again. If you turn the card off in Windows you have to enable it again or Ubuntu won't recognize it.
+
(http://ubuntuforums.org/showthread.php?t=572335
 +
https://wiki.ubuntu.com/LaptopTestingTeam/DellLatitudeD430#bluetooth)
 +
For Dell laptops with a Dell Wireless 355 Bluetooth card where the card is turned off, reenable the card before installation. Go to [http://support.euro.dell.com/support/topics/global.aspx/support/dsn/en/document?docid=2D785CBB1BBFF5F1E040A68F5B282502 a utility] in Windows to turn it on before you can reinstall the driver. If you turn the card off in Windows reenable the card so Ubuntu can recognize it.
 
== Installation and Configuration ==
 
== Installation and Configuration ==
'''Before you begin''' be sure to try:
+
'''Before you begin''' open up the terminal and type the following:
 
<pre><nowiki>
 
<pre><nowiki>
sudo /etc/init.d/bluetooth start
+
sudo apt-get install bluez && sudo apt-get install bluez-utils
 
</nowiki></pre>
 
</nowiki></pre>
The BlueTooth notification icon starts by default, but sometimes the service does not. The command shown above will start the BlueTooth system service if it isn't already running. Try the command, and then see if your device gets detected. If so, you can now attempt to connect it.
+
Restart the bluetooth server to ensure your pc can communicate with a bluetooth device
'''For Gutsy Gibbon (7.10) and above''' most of the instructions below are obsolete. For 7.10, just plug in your supported adapter and an icon appears in the top right. Right click to setup your preferences. Devices will auto connect to your PC and you can setup security as you connect each device, e.g. your phone.
+
To send files to your phone, install the <code><nowiki>gnome-bluetooth</nowiki></code> package. It will then be found in the accessories menu. Now sending a file is as easy as right clicking the file and select Send-to. To make this run every time you re-boot, select System --> Preferences --> Sessions. Add a Startup program. Call it, lets say, "Bluetooth File Transfer" and in the Command box, enter "gnome-obex-server". Click on OK.
+
=== Bluetooth support for Ubuntu 7.04 and earlier ===
+
Open up a terminal window, and install the requisite packages and their dependencies:
+
 
<pre><nowiki>
 
<pre><nowiki>
  sudo apt-get install bluez-utils
+
sudo /etc/init.d/bluetooth restart
  </nowiki></pre>
+
</nowiki></pre>
Then, connect your Bluetooth device if you are using one. Restart the Bluetooth services by doing:
+
By default the BlueTooth notification icon appears, although the service may not. If the service is not running try the service command, otherwise you can now connect.
 +
'''For jaunty (9:04) and above '''verify you have a supported adapter connected. When the icon appears, right click and configure your preferences. Devices should auto connect to your PC where you configure your security options.
 +
To configure mail for your phone, install the <code><nowiki>gnome-bluetooth</nowiki></code> package so the system finds it in the accessories menu. Send a file by right clicking the file and selecting Send-to. To automate, select System --> Preferences --> Sessions. Add a Startup program. For example you can name it, "Bluetooth File Transfer" and in the Command box, enter "gnome-obex-server". Click OK.
 +
=== Manual Discovery  ===
 +
Open a terminal window and install the required packages with their dependencies:
 
<pre><nowiki>
 
<pre><nowiki>
  sudo /etc/init.d/bluez-utils restart (On some machines - 7.04 feisty at least - it may be sudo /etc/init.d/bluetooth restart)
+
sudo apt-get install bluez-utils
  </nowiki></pre>
+
</nowiki></pre>
Verify that your Bluetooth device has been detected, and the appropriate modules loaded by viewing the lsusb (in case of usb device) output.
+
Connect your Bluetooth device and restart the Bluetooth services:
 +
<pre><nowiki>
 +
sudo /etc/init.d/bluez-utils restart
 +
</nowiki></pre>
 +
Verify your Bluetooth device is detected along with the appropriate modules. View the lsusb (in case of usb device) output:
 
lsusb output:
 
lsusb output:
 
<pre><nowiki>
 
<pre><nowiki>
  Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
+
Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
  </nowiki></pre>
+
</nowiki></pre>
Also, view the output of the command '''hcitool dev''' which will give you a listing of Bluetooth devices on your computer.
+
Review the output of '''hcitool dev''' for all your system's Bluetooth devices.
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconExample48.png
 
https://help.ubuntu.com/community/IconsPage?action=AttachFile&do=get&target=IconExample48.png
 
'''hcitool dev''' output:
 
'''hcitool dev''' output:
第38行: 第45行:
 
   </nowiki></pre>
 
   </nowiki></pre>
 
{i} ''Your Bluetooth device will have a different id.''
 
{i} ''Your Bluetooth device will have a different id.''
If you get all zeros, then try restarting the bluez-utils service and try again.
+
If the id is all zeros, restart the bluez-utils service and retry.
 
== Setup Devices ==
 
== Setup Devices ==
 
=== Find Device Addresses ===
 
=== Find Device Addresses ===
To connect to a Bluetooth device, you will need to find the address of the device. Make the device discoverable (look for a "Connect" button on many keyboards and mice or look in the device's manual) and then search for the device with this command:
+
Locate the device address, make the device discoverable (a "Connect" button for keyboards and mice or check the manual) and search for the device by the following:
 
<pre><nowiki>
 
<pre><nowiki>
  sudo hidd --search
+
sudo hidd --search
 
+
(If that command doesn't work, try this one:)
+
  
 +
(If that command doesn't work, try the following:)
 
   hcitool scan
 
   hcitool scan
  </nowiki></pre>
+
</nowiki></pre>
Each device should have its own address in a aa:bb:cc:dd:ee:ff format.
+
Each device's address has the aa:bb:cc:dd:ee:ff format.
Hint: If no devices are being shown and you are using Edgy Eft (6.10), you may try  
+
Hint: If no devices are shown for Edgy Eft (6.10), try the following:
 
<pre><nowiki>
 
<pre><nowiki>
 
   sudo hciconfig hci0 inqmode 0
 
   sudo hciconfig hci0 inqmode 0
  </nowiki></pre>
+
</nowiki></pre>
See bug [https://launchpad.net/ubuntu/+source/gnome-bluetooth/+bug/70718 #70718]. If this helps, you may add the hciconfig command (without "sudo") to your /etc/rc.local file for a permanent workaround.  
+
See bug [https://launchpad.net/ubuntu/+source/gnome-bluetooth/+bug/70718 #70718]. If this helps, you may add the hciconfig command (without "sudo") to your /etc/rc.local file for a permanent workaround.
 
=== Connect Devices for Current Session Only ===
 
=== Connect Devices for Current Session Only ===
To temporarily connect to a device, use this command where 'aa:bb:cc:dd:ee:ff' is the address of the device you want to connect to:
+
For a temporary connection, use the address of the device 'aa:bb:cc:dd:ee:ff'
 
<pre><nowiki>
 
<pre><nowiki>
  sudo hidd --connect aa:bb:cc:dd:ee:ff
+
sudo hidd --connect aa:bb:cc:dd:ee:ff
  </nowiki></pre>
+
</nowiki></pre>
Your device should now be connected for the current session.  
+
You can now connect.
<!> If you get a <code><nowiki>"Can't create HID control channel: Connection refused"</nowiki></code> error message, most likely the discovery period for the device timed out. Make the device discoverable and enter the above command again, but more quickly.
+
<!> For a <code><nowiki>"Can't create HID control channel: Connection refused"</nowiki></code> error, the discovery period timed out. Try again but enter the command more quickly.
 
=== Connect Devices at Startup ===
 
=== Connect Devices at Startup ===
To connect the device at startup every time, use the following commands to edit the configuration file:
+
To connect automatically, edit the configuration file:
 
<pre><nowiki>
 
<pre><nowiki>
  sudo cp /etc/default/bluetooth /etc/default/bluetooth_backup
+
sudo cp /etc/default/bluetooth /etc/default/bluetooth_backup
  sudo nano /etc/default/bluetooth
+
sudo nano /etc/default/bluetooth
  </nowiki></pre>
+
</nowiki></pre>
Look for the following line:
+
Locate line:
 
<pre><nowiki>
 
<pre><nowiki>
  HIDD_ENABLED=0
+
HIDD_ENABLED=0
  </nowiki></pre>
+
</nowiki></pre>
 
Change it to:
 
Change it to:
 
<pre><nowiki>
 
<pre><nowiki>
  HIDD_ENABLED=1
+
HIDD_ENABLED=1
  </nowiki></pre>
+
</nowiki></pre>
Next, look in the same file for a line similar to:  
+
Look in the same file for a line close to:
 
<pre><nowiki>
 
<pre><nowiki>
  HIDD_OPTIONS="--master --server"
+
HIDD_OPTIONS="--master --server"
  </nowiki></pre>
+
</nowiki></pre>
{i} You can leave the "--master" command or remove it, depending on the device. If you have problems with "--master", try removing it or vice versa.  
+
{i} Leave the "--master" command or remove it, it depends on the device. If you have problems with "--master", remove it or vice versa.
Add additional "--connect" arguments for each device that you want connected at startup so that it looks like this:
+
Add additional "--connect" arguments for the device you want to connect to at startup:
 
<pre><nowiki>
 
<pre><nowiki>
  HIDD_OPTIONS="--connect aa:bb:cc:dd:ee:ff --connect aa:bb:cc:dd:ee:ff --connect aa:bb:cc:dd:ee:ff --server"
+
HIDD_OPTIONS="--connect aa:bb:cc:dd:ee:ff --connect aa:bb:cc:dd:ee:ff --connect aa:bb:cc:dd:ee:ff --server"
  </nowiki></pre>
+
</nowiki></pre>
Save the file.
+
Save and add HIDP to /etc/modules:
Finally, add HIDP to /etc/modules:
+
 
<pre><nowiki>
 
<pre><nowiki>
  echo hidp | sudo tee -a /etc/modules
+
echo hidp | sudo tee -a /etc/modules
  </nowiki></pre>
+
</nowiki></pre>
Your Bluetooth devices should now be connected at startup.
+
Your Bluetooth devices should now connect at startup.
=== Using devices as modems ===
+
=== Using Devices as Modems ===
 
Refer to page [[UbuntuHelp:BluetoothDialup|BluetoothDialup]]
 
Refer to page [[UbuntuHelp:BluetoothDialup|BluetoothDialup]]
 
=== Using audio devices ===
 
=== Using audio devices ===
 
* Refer to page [[UbuntuHelp:BluetoothAudio|BluetoothAudio]]
 
* Refer to page [[UbuntuHelp:BluetoothAudio|BluetoothAudio]]
* For Bluetooth Headsets specically refer to [[UbuntuHelp:BluetoothHeadset|BluetoothHeadset]]
+
* For Bluetooth Headsets specifically refer to [[UbuntuHelp:BluetoothHeadset|BluetoothHeadset]]
 
== Troubleshooting ==
 
== Troubleshooting ==
 
=== "obex://[xx:xx:xx:xx:xx:xx]" is not a valid location. ===
 
=== "obex://[xx:xx:xx:xx:xx:xx]" is not a valid location. ===
If you get this error on gutsy it seems to be fixed with this command:
+
If you receive this error in Gutsy enter the following:
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo apt-get install gnome-vfs-obexftp
 
sudo apt-get install gnome-vfs-obexftp
 
</nowiki></pre>
 
</nowiki></pre>
Although this gives "Couldn't display "obex://[xx:xx:xx:xx:xx:xx]"." for some. See [http://ubuntuforums.org/showthread.php?t=580347 this forum thread] for info. It seems to only be a problem on some phones.
+
Although this gives "Couldn't display "obex://[xx:xx:xx:xx:xx:xx]"." for some.
 +
In this case try:
 +
<pre><nowiki>
 +
sudo hciconfig hci0 auth
 +
</nowiki></pre>
 +
See [http://ubuntuforums.org/showthread.php?t=580347 this forum thread] for information.
 
==== hcitool scan/dev/inq '''Connection timed out''' Error ====
 
==== hcitool scan/dev/inq '''Connection timed out''' Error ====
This can often be fixed by reseting the adapter with the following command:
+
Reset the adapter:
 
<pre><nowiki>
 
<pre><nowiki>
 
sudo hciconfig hci0 reset
 
sudo hciconfig hci0 reset
  </nowiki></pre>
+
</nowiki></pre>
This should allow the hcitool options to then connect. Many times it still needs to be done even when there is an automatic connection setup in the configuration file.
+
The hcitool options can now connect and if often required despite an automatic connection setup.
 
== Comments ==
 
== Comments ==
No mention of bluez-gnome?
+
bluez-gnome
You may need to reboot your system after installing bluez packages even if your dongle is recognized right after package installation.
+
Reboot after you install bluez packages even if your dongle is recognized after installation.
 
2/8/2009
 
2/8/2009
bluez-gnome currently has problems see this bug:
+
bluez-gnome bug:
 
https://bugs.launchpad.net/ubuntu/+source/bluez-gnome/+bug/285007
 
https://bugs.launchpad.net/ubuntu/+source/bluez-gnome/+bug/285007
and this forum page:
+
Forum page:
 
http://ubuntuforums.org/showthread.php?p=6438656#post6438656
 
http://ubuntuforums.org/showthread.php?p=6438656#post6438656
 
----
 
----

2010年5月19日 (三) 21:45的最新版本

<<Include(Tag/ContentCleanup)>>

Introduction

Bluetooth is a widely supported local area communications technology for communications with cellphones, headsets, keyboards, mice, PDAs, and storage devices. See also BluetoothRemoteControl and BluetoothAudio on Ubuntu.

Requirements

For a desktop or laptop without Bluetooth support use a Bluetooth dongle that connects through a USB. For Dell laptops install the latest drivers from Dell's website in Windows in order for the bluetooth module to work in Linux. (Required for D430 with Gutsy / Hardy and D830 and D630) (http://ubuntuforums.org/showthread.php?t=572335 https://wiki.ubuntu.com/LaptopTestingTeam/DellLatitudeD430#bluetooth) For Dell laptops with a Dell Wireless 355 Bluetooth card where the card is turned off, reenable the card before installation. Go to a utility in Windows to turn it on before you can reinstall the driver. If you turn the card off in Windows reenable the card so Ubuntu can recognize it.

Installation and Configuration

Before you begin open up the terminal and type the following:

sudo apt-get install bluez && sudo apt-get install bluez-utils

Restart the bluetooth server to ensure your pc can communicate with a bluetooth device

sudo /etc/init.d/bluetooth restart

By default the BlueTooth notification icon appears, although the service may not. If the service is not running try the service command, otherwise you can now connect. For jaunty (9:04) and above verify you have a supported adapter connected. When the icon appears, right click and configure your preferences. Devices should auto connect to your PC where you configure your security options. To configure mail for your phone, install the gnome-bluetooth package so the system finds it in the accessories menu. Send a file by right clicking the file and selecting Send-to. To automate, select System --> Preferences --> Sessions. Add a Startup program. For example you can name it, "Bluetooth File Transfer" and in the Command box, enter "gnome-obex-server". Click OK.

Manual Discovery

Open a terminal window and install the required packages with their dependencies:

sudo apt-get install bluez-utils

Connect your Bluetooth device and restart the Bluetooth services:

sudo /etc/init.d/bluez-utils restart

Verify your Bluetooth device is detected along with the appropriate modules. View the lsusb (in case of usb device) output: lsusb output:

Device 005: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

Review the output of hcitool dev for all your system's Bluetooth devices. IconsPage?action=AttachFile&do=get&target=IconExample48.png hcitool dev output:

  Devices:
	hci0	00:11:95:00:1A:CF
  

{i} Your Bluetooth device will have a different id. If the id is all zeros, restart the bluez-utils service and retry.

Setup Devices

Find Device Addresses

Locate the device address, make the device discoverable (a "Connect" button for keyboards and mice or check the manual) and search for the device by the following:

sudo hidd --search

(If that command doesn't work, try the following:)
  hcitool scan

Each device's address has the aa:bb:cc:dd:ee:ff format. Hint: If no devices are shown for Edgy Eft (6.10), try the following:

  sudo hciconfig hci0 inqmode 0

See bug #70718. If this helps, you may add the hciconfig command (without "sudo") to your /etc/rc.local file for a permanent workaround.

Connect Devices for Current Session Only

For a temporary connection, use the address of the device 'aa:bb:cc:dd:ee:ff'

sudo hidd --connect aa:bb:cc:dd:ee:ff

You can now connect. <!> For a "Can't create HID control channel: Connection refused" error, the discovery period timed out. Try again but enter the command more quickly.

Connect Devices at Startup

To connect automatically, edit the configuration file:

sudo cp /etc/default/bluetooth /etc/default/bluetooth_backup
sudo nano /etc/default/bluetooth

Locate line:

HIDD_ENABLED=0

Change it to:

HIDD_ENABLED=1

Look in the same file for a line close to:

HIDD_OPTIONS="--master --server"

{i} Leave the "--master" command or remove it, it depends on the device. If you have problems with "--master", remove it or vice versa. Add additional "--connect" arguments for the device you want to connect to at startup:

HIDD_OPTIONS="--connect aa:bb:cc:dd:ee:ff --connect aa:bb:cc:dd:ee:ff --connect aa:bb:cc:dd:ee:ff --server"

Save and add HIDP to /etc/modules:

echo hidp | sudo tee -a /etc/modules

Your Bluetooth devices should now connect at startup.

Using Devices as Modems

Refer to page BluetoothDialup

Using audio devices

Troubleshooting

"obex://[xx:xx:xx:xx:xx:xx]" is not a valid location.

If you receive this error in Gutsy enter the following:

sudo apt-get install gnome-vfs-obexftp

Although this gives "Couldn't display "obex://[xx:xx:xx:xx:xx:xx]"." for some. In this case try:

sudo hciconfig hci0 auth

See this forum thread for information.

hcitool scan/dev/inq Connection timed out Error

Reset the adapter:

sudo hciconfig hci0 reset

The hcitool options can now connect and if often required despite an automatic connection setup.

Comments

bluez-gnome Reboot after you install bluez packages even if your dongle is recognized after installation. 2/8/2009 bluez-gnome bug: https://bugs.launchpad.net/ubuntu/+source/bluez-gnome/+bug/285007 Forum page: http://ubuntuforums.org/showthread.php?p=6438656#post6438656