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