slitaz-doc-wiki-data annotate pages/en/guides/bluetooth.txt @ rev 7

Add pages/en folder.
author Christopher Rogers <slaxemulator@gmail.com>
date Sat Feb 26 12:17:18 2011 +0000 (2011-02-26)
parents
children
rev   line source
slaxemulator@7 1 ====== Bluetooth ======
slaxemulator@7 2
slaxemulator@7 3 ===== Introduction =====
slaxemulator@7 4
slaxemulator@7 5 This guide will help you to configure bluetooth, e.g. to use your phone as a modem.
slaxemulator@7 6 Do following steps as root.
slaxemulator@7 7 First of all you must install Slitaz packages related to bluetooth:
slaxemulator@7 8 # tazpkg get-install bluez
slaxemulator@7 9 # tazpkg get-install linux-bluetooth
slaxemulator@7 10 The first package contains the Official Linux Bluetooth protocol stack www.bluez.org and the second contains the kernel modules related to bluetooth.
slaxemulator@7 11 Now you can launch the bluetooth daemon:
slaxemulator@7 12 # bluetoothd
slaxemulator@7 13 And load the module required by your local bluetooth device, this is very likely btusb:
slaxemulator@7 14 # modprobe btusb
slaxemulator@7 15 If btusb is the module you need the command "hcitool dev" to show you the local device address:
slaxemulator@7 16 root@slitaz:/home/tux# hcitool dev
slaxemulator@7 17 Devices:
slaxemulator@7 18 hci0 00:02:72:xx:xx:xx
slaxemulator@7 19 If the command "hcitool dev" does not show you any hci* device you must detect which module you need and repeat the previous step until you have a hci* device.
slaxemulator@7 20 Now that you have hci* you can run the "hcitool scan" command to show you if there is any discoverable device nearby.
slaxemulator@7 21 So if you are searching, e.g. your phone, remember to put it in discoverable mode:
slaxemulator@7 22 root@slitaz:/home/tux# hcitool scan
slaxemulator@7 23 Scanning ...
slaxemulator@7 24 00:18:C5:xx:xx:xx Nokia 6151
slaxemulator@7 25 root@slitaz:/home/tux#
slaxemulator@7 26 Now you can pair your locale device with your remote device. You use bluez-simple-agent to do that.
slaxemulator@7 27
slaxemulator@7 28 If you want to start the pairing from the remote device you need to put your local device in discoverable mode:
slaxemulator@7 29 # hciconfig hci0 piscan
slaxemulator@7 30
slaxemulator@7 31 Now launch bluez-simple-agent, start the pairing from the remote device and wait for bluez-simple-agent to ask you for the pin code needed to pair.
slaxemulator@7 32 This code will be the same one you typed on the phone. When you are done you need to kill bluez-simple-agent with Ctrl-c:
slaxemulator@7 33 root@slitaz:/home/tux# hciconfig hci0 piscan
slaxemulator@7 34 root@slitaz:/home/tux# bluez-simple-agent
slaxemulator@7 35 Agent registered
slaxemulator@7 36 RequestPinCode (/org/bluez/2944/hci0/dev_00_18_C5_xx_xx_xx)
slaxemulator@7 37 Enter PIN Code: 1234
slaxemulator@7 38 ^CTraceback (most recent call last):
slaxemulator@7 39 File "/usr/bin/bluez-simple-agent", line 113, in <module>
slaxemulator@7 40 mainloop.run()
slaxemulator@7 41 KeyboardInterrupt
slaxemulator@7 42 root@slitaz:/home/tux#
slaxemulator@7 43 Put your local device back in undiscoverable mode:
slaxemulator@7 44 # hciconfig hci0 pscan
slaxemulator@7 45
slaxemulator@7 46 If you want to start the pairing from your local device you can do it using bluez-simple-agent with the hci* of your local device and the address of the device you discovered with "hcitool scan". In this case you will choose the pin in bluez-simple-agent and type the same pin on the remote device:
slaxemulator@7 47 root@slitaz:/home/tux# bluez-simple-agent hci0 00:18:C5:xx:xx:xx
slaxemulator@7 48 RequestPinCode (/org/bluez/3078/hci0/dev_00_18_C5_xx_xx_xx)
slaxemulator@7 49 Enter PIN Code: 1234
slaxemulator@7 50 Release
slaxemulator@7 51 New device (/org/bluez/3078/hci0/dev_00_18_C5_xx_xx_xx)
slaxemulator@7 52 root@slitaz:/home/tux#
slaxemulator@7 53 Be fast because bluez-simple-agent has a timeout which I don't know how to set (suggestions?)
slaxemulator@7 54
slaxemulator@7 55 ===== Use a phone as a modem =====
slaxemulator@7 56
slaxemulator@7 57 Now you have your two devices paired, i will go on with the phone as a modem example, I don't have other experiences with bluetooth devices.
slaxemulator@7 58 To use your phone as a modem you need the rfcomm module. At the moment I am writing this guide the rfcomm module of Slitaz is compiled without tty support. You can check if this is the case with the following commands:
slaxemulator@7 59 root@slitaz:/home/tux# zcat /proc/config.gz | grep RFCOMM
slaxemulator@7 60 CONFIG_BT_RFCOMM=m
slaxemulator@7 61 # CONFIG_BT_RFCOMM_TTY is not set
slaxemulator@7 62 root@slitaz:/home/tux#
slaxemulator@7 63 If CONFIG_BT_RFCOMM_TTY is not =y you must recompile the module with tty support. Install linux-source:
slaxemulator@7 64 # tazpkg get-install linux-source
slaxemulator@7 65 cd in /usr/src/linux-`uname -r`/ and give this command:
slaxemulator@7 66 # make CONFIG_BT_RFCOMM=m CONFIG_BT_RFCOMM_TTY=y M=net/bluetooth/rfcomm
slaxemulator@7 67 This will build only the rfcomm module with tty support. You will find it in /usr/src/linux-`uname -r`/net/bluetooth/rfcomm/rfcomm.ko.
slaxemulator@7 68 Now you can delete the old rfcomm module and replace it with your module:
slaxemulator@7 69 # rm /lib/modules/`uname -r`/kernel/net/bluetooth/rfcomm/rfcomm.ko.gz
slaxemulator@7 70 # cp /usr/src/linux-`uname -r`/net/bluetooth/rfcomm/rfcomm.ko /lib/modules/`uname -r`/kernel/net/bluetooth/rfcomm/
slaxemulator@7 71 # depmod -a
slaxemulator@7 72 Now that we have a working rfcomm module we must detect the channel where the phone dialup service is listening:
slaxemulator@7 73 # sdptool browse 00:18:C5:xx:xx:xx
slaxemulator@7 74 Where 00:18:C5:xx:xx:xx is the address of your phone, it will give a list with the services available on your phone. The one you are looking for is Dial-up networking or DUN:
slaxemulator@7 75 Service Name: Dial-up networking
slaxemulator@7 76 Service RecHandle: 0x10000
slaxemulator@7 77 Service Class ID List:
slaxemulator@7 78 "Dialup Networking" (0x1103)
slaxemulator@7 79 "Generic Networking" (0x1201)
slaxemulator@7 80 Protocol Descriptor List:
slaxemulator@7 81 "L2CAP" (0x0100)
slaxemulator@7 82 "RFCOMM" (0x0003)
slaxemulator@7 83 Channel: 1
slaxemulator@7 84 Language Base Attr List:
slaxemulator@7 85 code_ISO639: 0x656e
slaxemulator@7 86 encoding: 0x6a
slaxemulator@7 87 base_offset: 0x100
slaxemulator@7 88 Profile Descriptor List:
slaxemulator@7 89 "Dialup Networking" (0x1103)
slaxemulator@7 90 Version: 0x0100
slaxemulator@7 91
slaxemulator@7 92 ===== rfcomm.conf =====
slaxemulator@7 93
slaxemulator@7 94 As you can see it is listening on channel 1, so you edit ///etc/bluetooth/rfcomm.conf// this way:
slaxemulator@7 95 <file>
slaxemulator@7 96 #
slaxemulator@7 97 # RFCOMM configuration file.
slaxemulator@7 98 #
slaxemulator@7 99 rfcomm0 {
slaxemulator@7 100 # # Automatically bind the device at startup
slaxemulator@7 101 bind yes;
slaxemulator@7 102 #
slaxemulator@7 103 # # Bluetooth address of the device
slaxemulator@7 104 device 00:18:C5:xx:xx:xx;
slaxemulator@7 105 #
slaxemulator@7 106 # # RFCOMM channel for the connection
slaxemulator@7 107 channel 1;
slaxemulator@7 108 #
slaxemulator@7 109 # # Description of the connection
slaxemulator@7 110 # comment "Example Bluetooth device";
slaxemulator@7 111 }
slaxemulator@7 112 </file>
slaxemulator@7 113 Now with:
slaxemulator@7 114 # modprobe rfcomm
slaxemulator@7 115 # rfcomm bind all
slaxemulator@7 116 You can use /dev/rfcomm0 as a modem in a wvdial script.
slaxemulator@7 117 You may want to check this guide http://doc.slitaz.org/en:guides:dialup
slaxemulator@7 118
slaxemulator@7 119 ----
slaxemulator@7 120 \\
slaxemulator@7 121 ^ Page Review Section ^^
slaxemulator@7 122 |Quality| Good |
slaxemulator@7 123 |Review| Minor Updates |
slaxemulator@7 124 |Priority| Medium |
slaxemulator@7 125 |Problems| add a [[http://forum.slitaz.org|forum post link]]|
slaxemulator@7 126 |::: | OR add a [[http://labs.slitaz.org/issues |lab issue tracker link ]]|
slaxemulator@7 127 |How to Improve| Add tazhw setup bluetooth ; Please create "sections" for toc|
slaxemulator@7 128 |::: | |
slaxemulator@7 129
slaxemulator@7 130 \\
slaxemulator@7 131 ----