# I badly need to connect my bluetooth headphone ... Please help !



## john_rambo (Apr 24, 2021)

Hi,
I am using GhostBSD which as you know is based of FreeBSD. Like this forum the GhostBSD forum too is very friendly. They solved almost all of my issues. The only remaining problem is about bluetooth. I use my bluetooth headphone all the time. Under Linux my usb bluetooth dongle worked out of the box but unfortunately its not working under GhostBSD/FreeBSD. I need this badly. I read the official docs but I couldn't understand anything Can someone please help ? 

Please tell me which info you need I will post them as soon as possible.

This was the output of the Linux command lsusb. I no longer have Linux installed. 


```
Bus 001 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
```


----------



## rootbert (Apr 24, 2021)

I am sorry to say but FreeBSDs wireless stack is really not its strong point, you could try the info in the handbook https://docs.freebsd.org/en_US.ISO8859-1/books/handbook/network-bluetooth.html and go further with the man pages linked. https://www.freebsd.org/releases/13.0R/hardware/#bluetooth might also give you an idea how weak bluetooth support in FreeBSD is ... the stack is way out of time. good luck!


----------



## john_rambo (Apr 24, 2021)

It finds my bluetooth headphone


```
# hccontrol -n ubt0hci inquiry
Inquiry result, num_responses=1
Inquiry result #0
    BD_ADDR: 3b:46:5e:7b:00:05
    Page Scan Rep. Mode: 0x1
    Page Scan Period Mode: 0x2
    Page Scan Mode: 00
    Class: 24:04:04
    Clock offset: 0x6a8
Inquiry complete. Status: No error [00]
```

Then I try to connect


```
# hccontrol -n ubt0hci create_connection 3b:46:5e:7b:00:05
```

When a connection is made my headset notifies me. A female voice says the word "connected" but I don't hear it.


```
# hccontrol -n ubt0hci read_connection_list
Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
3b:46:5e:7b:00:05     41  ACL    0 MAST    NONE       0     0 OPEN
3b:46:5e:7b:00:05     41  ACL    0 MAST    NONE       0     0 OPEN
```

I am so close. Any ideas are welcome.


----------



## sig (Apr 28, 2021)

You might be missing this piece.
7.2.3. Setting up Bluetooth Sound Devices​








						Chapter 8. Multimedia
					

FreeBSD supports a wide variety of sound cards, allowing users to enjoy high fidelity output from a FreeBSD system




					docs.freebsd.org


----------



## john_rambo (Apr 29, 2021)

sig 

It worked ! But only for one time. I was able to connect my headphone, I tested by playing a song. After I rebooted & followed the exact same steps it fails to connect.


```
kldload ng_ubt
kldload ubtbcmfw
service bluetooth start
service sdpd start
hccontrol -n ubt0hci inquiry
kldload cuse
virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/BT_ADDR -d dsp


# virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/3b:46:5e:7b:00:05 -d dsp
hw.snd.basename_clone: 0 -> 0
backend_bt: Could not open SDP
backend_bt: PSM=0xffffffff
backend_bt: PSM not found
```


----------



## mark_j (Apr 29, 2021)

What's the output of kldstat? Are all the modules you loaded in the list?


----------



## john_rambo (Apr 29, 2021)

mark_j said:


> What's the output of kldstat?




```
kldstat
Id Refs Address                Size Name
 1  100 0xffffffff80200000  2c0bb60 kernel
 2    1 0xffffffff82e0c000   3bacf0 zfs.ko
 3    2 0xffffffff831c7000     a448 opensolaris.ko
 4    1 0xffffffff831d2000    1e7b0 geom_eli.ko
 5    1 0xffffffff831f1000     eed8 aesni.ko
 6    1 0xffffffff83811000     87d0 tmpfs.ko
 7    1 0xffffffff8381a000     35b4 geom_uzip.ko
 8    1 0xffffffff8381e000     2e30 xz.ko
 9    1 0xffffffff83821000     1a20 fdescfs.ko
10    1 0xffffffff83823000    103f0 fuse.ko
11    1 0xffffffff83834000     2908 ums.ko
12    1 0xffffffff83837000    3c4c0 linux.ko
13    4 0xffffffff83874000     4b80 linux_common.ko
14    1 0xffffffff83879000    35ce0 linux64.ko
15    1 0xffffffff838af000     4ea4 cuse.ko
16    1 0xffffffff838b4000   12bfbc i915kms.ko
17    1 0xffffffff839e0000    75e30 drm.ko
18    4 0xffffffff83a56000    13770 linuxkpi.ko
19    3 0xffffffff83a6a000    13f30 linuxkpi_gplv2.ko
20    2 0xffffffff83a7e000      6d0 debugfs.ko
21    1 0xffffffff83a7f000     246d i915_skl_dmc_ver1_27_bin.ko
22    1 0xffffffff83a82000     54fc linprocfs.ko
23    1 0xffffffff83a88000     1f3c linsysfs.ko
24    1 0xffffffff83a8a000    25360 ipfw.ko
25    1 0xffffffff83ab0000     4260 ng_ubt.ko
26    6 0xffffffff83ab5000     9bd0 netgraph.ko
27    2 0xffffffff83abf000     9128 ng_hci.ko
28    3 0xffffffff83ac9000      9b0 ng_bluetooth.ko
29    1 0xffffffff83aca000     caf0 ng_l2cap.ko
30    1 0xffffffff83ad7000    1af20 ng_btsocket.ko
31    1 0xffffffff83af2000     2150 ng_socket.ko
32    1 0xffffffff83af5000      820 ubtbcmfw.ko
```


----------



## mark_j (Apr 29, 2021)

Does `sdpcontrol -a 3b:46:5e:7b:00:05 browse` output anything?*
*


----------



## john_rambo (Apr 29, 2021)

mark_j said:


> Does `sdpcontrol -a 3b:46:5e:7b:00:05 browse` output anything?




```
# hccontrol -n ubt0hci inquiry
Inquiry result, num_responses=1
Inquiry result #0
    BD_ADDR: 3b:46:5e:7b:00:05
    Page Scan Rep. Mode: 0x1
    Page Scan Period Mode: 0x2
    Page Scan Mode: 00
    Class: 24:04:04
    Clock offset: 0x7d5
Inquiry complete. Status: No error [00]
root@homepc:/home/bsd # sdpcontrol -a 3b:46:5e:7b:00:05
Usage: sdpcontrol options command
Where options are:
    -a address    address to connect to
    -c path        path to the control socket (default is /var/run/sdp)
    -h        display usage and quit
    -l        connect to the local SDP server via control socket
    command        one of the supported commands
```


----------



## mark_j (Apr 29, 2021)

You forgot the browse command of the sdpcontrol.
Basically, trying to ensure sdpd(8) is running.


----------



## john_rambo (Apr 29, 2021)

mark_j


```
virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/3b:46:5e:7b:00:05 -d dsp
```

After successfully connecting my headphone using the above command I tried to disconnect by using CTRL+C but
it didn't worked so I closed the terminal window & that must have messed things up. Now as I mentioned it fails to connect even when using the same command :


```
virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/3b:46:5e:7b:00:05 -d dsp
```


----------



## john_rambo (Apr 29, 2021)

mark_j said:


> You forgot the browse command of the sdpcontrol.
> Basically, trying to ensure sdpd(8) is running.




```
# service sdpd start
 * WARNING: sdpd has already been started
```


----------



## mark_j (Apr 29, 2021)

john_rambo said:


> mark_j
> 
> 
> ```
> ...


It sounds like (pardon the pun), the device is locked by the previous terminal.
What if you reboot and see if you can run the command again, this time, place it in the background by appending *&* to it:

```
virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/3b:46:5e:7b:00:05 -d dsp &
```


----------



## john_rambo (Apr 29, 2021)

mark_j said:


> It sounds like (pardon the pun), the device is locked by the previous terminal.
> What if you reboot and see if you can run the command again, this time, place it in the background by appending *&* to it:
> 
> ```
> ...




```
# virtual_oss -C 2 -c 2 -r 48000 -b 16 -s 768 -R /dev/null -P /dev/bluetooth/3b:46:5e:7b:00:05 -d dsp &
[1] 13191
root@homepc:/home/bsd # hw.snd.basename_clone: 0 -> 0
backend_bt: Could not open SDP
backend_bt: PSM=0xffffffff
backend_bt: PSM not found
backend_bt: Could not open SDP
backend_bt: PSM=0xffffffff
backend_bt: PSM not found
backend_bt: Could not open SDP
backend_bt: PSM=0xffffffff
backend_bt: PSM not found
```


----------



## mark_j (Apr 29, 2021)

This was after a reboot?


----------



## john_rambo (Apr 29, 2021)

mark_j said:


> This was after a reboot?


When CTRL+C failed I closed the terminal & rebooted then repeated all the same commands but it fails with those errors

```
backend_bt: Could not open SDP
backend_bt: PSM=0xffffffff
backend_bt: PSM not found
```


----------



## mark_j (Apr 29, 2021)

What's `ls -Fl /dev/dsp*`?


----------



## john_rambo (Apr 29, 2021)

mark_j 
I rebooted again & this time its connected but I don't know how to terminate the connection


----------



## john_rambo (Apr 29, 2021)

```
# hccontrol -n ubt0hci read_connection_list
Remote BD_ADDR    Handle Type Mode Role Encrypt Pending Queue State
3b:46:5e:7b:00:05     41  ACL    0 MAST    NONE       4     0 OPEN
root@homepc:/home/bsd # hccontrol -n ubt0hci disconnect 41
Connection handle: 41
Reason: Connection terminated by local host [0x16]
```

When I use the above procedure I hear "disconnected" but within a second I hear "connected" again.


----------



## mark_j (Apr 29, 2021)

Is* /dev/bluetooth/3b:46:5e:7b:00:05* there?

Reply to #19, so you're saying you can't disconnect permanently? Is virtual_oss running in another terminal?


----------



## john_rambo (Apr 29, 2021)

mark_j said:


> Is* /dev/bluetooth/3b:46:5e:7b:00:05* there?




```
# cat /dev/bluetooth/3b:46:5e:7b:00:05
cat: /dev/bluetooth/3b:46:5e:7b:00:05: No such file or directory
```


----------



## mark_j (Apr 29, 2021)

Because you've disconnected manually. Pull the dongle out, then re-insert it to see it.
To quote the handbook:


> A _connection handle_ is useful when termination of the baseband connection is required, though it is normally not required to do this by hand. The stack will automatically terminate inactive baseband connections.


Perhaps the only way is to stop the sdpd daemon. `service sdpd stop`.


----------



## john_rambo (Apr 29, 2021)

mark_j said:


> Because you've disconnected manually.
> To quote the handbook:
> 
> Perhaps the only way is to stop the sdpd daemon. `service sdpd stop`.


Okay I will try that. 
I have 2 bluetooth headphones. Samsung Level U & Mi Super Bass. I am able to connect the Samsung but not the Mi.
This is the Mi >> Click here


----------



## john_rambo (Apr 29, 2021)

The Level U headphone is Bluetooth 4.1.
The Mi Super Bass headphone is Bluetooth 5.0.

I am able to connect the Level U headphone but not the Mi Super Bass headphone.

So is Bluetooth 5.0 not supported under FreeBSD ?


----------



## mark_j (Apr 29, 2021)

Apparently not:








						idea about Bluetooth version 4 development for all BSD communities
					

The BSD community, not only FreeBSD, should look into supporting Bluetooth version 4 drivers. Bluetooth version 4 dongles are backward compatible with devices using previous Bluetooth versions, and they are inexpensive. It's not worth wasting time on Bluetooth version 2 and 3 dongle drivers...




					forums.freebsd.org


----------



## john_rambo (Apr 29, 2021)

mark_j 
That's really disappointing. I use my Mi headphone for movies & at the moment I am using Linux Mint's live mode (usb drive) for that. Its a really tiresome process. I have to configure both WiFi & bluetooth every time coz since its  Live all changes are lost once I reboot. The only reason I am using BSD is security otherwise Linux is more easy (to me).

I hope proper bluetooth support gets implemented in the near future.


----------

