User Tools

Site Tools


informatica:linux:bluetooth

This is an old revision of the document!


bluetooth bluez obexftp obexftpd bluetoothd

NOTA Hay que pulir la receta, porque probé muchas cosas

1. Habilitar módulos del kernel

modprobe btusb

Creo que no hace falta, pero por si las moscas:

modprobe uhci_hcd ehci_hcd

2. Instalar paquetes:

aptitude update && aptitude install bluetooth obexftp obexpushd
ii  bluetooth                            4.42-2                     Bluetooth support
ii  bluez                                4.42-2                     Bluetooth tools and daemons
ii  bluez-alsa                           4.42-2                     Bluetooth ALSA support
ii  bluez-cups                           4.42-2                     Bluetooth printer driver for CUPS
ii  bluez-firmware                       1.2-2                      Firmware for Bluetooth devices
rc  bluez-gnome                          0.27-1                     Bluetooth utilities for GNOME
ii  bluez-gstreamer                      4.42-2                     Bluetooth GStreamer support
rc  bluez-utils                          4.42-2                     Transitional package
rc  libbluetooth2                        3.36-1                     Library to use the BlueZ Linux Bluetooth sta
ii  libbluetooth3                        4.42-2                     Library to use the BlueZ Linux Bluetooth sta
ii  mplayer-skin-blue                    1.6-2                      blue skin for mplayer
rc  gnome-vfs-obexftp                    0.4-1+b1                   GNOME VFS module for OBEX FTP
ii  libmulticobex1                       0.23-1                     multi-protocol cable OBEX library
ii  libobexftp0                          0.23-1                     object exchange file transfer library
ii  libopenobex1                         1.5-2                      OBEX protocol library
ii  obex-data-server                     0.4.4-2                    D-Bus service for OBEX client and server sid
ii  obexftp                              0.23-1                     file transfer utility for devices that use t
ii  obexpushd                            0.7-1.1                    program for receiving files via Bluetooth or

3. Arrancar el demonio de bluetooth:

/usr/sbin/bluetoothd

Para comprobar que tenemos un dispostivo bluetooth funcionando:

hcitool dev
Devices:
	hci0	00:16:41:8A:27:B6

Para rastrear dispositivos. Lógicamente hay que habilitar el usb del móvil y situarlo cerca:

hcitool scan
Scanning ...
	00:17:83:ED:AD:14	HTC_P3650
	00:09:DD:50:6E:1C	airis-0

4. Arrancar el demonio para recibir archivos:

obexpushd

5. Hacer visible nuestro dispositivo:

  • NO funciona
dbus-send --system --dest=org.bluez /org/bluez/hci0 org.bluez.Adapter.SetMode string:discoverable
  • Funciona
hciconfig hci0 piscan

Para comprobar que nuestro dispositivo es visible:

hciconfig
hci0:	Type: USB
	BD Address: 00:16:41:8A:27:B6 ACL MTU: 384:8 SCO MTU: 64:8
	UP RUNNING PSCAN ISCAN 
	RX bytes:786030 acl:1915 sco:0 events:1467 errors:0
	TX bytes:19928 acl:1227 sco:0 commands:112 errors:0

Tienen que estar presente los valores 'ISCAN PSCAN'

6. Parear los dispositivos

  • Desde el teléfono móvil

6.1.1 Situarse en el directorio en el que se quiere recibir los archivos y escribir:

bluetooth-agent 1234

6.1.2 Desde el móvil buscar dispositivos, seleccionar el nombre susceptible de ser el ordeñador y teclear '1234'

  • Desde el pc

6.2.1 Situarse en el directorio en el que se quiere recibir los archivos y escribir:

bluetooth-agent 1234

6.2.2 Teclear:

rfcomm connect mac_telefono_movil

Error:

Can't find a config entry for rfcomm0

Tengo que depurarlo

7. Enviar archivos

  • Móvil ⇒ pc

Seleccionar el archivo, 'transferir' o algo así y seleccionar el pc. En el pc aparecerá un mensaje:

Pincode request for device /org/bluez/2884/hci0/dev_00_17_83_ED_AD_14

El archivo se dejará en el directorio desde el cual se lanzó el comando 'bluetooth-agent 1234'

  • Pc ⇒ móvil
obexftp -b 00:17:83:ED:AD:14 -p /tmp/log.txt 
Browsing 00:17:83:ED:AD:14 ...
Connecting..\done
Tried to connect for 69ms
Sending "/tmp/log.txt".../done
Disconnecting..-done
informatica/linux/bluetooth.1258219293.txt.gz · Last modified: 2015/04/13 20:19 (external edit)