نمایش نتایج: از شماره 1 تا 2 از مجموع 2

موضوع: Linux and Bluetooth

  
  1. #1
    نام حقيقي: Saman Nasrolahi

    عضو عادی شناسه تصویری saman_nn2000
    تاریخ عضویت
    Feb 2004
    محل سکونت
    Tehran
    نوشته
    574
    سپاسگزاری شده
    101
    سپاسگزاری کرده
    28

    Linux and Bluetooth

    دوستان عزیز
    شاید مواردی پیش اومد و خواستید که ارتباطی ما بین کامپیوترلینوکسی و موبایل با استفاده از Bluetooth برقرار کنید ....
    دراین صورت بااستفاده ازاین مراحل که عملا در پروژه ای استفاده کرده ام و به نتیجه مطلوب هم رسیده ام میتوانید این کار را انجام دهید .
    طریقه کار را به همون صورت زبان اصلی اینجا قرار می دهم که شاید مورد استفاده دوستان قرار بگیره....( در ضمن اگر جایی اشکالی وجود داشت در خدمتم)

    Note:-
    this article for Bluetooth installation and configuration has been tested under the following system:-
    * Intel x86 machine P4
    * Linux Redhat 9
    * Linux kernel 2.4
    * Desktop Environment KDE 3.1.1, GNome 2.2.1
    * MSI Bluetooth USP Dongol
    * Nokia 6600 mobile
    this article is an appendix in my graduation project
    Introduction to BlueZ
    Bluetooth
    The Bluetooth wireless technology is a worldwide specification for a small-form factor, low-cost radio solution that provides links between mobile computers, mobile phones, other portable handheld devices, and connectivity to the Internet. The specification is developed, published and promoted by the Bluetooth Special Interest Group (SIG).

    Features
    BlueZ provides support for the core Bluetooth layers and protocols. It is flexible, efficient and uses a modular implementation. It has many interesting features:
    •Complete modular implementation

    • Symmetric multi processing safe

    • Multithreaded data processing

    • Support for multiple Bluetooth devices

    • Real hardware abstraction

    • Standard socket interface to all layers

    • Device and service level security support

    Currently BlueZ consists of many separate modules:

    •Bluetooth kernel subsystem core

    • L2CAP and SCO audio kernel layers

    • RFCOMM, BNEP, CMTP and HIDP kernel implementations

    • HCI UART, USB, PCMCIA and virtual device drivers

    • General Bluetooth and SDP libraries and daemons

    • Configuration and testing utilities

    • Protocol decoding and analysis tools

    Platforms

    The BlueZ kernel modules, libraries and utilities are known to be working prefect on many architectures supported by Linux. This also includes single and multi processor platforms as well as hyper threading systems:

    • Intel and AMD x86

    • AMD64 (x86-64)

    • SUN SPARC 32/64bit

    • PowerPC 32/64bit

    • Intel StrongARM and XScale

    • Motorola DragonBall



    Distributions

    Support for BlueZ can be found in many Linux distributions and in general it is compatible with any Linux system on the market:

    • Debian GNU/Linux

    • Red Hat Linux

    • SuSE Linux

    • Mandrake Linux

    The BlueZ project has been added to the Linux kernel 2.4 and above.

    Protocols


    · Host controller interface


    The Host Controller Interface (HCI) provides a standard interface to the Bluetooth baseband controller and link manager services that is independent from the host hardware implementation. This layer provides a uniform method of accessing any Bluetooth hardware. There is an addendum to the HCI specification for different host transport protocols. For each physical bus (USB, RS232, UART etc.) it defines the interface functions based on which physical bus is used, but also vendor specific implementations are possible.

    For the BlueZ stack the HCI is part of the Bluetooth core module (bluetooth.ko) and the host transport protocol implementations are separated into independent modules. The hci_usb.ko and hci_uart.ko modules for example implement the USB transport layer (aka H:2) and the UART transport layer (aka H:4).

    • Logical link control and adaptation protocol

    The Logical Link Control and Adaptation Layer Protocol (L2CAP) are layered over the HCI layer. L2CAP provides connection-oriented and connectionless data services to upper layer protocols. It uses a Protocol and Service Multiplexing (PSM) capability and a Segmentation and Reassembly (SAR) mechanism. L2CAP permits higher level protocols and applications to transmit and receive L2CAP data packets up to 64 kilobytes in length. Also group abstractions and Quality of Service (QoS) features are supported.

    For the connection-oriented service the connections are labeled by a channel identifier and each channel is assumed to be a full-duplex connection. The L2CAP specification is defined for only ACL links and no support for SCO links is planned.
    The BlueZ adaptation of this protocol is the l2cap.ko kernel module. It provides a SOCK_SEQPACKET BSD sockets based access from the user space and this makes it possible to write applications which directly communicate over L2CAP. In that case the L2CAP layer is the lowest layer on those two programs can exchange data packets.

    · Rfcomm protocol

    The RFCOMM Protocol provides emulation of serial ports (RS232) over the L2CAP layer. The protocol is based on the ETSI standard TS 07.10. Only a subset of this standard is used and some adaptations are Bluetooth specific and are documented in the RFCOMM specification.

    The serial emulation enables compatibility with a large base of applications that currently use the serial port as their main communication bus. RFCOMM conveys all of the RS232 control signals and supports remote port configuration. While the protocol is based on an ETSI specification, the name is related to IrComm of the IrDA protocol stack.

    RFCOMM has two faces in BlueZ, one is the socket based interface and the other is the TTY emulation. On the socket side it uses a SOCK_STREAM and can be compared to TCP. While applications using the L2CAP still have to deal with a maximum transfer unit (MTU), a RFCOMM connection is a stream and this simplifies the programming. The TTY side provides virtual terminal device nodes for use with legacy applications


    2 BlueZ pre-installation

    Kernel compilation and upgrade:

    The Linux kernel www.kernel.org does not enable the BlueZ library, first step is to

    Enable the BlueZ module, recompile the kernel and rebuild the kernel.

    The version of the Linux Redhat kernel is 2.4.20-8. This version support BlueZ library by default and does not need any patches.

    1. Goto the folder of the kernel source code

    # cd /usr/src/linux2.4.20-8

    2. type the command

    # make mrproper

    This command will preserve the previous configuration options.

    # make xconfig

    this command used for loading the GUI Utility for Linux modules configuration.

    3. in this step you should enable the modules of the BlueZ library in the Bluetooth section:

    Bluetooth subsystem support

    L2cap protocol support

    SCO links support

    RFCOMM protocol support

    RFCOMM TTY support

    Bluetooth device drivers �* HCI USB Driver

    4. check for dependencies by the command

    # make dep

    This command used for checking the dependencies of your Linux configuration. If you enable any service which cannot work without the installation of another service "make dep" command will do the necessary changes.

    5. clean the configuration

    # make clean

    6. make an image of the kernel

    # make bzImage

    7. build the new modules in the kernel

    # make modules

    8. install the new modules in the kernel

    # make modules_install

    9. now we should add the Bluetooth modules to the system

    edit the file /etc/modules/conf

    add the following:

    -alias net-pf-31 BlueZ

    -alias bt-proto-0 l2cap

    -alias bt-proto-2 sco

    -alias bt-proto-3 rfcomm

    10. load your Bluetooth driver

    11. create rfcomm with:

    # cd /dev

    # mknode rfcomm0 c 216 0

    # mknode rfcomm1 c 216 1



    3 BlueZ installation


    Download the archives needed by the Bluetooth system; bluez-lib, bluez-util, bluez-sdp. Download the files from the project website www.bluez.org and extract the files.

    * Bluez-lib

    #. /configure

    # make

    # make install

    * Bluez-util

    #. /configure

    # make

    # make install

    * Bluez-sdp

    #. /configure

    # make

    # make install

    BlueZ post-installation

    * Now configure BlueZ with the file /etc/bluetooth/hcid.conf. If you want to change your Bluetooth id you have to edit this section in hcid.conf:

    # Local device name

    # %d - device id

    # %h - host name

    name “your name (%d)”

    * The default pin code is BlueZ. If you want to change this you must edit the file /etc/Bluetooth/pin
    * Launch hcid and sdpd

    # hcid

    # sdpd

    · Check if the CBTU is up with the command:

    # hciconfig

    · If the device is down you can start it this way:

    # hciconfig hci0 up

    Now, your Linux BlueZ stack is installed and configured successfully.

    You can run the services of the Bluetooth in your system by the following commands:

    # hci

    # sdpd

    # hciconfig

    # hciconfig hci(n) up

    If you want to search for a neighbor you can use the command:

    # hcitool scan

    For more details about hcitool command type the command:

    # hcitool --help
    the next step is to install the obex server and openobex which will be used to send files to your Bluetooth device

    · Installing open obex

    Unpack openobex-1.0.0.tar.gz and go to that directory. Configure, compile and install:

    # ./configure

    # make

    # make install

    Unpack obexserver-apps-1.0.0 and go to that directory. Configure, compile and install

    as followed:

    #./configure && make

    # cd src

    # get the file http://www.frasunek.com/sources/unix/obexserver.c

    # cc –o obexserver obexserver.c libmisc.a –lopenobex

    # chown root.root obexserver && cp obexserver /usr/local/bin

    Now we have to register a SDP service for openobex. Nokia uses rfcomm channel 10 and Sony Ericsson uses rfcomm channel 3. We add them as followed:

    #sdptool add –channel=3 OPUSH

    #sdptool add –channel=10 OPUSH

    If you have another brand phone you van detect the rfcomm channel as followed:

    # hcitool inq

    Here we can see the mac address of your phone.

    #sdptool browse (mac_address)

    (you can see the complete command list of sdptool with the command sdptool –help)

    Here you can find the channel number by the PUSH information

    Now start the obex server. From now you can send files from your phone to the

    computer.

    #obexserver

    · Compile ussp-push and upload photos to your phone.

    Unpack ussp-push.tar.gz en go to that directory. No we first have to edit obex_main.c.

    Open the file with an editor and change the line “custfunc.userdata = gt->userdata” to

    “custfunc.customdata = gt->userdata”. Now save and exit

    Compile the program.

    # make

    Now we have to connect to the phone with the following command.

    # rfcomm connect 0

    The mac address is different for every phone and the OBEX_PUSH channel depends on the brand of the phone. Nokia uses channel 10 and Sonyericson uses channel 3 or 9.

    There now is a connection and we can send a file with the following command:

    # ./ussp-push /dev/rfcomm0 ./

    The phone should receive the file.
    امیدوارم مفید باشه



    موضوعات مشابه:

  2. #2


    عضو غیر فعال شناسه تصویری sdsl
    تاریخ عضویت
    Jan 2003
    محل سکونت
    Iran-Tehran
    نوشته
    630
    سپاسگزاری شده
    22
    سپاسگزاری کرده
    0
    دوست عزیزم سامان..

    در ادامه طی صحبتی که با دوست عزیزم داشتم عکس Bluetooth device مدل MSI رو به من دادن که برای دوستان اینجا قرار میدم.

    http://www.msi.com.tw/images/news_img/usb%20dongle.jpg

    و اما درباره HCI این لینک از آقای سامی هست که براتون گذاشتم.

    http://www.palowireless.com/infotooth/tutorial/hci.asp

    موفق باشید



کلمات کلیدی در جستجوها:

bluez c programming bluetooth rs232 -c -objective -java

اطلاعات در مورد Logical link control and adaptation protocol (L2CAP)

Logical link control and adaptation protocol (L2CAP)

full duplex rfcomm bluez

bluetooth.ko mandrake 10.0

برچسب برای این موضوع

مجوز های ارسال و ویرایش

  • شما نمی توانید موضوع جدید ارسال کنید
  • شما نمی توانید به پست ها پاسخ دهید
  • شما نمی توانید فایل پیوست ضمیمه کنید
  • شما نمی توانید پست های خود را ویرایش کنید
  •