Bluetooth module using CF interface on embedded Linux __linux

Source: Internet
Author: User
With the advent of various devices supporting Bluetooth communication technology, Bluetooth communication becomes more and more popular and widespread. As a result, the need to integrate Bluetooth modules on embedded devices is becoming more common. Taking the LSE139 Bluetooth module of CF interface of anycom company as an example, this paper describes how to configure it to work on embedded arm-linux with CF slots.

1. Configure the Environment
Operating system: Arm-linux
Kernel: 2.4.19

2. Kernel/Driver Support
In order for the kernel to support Bluetooth, you need to patch the kernel: I'm using http://www.holtmann.org/linux/kernel/patch-2.4.19-mh18.gz. Here you need to download different patches based on your kernel version. Device drivers, this depends on your luck, because different versions of the kernel support the Bluetooth device is not the same. The lower version of the kernel supports fewer Bluetooth devices. The Bluetooth module I used was not supported until the kernel 2.6.6-rc2. So I had to change the drive kernel_source_dir/drivers/bluetooth/bluecard_cs.c, This allows LSE139 to work on the 2.4 kernel. If you need this patch, you can send me a message or write a letter. My email address is lijinlei1@hotmail.com.

The following configuration is then made to the kernel:

#
# Bluetooth Support
#
Config_bluez = m
Config_bluez_l2cap = y
Config_bluez_sco = y
Config_bluez_rfcomm = m
Config_bluez_rfcomm_tty = y
CONFIG_BLUEZ_BNEP = m
Config_bluez_bnep_mc_filter = y
Config_bluez_bnep_proto_filter = y

#
# Bluetooth Device drivers
#
CONFIG_BLUEZ_HCIUSB = n
Config_bluez_hciuart = n
CONFIG_BLUEZ_HCIUART_H4 = n
CONFIG_BLUEZ_HCIDTL1 = n
CONFIG_BLUEZ_HCIBT3C = n
Config_bluez_hcibluecard = m
Config_bluez_hcibtuart = n
CONFIG_BLUEZ_HCIVHCI = n
Config_bluez_hciusb_sco = n
CONFIG_BLUEZ_HCIUART_BCSP = n
CONFIG_BLUEZ_HCIBFUSB = n

Note that Config_bluez_hcibluecard is supported for Bluetooth devices on the "CF" interface.
Recompile the kernel and module, then install to the device and reboot the device. If you do not know how to compile the kernel and modules, please refer to other documentation.

2. Modification of Pcmcia_cs
Since the CF card works through the PCMCIA bus, the configuration of the PCMCIA device must also be modified to ensure that the cardmgr can correctly identify the new device and load the correct driver. The following must be manually modified:/etc/pcmcia/config:

---config. Orig 2007-09-28 16:18:54.000000000 + 0200
+++ Config 2007-09-28 16:17:40.000000000 + 0200
@@-23, 6 + 23, 9 @@
Device "Serial_cs"
Class "Serial" module "Serial_cs"

+ Device "Bluecard_cs"
+ Class "Bluetooth" module "Bluecard_cs"
+
# Dummy Drivers

Device "Dummy_cs" module "Dummy_cs"
@@-52, 3 + 55, 8 @@
Card "Serial or Modem"
function Serial_port
Bind "Serial_cs"
+
+ card "anycom LSE139 Bluetooth Compact Flash card"
+ Version "Btcfcard", "LSE139"
+ Bind "Bluecard_cs"
+
Note the portion of which is added (preceded with +). After you have made this part of the modification, you must restart the cardmgr. Then insert the Bluetooth module and cardmgr should be able to properly identify the Bluetooth module and load the BLUECARD_CS.O. If all goes well, there should be no warning or error messages. If there are errors like "Receive unrecognized packets", there is probably a problem with the driver.

3. Install BlueZ
The packages that you need to cross compile and install to the device are:
bluez-libs_2.21
bluez-utils_2.21
If you install a high version of BlueZ, then you may also need Dbus, where the BlueZ without Dbus features is sufficient for my embedded device, so I chose a lower version of BlueZ. When I compile BlueZ, the compiler complains Path_max undefined, this time in the wrong C file header plus #include <linux/limits.h>

4. Start Bluetooth device
root@ereader:~ #/Etc/init. D/bluetooth start If you don't have this script, copy it from another Linux computer and make a little change.
After running this script, make sure that both the Hcid and KRFCOMMD are running.

You can then run Hciconfig Hci0 to see that the Bluetooth module has been successfully initialized and that the correct BD address is displayed.

5. Scan the surrounding Bluetooth module
root@ereader:~ # Hcitool Scan
Scanning ...
00:12:37:95:57:C9 Alex Henzen
00:0C:76:47:33:2F edbuntu-0
00:17:b0:4c:b0:71 Nokia 6021
00:16:41:f6:e0:e0 NB003
00:16:41:D 7:84:D 7 NB024
00:16:41:D 9:1a:1c Jinlei-windows can now say that your Bluetooth device is working properly. But if we want to use Bluetooth to help us do something, there's a lot of other work to do. Here are two scenarios we'll use.

Scenario 1: dial-up access via Bluetooth phone
First you need a mobile phone that can surf the Internet, support the data service, support Bluetooth communication, and properly configure it. Then insert the RFCOMM.O module using modprobe rfcomm on the device.

The first step is to scan the Bluetooth service type provided by the mobile phone
root@ereader:~ # sdptool Browse 00:12:D 2:ce:6c:a1
Browsing 00:12:D 2:ce:6c:a1 ...

Service Name:headset Audio Gateway

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.