# FreeBSD 9.2 bluetooth not working



## gentoobob (Dec 28, 2013)

So I am not sure if this is a driver issue or I am doing something wrong or missing a step. I'm convinced it's driver related.  First time using Bluetooth in FreeBSD.  I followed the Handbook for Bluetooth.  Two issues that I see that are different from what the Handbook shows.


 when starting the Bluetooth service with the Bluetooth device, I do not see output as it shows in the Handbook.
 when I run the inquiry command, it does not show or recognize any devices.

Below is my dmesg and rc.conf, loader.conf, and ubt0.conf files.  

dmesg:

```
ugen1.3: <vendor 0x04ca> at usbus1
ubt0: <vendor 0x04ca product 0x3006, class 224/1, rev 1.10/0.01, addr 3> on usbus1
```

rc.conf:

```
ubthidhci_enable="YES"
ubthidhci_busnum="1"
ubthidhci_addr="3"
hcsecd_enable="YES"
sdpd_enable="YES"
```

loader.conf

```
ng_ubt_load=”YES”
```

ubt0.conf - by default, nothing is uncommented. I only uncommented the following in the file.

```
connectable="YES"
discoverable="YES"
local_name="My Device"
```


```
[root@host /home/user]# service bluetooth stop ubt0
[root@host /home/user]# service bluetooth start ubt0
[root@host /home/user]#
```


```
[root@host /home/user]# hccontrol read_node_list
Name            ID       Num hooks
ubt0hci         00000077         3
[root@host /home/user]#
```


```
[root@host /home/user]# hccontrol -n ubt0hci inquiry
Inquiry complete. Status: No error [00]
[root@host /home/user]#
```

I am working with a*n* Acer N2620G Nettop. Supposedly this is a*n* Atheros bluetooth 4.0 (AR5BWB222). 

Any advice or help will be greatly appreciated.  Thank you.


----------



## trh411 (Dec 28, 2013)

A few questions and observations:

You are missing 
	
	



```
bthidd_enable=yes
```
 in your /etc/rc.conf file
The /boot/loader.conf statement is unnecessary as ng_ubt is already in the kernel. Try `kldload ng_ubt` to confirm.
Did you reboot after all the changes to /etc/rc.conf et.al or start all the services manually?
What kind of Bluetooth device are you trying to connect?
Is the device in discover mode when you execute `hccontrol -n ubt0hci inquiry`?


----------



## gentoobob (Dec 28, 2013)

Thanks for the reply trh411.  To answer your questions.

I did add the missing line.  Once I rebooted, it said it couldn't read the bthidd.conf file.  There was not one so I created it.  Now when I start the bthidd service, it states that there is a syntax error on line 1.  I do not know what the configuration is suppose*d* to look like nor can I find one.  
Yes that module was already loaded.
I had done both reboot and manually start services.
The Bluetooth device is a*n* integrated one that*'*s attached to the USB.  It is not an external device.
Yes, I have three devices in discovery.  Macbook, iPhone, and keyboard.

When I did a reboot after modification of the above steps, this is what I received in my dmesg:


```
ubt0: <vendor 0x04ca product 0x3006, class 224/1, rev 1.10/0.01, addr 3> on usbus1
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
ubt0: ubt_bulk_read_callback:873: bulk-in transfer failed: USB_ERR_STALLED
ubt0: ubt_intr_read_callback:773: interrupt transfer failed: USB_ERR_STALLED
ugen1.3: <vendor 0x04ca> at usbus1 (disconnected)
ubt0: at uhub3, port 4, addr 3 (disconnected)
ugen1.3: <vendor 0x04ca> at usbus1
ubt0: <vendor 0x04ca product 0x3006, class 224/1, rev 1.10/0.01, addr 3> on usbus1
ubt0: ubt_ctrl_write_callback:674: control transfer failed: USB_ERR_TIMEOUT
ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command OGF=0x1, OCF=0x1. Timeout
```


----------



## ljboiler (Dec 28, 2013)

If you have the source code for the base system installed (/usr/src/...), /usr/src/usr.sbin/bluetooth/bthidd/bthidd.conf.sample might help.


----------



## ondra_knezour (Dec 28, 2013)

Also available via the svnweb


----------



## trh411 (Dec 28, 2013)

gentoobob said:
			
		

> 5. Yes, I have three devices in discovery.  Macbook, iPhone, and keyboard.



Only put one device into discovery mode at a time. While that one device is in discovery mode you should then get output from `hccontrol -n ubt0hci inquiry`. Do you? This is a critical first step, as without the MAC address you will not be able to define the device to BT.

IIRC, the /etc/bluetooth/bthidd.conf file has to have at least one blank line (to start with). Anyway, the error can be ignored at this point since you don't have anything to add to the file yet.

When you get the MAC address of the device you will add each of them to /etc/bluetooth/hosts. Also, you should add a stanza in the /etc/bluetooth/hcsecd.conf file that looks something like:

```
device {
	bdaddr	84:38:35:1c:2f:14;
	name	"My Wireless Mouse";
	key	nokey;
	pin "0000";
```
where the bdaddr is the unique MAC address of the device.

The /etc/bluetooth/bthidd.conf file gets populated with the hex output from `bthidcontrol -a btkeyboard query`, which you can get once you have the MAC address of the device. BTW, in the example 'btkeyboard' is the alias for the device found in the /etc/bluetooth/hosts file. You can substitute the MAC address if you prefer not to use the /etc/bluetooth/hosts file.


----------



## gentoobob (Dec 28, 2013)

@ljboiler, I did have the source code installed but there was no ../bthidd directory. 

Thanks for the link, @ondra_knezour.  

@trh411, thanks for your continuing help. I have tried just one device at a time and I get the same response. 

```
Inquiry complete. Status: No error [00]
```


----------



## gentoobob (Dec 28, 2013)

Okay. I found the issue. I have 3 USB hubs. Two of which are USB 2.0 and one is USB 3.0. One of the USB 2.0 hubs is getting shut down or just not turned back on during FreeBSD boot. The one USB hub that is not getting turned back on is the one that the Bluetooth is connected to. I have tested my theory by putting a USB keyboard the working USB 2.0 hub and a USB mouse in the one that gets turned off after FreeBSD boots up. Once FreeBSD starts booting, both keyboard and mouse turn off, but only the keyboard comes back on, not the mouse.

I also took a Linux Mint LiveCD and a Windows 7 boot disc and make sure it wasn't hardware/bios related and its not. The second USB hub works fine. I have also tinkered with BIOS settings. That did not work. The BIOS is pretty simple, you can't even turn off WiFi/Bluetooth on it. FreeBSD 9.2 will not turn the second USB hub back on. If I stick the mouse in and out, it will power it on for a second then lose power. It never recognizes the mouse. Ever heard of this?

Also, I had a friend let me borrow a Broadcom USB Bluetooth adapter. I plugged it in and it works fine, just not on the USB hub that gets turned off. I have tried running the command `usbconfig -d ugen2.1 power_on` and `usbconfig -d ugen2.1 reset` but it does nothing. It will work with the other USB hubs, but nothing for the second.


----------



## trh411 (Dec 29, 2013)

gentoobob said:
			
		

> It will work with the other USB hubs, but nothing for the second.



It may just be defective. I can't count the number of USB hubs or ports on USB hubs that have gone bad on me over the years.


----------



## gentoobob (Dec 29, 2013)

That could be true.  I have a spare hard drive.  I'm going to see how the FreeBSD 10 RC3 handles everything.  Toy around with it. 
Thanks again for your help!


----------

