You are not logged in.
I try to autoconnect to an audio adapter during boot or login. Manual connection via bluetoothctl does work fine, but I could not figure out how to do that automatically.
I ran through https://wiki.archlinux.org/index.php/bl … ng_process, so the device is paired and trusted.
I tried to establish a connection via hcitool
$ sudo hcitool cc C8:84:47:15:BD:84
a hcidump looks like:
$ hcidump
HCI sniffer - Bluetooth packet analyzer ver 5.40
device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
> HCI Event: Command Status (0x0f) plen 4
Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
status 0x00 handle 70 bdaddr C8:84:47:15:BD:84 type ACL encrypt 0x00
> HCI Event: Command Status (0x0f) plen 4
Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 0
> HCI Event: Command Status (0x0f) plen 4
Unknown (0x00|0x0000) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
status 0x00 handle 70
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x87
> HCI Event: Command Status (0x0f) plen 4
Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
status 0x00 handle 70 page 1 max 1
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
status 0x00 bdaddr C8:84:47:15:BD:84 name '(84)Logitech Adapter'
> HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x00 ncmd 1
> HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 70 reason 0x16
Reason: Connection Terminated by Local Host
Blueman turns shortly green, so I get some visual feedback that a connection trial is done.
I contrast to establishing the connection via bluetoothctl
$ hcidump
HCI sniffer - Bluetooth packet analyzer ver 5.40
device: hci0 snap_len: 1500 filter: 0xffffffffffffffff
> HCI Event: Command Status (0x0f) plen 4
Create Connection (0x01|0x0005) status 0x00 ncmd 1
> HCI Event: Connect Complete (0x03) plen 11
status 0x00 handle 70 bdaddr C8:84:47:15:BD:84 type ACL encrypt 0x00
> HCI Event: Command Status (0x0f) plen 4
Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 0
> HCI Event: Command Status (0x0f) plen 4
Unknown (0x00|0x0000) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
status 0x00 handle 70
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x87
> HCI Event: Command Status (0x0f) plen 4
Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Read Remote Extended Features (0x23) plen 13
status 0x00 handle 70 page 1 max 1
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
status 0x00 bdaddr C8:84:47:15:BD:84 name '(84)Logitech Adapter'
> HCI Event: Command Status (0x0f) plen 4
Authentication Requested (0x01|0x0011) status 0x00 ncmd 1
> HCI Event: Command Complete (0x0e) plen 10
Link Key Request Reply (0x01|0x000b) ncmd 1
status 0x00 bdaddr C8:84:47:15:BD:84
> HCI Event: Command Complete (0x0e) plen 7
Read RSSI (0x05|0x0005) ncmd 1
status 0x00 handle 70 rssi -8
> HCI Event: Command Complete (0x0e) plen 7
Read Link Quality (0x05|0x0003) ncmd 1
status 0x00 handle 70 lq 255
> HCI Event: Command Complete (0x0e) plen 7
Read Transmit Power Level (0x03|0x002d) ncmd 1
status 0x00 handle 70 level 8
> HCI Event: Auth Complete (0x06) plen 3
status 0x00 handle 70
> HCI Event: Command Status (0x0f) plen 4
Set Connection Encryption (0x01|0x0013) status 0x00 ncmd 1
> HCI Event: Encrypt Change (0x08) plen 4
status 0x00 handle 70 encrypt 0x01
> HCI Event: Command Complete (0x0e) plen 7
Read Encryption Key Size (0x05|0x0008) ncmd 1
> HCI Event: Command Complete (0x0e) plen 7
Read RSSI (0x05|0x0005) ncmd 1
.....
$ sudo hcitool con
Connections:
< ACL C8:84:47:15:BD:84 handle 70 state 1 lm MASTER AUTH ENCRYPT
The difference seems to begin with the authentication part via bluetoothctl.
Some more info about the device:
$ sudo hcitool info C8:84:47:15:BD:84
Requesting information ...
BD Address: C8:84:47:15:BD:84
OUI Company: Beautiful Enterprise Co., Ltd (C8-84-47)
Device Name: (84)Logitech Adapter
LMP Version: 3.0 (0x5) LMP Subversion: 0x1c2d
Manufacturer: Cambridge Silicon Radio (10)
Features page 0: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x59 0x87
<3-slot packets> <5-slot packets> <encryption> <slot offset>
<timing accuracy> <role switch> <hold mode> <sniff mode>
<park state> <RSSI> <channel quality> <SCO link> <HV2 packets>
<HV3 packets> <u-law log> <A-law log> <CVSD> <paging scheme>
<power control> <transparent SCO> <broadcast encrypt>
<EDR ACL 2 Mbps> <EDR ACL 3 Mbps> <enhanced iscan>
<interlaced iscan> <interlaced pscan> <inquiry with RSSI>
<extended SCO> <EV4 packets> <EV5 packets> <AFH cap. slave>
<AFH class. slave> <3-slot EDR ACL> <5-slot EDR ACL>
<sniff subrating> <pause encryption> <AFH cap. master>
<AFH class. master> <EDR eSCO 2 Mbps> <EDR eSCO 3 Mbps>
<3-slot EDR eSCO> <extended inquiry> <simple pairing>
<encapsulated PDU> <non-flush flag> <LSTO> <inquiry TX power>
<EPC> <extended features>
Features page 1: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
I do not have to stick to hcitool. Any other way to do the autoconnect would be great.
Last edited by kodiak (2016-07-20 20:01:42)
Offline
I have the same problem with my Bluetooth speakers. A quick and somewhat dirty solution would be to abuse echo to non-interactively interact with the interactive bluetoothctl.
echo -e "$SOME\n$COMMANDS\nquit | bluetoothctl
echo -e, so it interprets \n as a newline instead of the literal string \n.
I once read this one here on the bbs. It must have annoyed others before us.
Offline
Awesome, thanks! I never thought about doing something like that.
Cheers kodiak
Offline