Tentando desativar alguns recursos do Bluetooth no RPi3

1

Estou tentando fazer com que meu RPi3 seja um coletor de bluetooth.

Meu problema é que, quando tento conectar meu laptop com Windows 7 ao meu coletor de dados RPi Bluetooth, ele é exibido assim:

Desculpe,estáemfrancês.

Permitecriar3ligações:

  • umparaoRpiserconectadocomoummicrofone
  • umparaaRpiconectarcomofonedeouvido(opçãoqueeusóquero)
  • umoRpiparaserumservidordearquivosdeáudio

Ainformação:

$sudobluetoothctl[bluetooth]#showControllerB8:27:EB:XX:XX:XXName:GertrudeAlias:GertrudeClass:0x20041cPowered:yesDiscoverable:yesPairable:yesUUID:HeadsetAG(00001112-0000-1000-8000-00805f9b34fb)UUID:GenericAttributeProfile(00001801-0000-1000-8000-00805f9b34fb)UUID:A/VRemoteControl(0000110e-0000-1000-8000-00805f9b34fb)UUID:GenericAccessProfile(00001800-0000-1000-8000-00805f9b34fb)UUID:PnPInformation(00001200-0000-1000-8000-00805f9b34fb)UUID:A/VRemoteControlTarget(0000110c-0000-1000-8000-00805f9b34fb)UUID:AudioSink(0000110b-0000-1000-8000-00805f9b34fb)UUID:AudioSource(0000110a-0000-1000-8000-00805f9b34fb)Modalias:usb:v1D6Bp0246d052BDiscovering:no

OarquivodeconfiguraçãodoBluetooth:

$cat/etc/bluetooth/main.conf[General]#Defaultadaptername#Defaultsto'BlueZX.YZ'#Name=BlueZ#Defaultdeviceclass.OnlythemajorandminordeviceclassbitsareName=#considered.Defaultsto'0x000000'.#Class=0x000100Class=0x20041c#Howlongtostayindiscoverablemodebeforegoingbacktonon-discoverable#Thevalueisinseconds.Defaultis180,i.e.3minutes.#0=disabletimer,i.e.staydiscoverableforeverDiscoverableTimeout=0#Howlongtostayinpairablemodebeforegoingbacktonon-discoverable#Thevalueisinseconds.Defaultis0.#0=disabletimer,i.e.staypairableforever#PairableTimeout=0#Automaticconnectionforbondeddevicesdrivenbyplatform/userevents.#Ifaplatformpluginusesthismechanism,automaticconnectionswillbe#enabledduringtheintervaldefinedbelow.Initially,thisfeature#intendstobeusedtoestablishconnectionstoATTchannels.Defaultis60.#AutoConnectTimeout=60#Usevendoridsource(assigner),vendor,productandversioninformationfor#DIDprofilesupport.Thevaluesareseparatedby":" and assigner, VID, PID
# and version.
# Possible vendor id source values: bluetooth, usb (defaults to usb)
#DeviceID = bluetooth:1234:5678:abcd

# Do reverse service discovery for previously unknown devices that connect to
# us. This option is really only needed for qualification since the BITE tester
# doesn't like us doing reverse SDP for some test cases (though there could in
# theory be other useful purposes for this too). Defaults to 'true'.
#ReverseServiceDiscovery = true

# Enable name resolving after inquiry. Set it to 'false' if you don't need
# remote devices name and want shorter discovery cycle. Defaults to 'true'.
#NameResolving = true

# Enable runtime persistency of debug link keys. Default is false which
# makes debug link keys valid only for the duration of the connection
# that they were created for.
#DebugKeys = false

# Restricts all controllers to the specified transport. Default value
# is "dual", i.e. both BR/EDR and LE enabled (when supported by the HW).
# Possible values: "dual", "bredr", "le"
#ControllerMode = dual

# Enables Multi Profile Specification support. This allows to specify if
# system supports only Multiple Profiles Single Device (MPSD) configuration
# or both Multiple Profiles Single Device (MPSD) and Multiple Profiles Multiple
# Devices (MPMD) configurations.
# Possible values: "off", "single", "multiple"
#MultiProfile = off

# Permanently enables the Fast Connectable setting for adapters that
# support it. When enabled other devices can connect faster to us,
# however the tradeoff is increased power consumptions. This feature
# will fully work only on kernel version 4.1 and newer. Defaults to
# 'false'.
#FastConnectable = false

# Default privacy setting.
# Enables use of private address.
# Possible values: "off", "device", "network"
# "network" option not supported currently
# Defaults to "off"
# Privacy = off

[Policy]
#
# The ReconnectUUIDs defines the set of remote services that should try
# to be reconnected to in case of a link loss (link supervision
# timeout). The policy plugin should contain a sane set of values by
# default, but this list can be overridden here. By setting the list to
# empty the reconnection feature gets disabled.
#ReconnectUUIDs=00001112-0000-1000-8000-00805f9b34fb,0000111f-0000-1000-8000-00805f9b34fb,0000110a-0000-1000-8000-00805f9b34fb

# ReconnectAttempts define the number of attempts to reconnect after a link
# lost. Setting the value to 0 disables reconnecting feature.
#ReconnectAttempts=7

# ReconnectIntervals define the set of intervals in seconds to use in between
# attempts.
# If the number of attempts defined in ReconnectAttempts is bigger than the
# set of intervals the last interval is repeated until the last attempt.
#ReconnectIntervals=1,2,4,8,16,32,64

# AutoEnable defines option to enable all controllers when they are found.
# This includes adapters present on start as well as adapters that are plugged
# in later on. Defaults to 'false'.
AutoEnable=true

Alterei a classe Bluetooth graças a: link , remova e adicione novamente o " dispositivo Bluetooth do Windows ", mas não tem efeito.

Então notei que o comando bluetoothctl / show mostra recursos do UUID, correspondendo a alguns recursos que eu não quero.

0000110a-0000-1000-8000-00805f9b34fb : Audio Source
00001800-0000-1000-8000-00805f9b34fb : Generic Access
00001801-0000-1000-8000-00805f9b34fb : Generic Attribute

Mas não tenho absolutamente nenhuma ideia de como desativar esses recursos.

Alguma idéia?

    
por DioZ 20.07.2018 / 16:42

1 resposta

1

Eu finalmente encontrei um trabalho.

Esta funcionalidade chama-se Descoberta de Serviço e existe um protocolo para poder jogar com os serviços Bluetooth: SDP.

A distribuição Raspbian fornece o utilitário sdptool , mas o daemon Bluetooth (BlueZ5) não é compatível com o SDP por padrão.

Solução

Edite o arquivo bluetooth.service para adicionar a opção --compat ou -C na linha de comando.

A atualização systemd para obter o utilitário sdptool funcionando:

$ sudo systemctl daemon-reload

Para exibir os recursos do Bluetooth do RPi:

$ sudo sdptool browse local

Procure no link para encontrar as correspondências de recursos não desejados e exclua-os com:

$ sudo sdptool del 0xYYYYYY

Para o meu caso, eu tive que excluir "Audio Source" (0x110a) e "Headset Audio Gateway" (0x1112) serviços.

    
por 21.07.2018 / 15:29