[Bluetooth] Transferencia de archivos PC/Cel.

5:29 pm GNU/Linux

Configuración KERNEL

A lo que vamos..

Necesitamos lo siguiente en el kernel:

CONFIG_BT=y
CONFIG_BT_L2CAP=y
CONFIG_BT_SCO=y
CONFIG_BT_RFCOMM=y
CONFIG_BT_RFCOMM_TTY=y
CONFIG_BT_BNEP=y
CONFIG_BT_BNEP_MC_FILTER=y
CONFIG_BT_BNEP_PROTO_FILTER=y
CONFIG_BT_HIDP=y

#
# Bluetooth device drivers
#
CONFIG_BT_HCIUSB=m
CONFIG_BT_HCIUSB_SCO=y
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_H4=y
CONFIG_BT_HCIUART_BCSP=y
CONFIG_BT_HCIBCM203X=m
CONFIG_BT_HCIBPA10X=m
CONFIG_BT_HCIBFUSB=m
CONFIG_BT_HCIVHCI=m

Para esto vamos a modificar la imagen del kernel (pueden dejarlos cómo módulos)..

cd /usr/src/linux && make menuconfig

Networking  --->
  <*>   Bluetooth subsystem support  --->
    │--- Bluetooth subsystem support
    <*>   L2CAP protocol support
    <*>   SCO links support
    <*>   RFCOMM protocol support
    [*]     RFCOMM TTY support
    <*>   BNEP protocol support
    [*]     Multicast filter support
    [*]     Protocol filter support
    <*>   HIDP protocol support
    Bluetooth device drivers  --->
      <M> HCI USB driver
      [*]   SCO (voice) support
      <M> HCI UART driver
      [*]   UART (H4) protocol support
      [*]   BCSP protocol support
      <M> HCI BCM203x USB driver
      <M> HCI BPA10x USB driver
      <M> HCI BlueFRITZ! USB driver
      <M> HCI VHCI (Virtual HCI device) driver

Generalmente todas las distros ya traén integrado el soporte para dispositivos USB
(tengo un adaptador de bluetooth), asi que no meto mi cuchara en ese plato :P

Detectando el dispositivo Bluetooth


Antes de irse como locos XD a modificar el kernel, primero confirmemos
si por gloria del espiritu santo nos detecta el dispositivo :lol:

Para esto, necesitamos:

[I] net-wireless/bluez-utils
    Available versions:  2.22-r1 2.24 2.25-r1
    Installed:           2.25-r1(09:16:26 16/01/07)(alsa cups dbus gtk -pcmcia udev)
    Homepage:            http://bluez.sourceforge.net/
    Description:         Bluetooth Tools and System Daemons for Linux

Usamos emerge para bajar sus dependencias: emrge net-wireless/bluez-utils


nota: busca el paquete correspondiente a tu distribución

Miramos si está detectado:

/etc/init.d/bluetooth start
UnderHouse linux # hciconfig -a
hci0:   Type: USB
        BD Address: 00:13:EF:F1:42:CE ACL MTU: 120:20 SCO MTU: 0:0
        UP RUNNING PSCAN ISCAN
        RX bytes:345405 acl:17873 sco:0 events:16519 errors:0
        TX bytes:3686709 acl:34233 sco:0 commands:30 errors:0
        Features: 0xff 0xff 0x05 0x38 0x18 0x18 0x00 0x00
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT
        [b]Name: 'BlueZ (0)'[/b]
        [b]Class: 0x3e0100[/b]
        Service Classes: Networking, Rendering, Capturing
        Device Class: Computer, Uncategorized
        HCI Ver: 1.2 (0x2) HCI Rev: 0x0 LMP Ver: 1.2 (0x2) LMP Subver: 0x757
        Manufacturer: Silicon Wave (11)

Correcto :)

Configurando dispositivo

Los archivos que vamos a configurar s eencuentran en /etc/bluetooth

Les dejo mis archivos de configuración:

Archivo: hcid.conf

UnderHouse linux # more /etc/bluetooth/hcid.conf
#
# HCI daemon configuration file.
#
# HCId options
options {
# Automatically initialize new devices
#Inicializa el demonio cuando es detectado el disposiivo
autoinit yes;
# Security Manager mode
# none - Security manager disabled
# auto - Use local PIN for incoming connections
# user - Always ask user for a PIN
#
security user; #Nivel de seguridad
# Pairing mode
# none - Pairing disabled
# multi - Allow pairing with already paired devices
# once - Pair once and deny successive attempts
pairing multi;
# PIN helper
#Archivo donde se encuentra nuestro PIN por si es necesario
pin_helper /etc/bluetooth/pin-helper;
# D-Bus PIN helper
#dbus_pin_helper;
}
# Default settings for HCI devices
device {
# Local device name
# %d - device id
# %h - host name
#Nombre que le daremos a nuestro pc para ser
#visualizada en otros dispositivos
name “BlueZ (%d)”;
# Local device class
class 0×3e0100;
# Default packet type
#pkt_type DH1,DM1,HV1;
# Inquiry and Page scan
iscan enable; pscan enable;
# Default link mode
# none - no specific policy
# accept - always accept incoming connections
# master - become master on incoming connections,
# deny role switch on outgoing connections
lm accept;
# Default link policy
# none - no specific policy
# rswitch - allow role switch
# hold - allow hold mode
# sniff - allow sniff mode
# park - allow park mode
lp rswitch,hold,sniff,park;
# Authentication and Encryption (Security Mode 3)
#auth enable;
#encrypt enable;
}

Archivo: pin-helper (especificado en hcid.conf)

# Este número nos servira para realizar una
conexión con el celular o acoplar los dos dispositivos..

1234

Archivo : rfcomm.conf

El protocolo RFCOMM nos srive para establecer conexiones con varios dispositivos bluetooth (acoplar)..

#
# RFCOMM configuration file.
#
# Cada configuración se encontrará encerrada por llaves { }
rfcomm0 {
# Automatically bind the device at startup
#Crea el dispositivo en /etc/rfcomm0
bind yes; #
# Bluetooth address of the device
#MAC del dispositivo a conectar
device 00:16:4E:C5:09:32;
# RFCOMM channel for the connection
#Via que utilizaremos para la conexión (canal)
channel 1; #
# Description of the connection
comment “Example Bluetooth device”;
}

Trabajando con las heramientas de Bluez

Antes que nada debemos correr a nuestro celular y activar el soporte Bluetooth correspondiente
y que sea visible para los demás dispositivos..

Buscamos dispositivos cerca:

UnderHouse linux # hcitool scan
Scanning ...
       00:16:4E:C5:09:32       Nokia 6125

Información del celular:

UnderHouse linux # hcitool info 00:16:4E:C5:09:32
Requesting information …
BD Address: 00:16:4E:C5:09:32
Device Name: Nokia 6125
LMP Version: 2.0 (0×3) LMP Subversion: 0×6cc
Manufacturer: Cambridge Silicon Radio (10)
Features: 0xbf 0xee 0×0f 0xc6 0×9a 0×39 0×00 0×00


Verificamos los servicios disponibles en nuestro celular
(útil para saber el nombre y número de canal que ocupan los servicios):

UnderHouse linux # sdptool browse 00:16:4E:C5:09:32
Browsing 00:16:4E:C5:09:32 …
Service Name: Dial-up networking
Service RecHandle: 0×10020
Service Class ID List:
“Dialup Networking” (0×1103)
“Generic Networking” (0×1201)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 1
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Profile Descriptor List:
“Dialup Networking” (0×1103)
Version: 0×0100
Service Name: Nokia PC Suite
Service RecHandle: 0×10021
Service Class ID List:
“Serial Port” (0×1101)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 15
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Service Name: COM 1
Service RecHandle: 0×10022
Service Class ID List:
“Serial Port” (0×1101)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 3
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Service Name: Voice Gateway
Service RecHandle: 0×10023
Service Class ID List:
“Handfree Audio Gateway” (0×111f)
“Generic Audio” (0×1203)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 13
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Profile Descriptor List:
“Handsfree” (0×111e)
Version: 0×0105
Service Name: Audio Gateway
Service RecHandle: 0×10024
Service Class ID List:
“Headset Audio Gateway” (0×1112)
“Generic Audio” (0×1203)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 12
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Profile Descriptor List:
“Headset” (0×1108)
Version: 0×0100
Service Name: OBEX Object Push
Service RecHandle: 0×1002b
Service Class ID List:
“OBEX Object Push” (0×1105)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 9
“OBEX” (0×0008)
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Profile Descriptor List:
“OBEX Object Push” (0×1105)
Version: 0×0100
Service Name: OBEX File Transfer
Service RecHandle: 0×1002c
Service Class ID List:
“OBEX File Transfer” (0×1106)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 10
“OBEX” (0×0008)
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Profile Descriptor List:
“OBEX File Transfer” (0×1106)
Version: 0×0100
Service Name: SyncML Client
Service RecHandle: 0×1002e
Service Class ID List:
“Error: This is UUID-128″ (0×00000002-0000-1000-8000-0002ee000002)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 11
“OBEX” (0×0008)
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Service Name: SIM ACCESS
Service RecHandle: 0×1002f
Service Class ID List:
“SIM Access” (0×112d)
“Generic Telephony” (0×1204)
Protocol Descriptor List:
“L2CAP” (0×0100)
“RFCOMM” (0×0003)
Channel: 4
Language Base Attr List:
code_ISO639: 0×656e
encoding: 0×6a
base_offset: 0×100
Profile Descriptor List:
“SIM Access” (0×112d)
Version: 0×0101

Verifica la conexión con el dispositivo

UnderHouse linux # l2ping -i hc0 00:16:4E:C5:09:32
Ping: 00:16:4E:C5:09:32 from 00:13:EF:F1:42:CE (data size 44) ...
0 bytes from 00:16:4E:C5:09:32 id 0 time 55.88ms
0 bytes from 00:16:4E:C5:09:32 id 1 time 8.80ms
0 bytes from 00:16:4E:C5:09:32 id 2 time 8.84ms
3 sent, 3 received, 0% loss

Integración con GNOME

Paquetes necesarios:

UnderHouse linux # eix gnome-bluetooth
[I] net-wireless/gnome-bluetooth
    Available versions:  0.7.0-r1 (~)0.8.0
    Installed:           0.8.0(08:24:26 30/01/07)(debug)
    Homepage:            http://live.gnome.org/GnomeBluetooth
    Description:         Gnome2 Bluetooth integration suite
UnderHouse linux # eix libbtctl
[D] net-wireless/libbtctl
    Available versions:  0.6.0-r1 (~)0.8.1
    Installed:           0.8.2(08:38:43 30/01/07)(debug doc -mono)
    Homepage:            http://live.gnome.org/GnomeBluetooth
    Description:         A GObject wrapper for Bluetooth functionality

Con esto ya es mucho más fácil enviar y recivir archivos de la pc al celular y vicevrza..

Para pasar archivos a la pc

Ejecutamos: gnome-obex-server

Nos aparecerá un icono en la barra de notificación de GNOME,
quiere decir que estamos listo para recibir archivos.

bluetooth07to5.png

Para enviar archivos

Ejecutamos: gnome-obex-send file.mp3

Aparecerá una ventana donde nos pide elegir el dispositivo a enviar,
seleccionamos el nuestros y vemos la barra de progreso mienras finaliza..

bluetooth03cp8.png

bluetooth04cf4.png

Integración con NAUTILUS

Paquete necesario:

[I] gnome-extra/nautilus-sendto
    Available versions:  (~)0.8 (~)0.8-r1
    Homepage:            http://www.gnome.org/
    Description:         A nautilus extension for sending files to locations


Nota: A mí me surgieron problemas usando algunas versiones de los paquetes,
para que todo salga correcto tuvé que tener gnome-bluetooth-0.8.0 y libbtctl-0.8.2

Con esto el envio de archivos es mucho más fácil con ayuda del explorador de archivos,
sólo damos clic derecho en el archivo que queremos enviar y confirmar el archivo
a enviar y el dispositivo correspondiente.

bluetooth05ci4.png

bluetooth06ji4.png

Espero les seá de útilidad.

Referencias usadas (muchas xD): http://www.google.com.mx/linux

Califica el tema:
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Temas Relacionados:
  • Gatos Clonados Fluorecentes
  • Mi primer programa usando un socket xD (C#)
  • Notepad++ y TASM II
  • HACHA para GNU/Linux
  • Ares no conecta (solución)
  • 3 Responses

    1. lopz Says:

      muy interesante, ya puse configurar mi USB bluetooth con tu ayuda y la de google, por si a alguno le sirve aquí hay otros enlaces quep ueden servirles
      http://gentoo-wiki.com/HOWTO_mobile_phone,_Bluetooth_and_GNOME

      y otro más que va a un blog personal que es casi lo mismo que esta guia, osea que para que ponerla

      saludos

    2. Hugo Says:

      oye y en español ?

    3. soullost Says:

      Hugo ¿?

      Alguna guía de ubuntu (?):
      http://www.guia-ubuntu.org/index.php?title=Bluetooth

    Leave a Comment

    Your comment

    You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

    Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.