slitaz-doc-wiki-data diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/pages/en/guides/bluetooth.txt	Sat Feb 26 12:17:18 2011 +0000
     1.3 @@ -0,0 +1,131 @@
     1.4 +====== Bluetooth ======
     1.5 +
     1.6 +===== Introduction =====
     1.7 +
     1.8 +This guide will help you to configure bluetooth, e.g. to use your phone as a modem.
     1.9 +Do following steps as root.
    1.10 +First of all you must install Slitaz packages related to bluetooth:
    1.11 +  # tazpkg get-install bluez
    1.12 +  # tazpkg get-install linux-bluetooth
    1.13 +The first package contains the Official Linux Bluetooth protocol stack www.bluez.org and the second contains the kernel modules related to bluetooth.
    1.14 +Now you can launch the bluetooth daemon:
    1.15 +  # bluetoothd
    1.16 +And load the module required by your local bluetooth device, this is very likely btusb:
    1.17 +  # modprobe btusb
    1.18 +If btusb is the module you need the command "hcitool dev" to show you the local device address:
    1.19 +  root@slitaz:/home/tux# hcitool dev
    1.20 +  Devices:
    1.21 +          hci0    00:02:72:xx:xx:xx
    1.22 +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.
    1.23 +Now that you have hci* you can run the "hcitool scan" command to show you if there is any discoverable device nearby.
    1.24 +So if you are searching, e.g. your phone, remember to put it in discoverable mode:
    1.25 +  root@slitaz:/home/tux# hcitool scan
    1.26 +  Scanning ...
    1.27 +          00:18:C5:xx:xx:xx       Nokia 6151
    1.28 +  root@slitaz:/home/tux#
    1.29 +Now you can pair your locale device with your remote device. You use bluez-simple-agent to do that.
    1.30 +
    1.31 +If you want to start the pairing from the remote device you need to put your local device in discoverable mode:
    1.32 +  # hciconfig hci0 piscan
    1.33 +
    1.34 +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.
    1.35 +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:
    1.36 +  root@slitaz:/home/tux# hciconfig hci0 piscan
    1.37 +  root@slitaz:/home/tux# bluez-simple-agent
    1.38 +  Agent registered
    1.39 +  RequestPinCode (/org/bluez/2944/hci0/dev_00_18_C5_xx_xx_xx)
    1.40 +  Enter PIN Code: 1234
    1.41 +  ^CTraceback (most recent call last):
    1.42 +    File "/usr/bin/bluez-simple-agent", line 113, in <module>
    1.43 +      mainloop.run()
    1.44 +  KeyboardInterrupt
    1.45 +  root@slitaz:/home/tux#
    1.46 +Put your local device back in undiscoverable mode:
    1.47 +  # hciconfig hci0 pscan
    1.48 +
    1.49 +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:
    1.50 +  root@slitaz:/home/tux# bluez-simple-agent hci0 00:18:C5:xx:xx:xx
    1.51 +  RequestPinCode (/org/bluez/3078/hci0/dev_00_18_C5_xx_xx_xx)
    1.52 +  Enter PIN Code: 1234
    1.53 +  Release
    1.54 +  New device (/org/bluez/3078/hci0/dev_00_18_C5_xx_xx_xx)
    1.55 +  root@slitaz:/home/tux# 
    1.56 +Be fast because bluez-simple-agent has a timeout which I don't know how to set (suggestions?)
    1.57 +
    1.58 +===== Use a phone as a modem =====
    1.59 +
    1.60 +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.
    1.61 +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:
    1.62 +  root@slitaz:/home/tux# zcat /proc/config.gz | grep RFCOMM                    
    1.63 +  CONFIG_BT_RFCOMM=m
    1.64 +  # CONFIG_BT_RFCOMM_TTY is not set
    1.65 +  root@slitaz:/home/tux#
    1.66 +If CONFIG_BT_RFCOMM_TTY is not =y you must recompile the module with tty support. Install linux-source:
    1.67 +  # tazpkg get-install linux-source
    1.68 +cd in /usr/src/linux-`uname -r`/ and give this command:
    1.69 +  # make CONFIG_BT_RFCOMM=m CONFIG_BT_RFCOMM_TTY=y M=net/bluetooth/rfcomm
    1.70 +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.
    1.71 +Now you can delete the old rfcomm module and replace it with your module:
    1.72 +  # rm /lib/modules/`uname -r`/kernel/net/bluetooth/rfcomm/rfcomm.ko.gz
    1.73 +  # cp /usr/src/linux-`uname -r`/net/bluetooth/rfcomm/rfcomm.ko /lib/modules/`uname -r`/kernel/net/bluetooth/rfcomm/ 
    1.74 +  # depmod -a
    1.75 +Now that we have a working rfcomm module we must detect the channel where the phone dialup service is listening:
    1.76 +  # sdptool browse 00:18:C5:xx:xx:xx
    1.77 +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:
    1.78 +  Service Name: Dial-up networking
    1.79 +  Service RecHandle: 0x10000
    1.80 +  Service Class ID List:
    1.81 +    "Dialup Networking" (0x1103)
    1.82 +    "Generic Networking" (0x1201)
    1.83 +  Protocol Descriptor List:
    1.84 +    "L2CAP" (0x0100)
    1.85 +    "RFCOMM" (0x0003)
    1.86 +      Channel: 1
    1.87 +  Language Base Attr List:
    1.88 +    code_ISO639: 0x656e
    1.89 +    encoding:    0x6a
    1.90 +    base_offset: 0x100
    1.91 +  Profile Descriptor List:
    1.92 +    "Dialup Networking" (0x1103)
    1.93 +      Version: 0x0100
    1.94 +      
    1.95 +===== rfcomm.conf =====
    1.96 +
    1.97 +As you can see it is listening on channel 1, so you edit ///etc/bluetooth/rfcomm.conf// this way:
    1.98 +<file>
    1.99 +  #
   1.100 +  # RFCOMM configuration file.
   1.101 +  #
   1.102 +  rfcomm0 {
   1.103 +  #       # Automatically bind the device at startup
   1.104 +          bind yes;
   1.105 +  #
   1.106 +  #       # Bluetooth address of the device
   1.107 +          device 00:18:C5:xx:xx:xx;
   1.108 +  #
   1.109 +  #       # RFCOMM channel for the connection
   1.110 +          channel 1;
   1.111 +  #
   1.112 +  #       # Description of the connection
   1.113 +  #       comment "Example Bluetooth device";
   1.114 +  }
   1.115 +</file>
   1.116 +Now with:
   1.117 +  # modprobe rfcomm
   1.118 +  # rfcomm bind all
   1.119 +You can use /dev/rfcomm0 as a modem in a wvdial script.
   1.120 +You may want to check this guide http://doc.slitaz.org/en:guides:dialup
   1.121 +
   1.122 +---- 
   1.123 +\\
   1.124 +^  Page Review Section  ^^ 
   1.125 +|Quality| Good  |
   1.126 +|Review| Minor Updates  |
   1.127 +|Priority| Medium |
   1.128 +|Problems| add a [[http://forum.slitaz.org|forum post link]]|
   1.129 +|:::     | OR add a [[http://labs.slitaz.org/issues |lab issue tracker link ]]|
   1.130 +|How to Improve| Add tazhw setup bluetooth ; Please create "sections" for toc|
   1.131 +|::: |  |
   1.132 +
   1.133 +\\
   1.134 +----
   1.135 \ No newline at end of file