Voici une petite introduction aux outils disponibles sous la ligne de commande linux pour effectuer quelques opérations avec le bluetooth.

Détections des modules connectés

Cette commande permet d’afficher les différents modules bluetooth connectés au PC :

hcitool dev
Devices:
hci0 00:20:E0:9B:XX:XX
hci1 00:1B:11:63:XX:XX

Nous avons donc 2 modules bluetooth connectés soit hci0 et hci1.

Recherche des voisins visibles

Pour recherché les éléments bluetooth du voisinage :

hcitool -i hci1 scan
Scanning ...
8C:DE:52:06:XX:XX SRS-BTV5

Nous avons donc détecté une enceinte portable Sony SRS-BTV5.

Demande d’infos

Pour avoir des informations sur cette enceinte bluetooth il faut utiliser la commande suivante :

sudo hcitool -i hci1 info 8C:DE:52:06:XX:XX
Requesting information ...
BD Address: 8C:DE:52:06:XX:XX
Device Name: SRS-BTV5
LMP Version: 3.0 (0x5) LMP Subversion: 0x2200
Manufacturer: Integrated System Solution Corp. (57)
Features page 0: 0xbf 0xff 0xff 0xfe 0x88 0x3d 0x19 0x86
<3-slot packets> <5-slot packets>

<3-slot EDR ACL>
<5-slot EDR ACL>

Features page 1: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00

L’outil sdptool permet d’avoir d’autres information dont les services offert par le périphérique :

sdptool browse 8C:DE:52:06:XX:XX
Browsing 8C:DE:52:06:XX:XX ...
Service RecHandle: 0x10001
Service Class ID List:
"PnP Information" (0x1200)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 1
"SDP" (0x0001)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"PnP Information" (0x1200)
Version: 0x0100

Service Name: Headset unit
Service RecHandle: 0x10002
Service Class ID List:
« Headset » (0x1108)
« Generic Audio » (0x1203)
Protocol Descriptor List:
« L2CAP » (0x0100)
« RFCOMM » (0x0003)
Channel: 2
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
« Headset » (0x1108)
Version: 0x0100

Service Name: Hands-free unit
Service RecHandle: 0x10003
Service Class ID List:
« Handsfree » (0x111e)
« Generic Audio » (0x1203)
Protocol Descriptor List:
« L2CAP » (0x0100)
« RFCOMM » (0x0003)
Channel: 1
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
« Handsfree » (0x111e)
Version: 0x0105

Service Name: Audio SNK
Service Provider: ISSC
Service RecHandle: 0x10008
Service Class ID List:
« Audio Sink » (0x110b)
Protocol Descriptor List:
« L2CAP » (0x0100)
PSM: 25
« AVDTP » (0x0019)
uint16: 0x100
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
« Advanced Audio » (0x110d)
Version: 0x0100

Service Name: AVRCP CT
Service Provider: ISSC
Service RecHandle: 0x10006
Service Class ID List:
« AV Remote » (0x110e)
Protocol Descriptor List:
« L2CAP » (0x0100)
PSM: 23
« AVCTP » (0x0017)
uint16: 0x100
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
« AV Remote » (0x110e)
Version: 0x0100

Service Name: AVRCP TG
Service Provider: ISSC
Service RecHandle: 0x1000c
Service Class ID List:
« AV Remote Target » (0x110c)
Protocol Descriptor List:
« L2CAP » (0x0100)
PSM: 23
« AVCTP » (0x0017)
uint16: 0x100
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
« AV Remote » (0x110e)
Version: 0x0100

Récupérer le nom d’un élément

Pour ne récupérer que le nom de l’élement bluetooth il suffit d’utiliser la commande suivante :

hcitool -i hci1 name 8C:DE:52:06:XX:XX
SRS-BTV5