# Integrated bluetooth on mini PCIe wireless card



## asys (Feb 16, 2017)

Some wireless card comes with bluetooth module integrated on them. Are these bluetooth modules supported by FreeBSD? As far as i'm aware of, the handbook had only mentioned about USB bluetooth dongle.

For instance, Intel Dual Band Wireless-AC 3160 comes with integrated bluetooth module. The card is supported by iwm(4) driver. Does this also covers the bluetooth functionality of it?


----------



## SirDice (Feb 16, 2017)

asys said:


> Does this also covers the bluetooth functionality of it?


As far as I know the iwn(4) driver only deals with the wifi part. But to be honest I'm not sure how these dual functionality cards are handled.


----------



## asys (Feb 16, 2017)

Well, at least people have the wifi part sorted out. One down, another one to go.


----------



## wblock@ (Feb 16, 2017)

I've tried a couple of wireless cards with Bluetooth, and the BT part appears as a USB device.  I wish I could say I was successful in using BT peripherals reliably, but that's another matter.


----------



## asys (Feb 17, 2017)

wblock@ said:


> I've tried a couple of wireless cards with Bluetooth, and the BT part appears as a USB device.  I wish I could say I was successful in using BT peripherals reliably, but that's another matter.


Interesting. What's the possibility that the bluetooth part works regardless of the wireless card not being supported?


----------



## wblock@ (Feb 17, 2017)

Don't know, but I wouldn't be surprised.  In the ones I tried, it's really a separate device, although it appeared to share the same antennas.


----------



## asys (Feb 18, 2017)

wblock@ said:


> Don't know, but I wouldn't be surprised.  In the ones I tried, it's really a separate device, although it appeared to share the same antennas.


One last thing. Do usb devices show even when it doesn't have proper driver loaded the way pci/e devices do with `# pciconf -lv`?


----------



## asys (Feb 18, 2017)

Something weird just happened. I swear to you that ubt0 wasn't there before but for whatever reason it shows up on my last boot. I believe this to be a bluetooth device on my QCA9377(not supported) wireless card because I don't have any bluetooth usb dongle attached this machine. The thing is, I haven't been able to make it work. Below are the content of `# usbconfig show_ifdrv` from live cd environment:

```
ugen0.1: <XHCI root HUB 0x8086> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.1.0: uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1>
[b]ugen0.2: <product 0x3015 vendor 0x04ca> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
ugen0.2.0: ubt0: <vendor 0x04ca product 0x3015, class 224/1, rev 2.01/0.01, addr 1>[/b]
ugen0.3: <HD WebCam SunplusIT INC.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.4: <Ultra Fit SanDisk> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)
ugen0.4.0: umass0: <SanDisk Ultra Fit, class 0/0, rev 3.00/1.00, addr 3>
```
Sidenote: usbconfig(8) manpage lefts a bunch of command argument undocumented. The above "show_ifdrv" comes from usage note that makes no mention of the action performed. I just try things out to see what each of these does.


----------



## wblock@ (Feb 18, 2017)

ugen means no specific driver has attached to the device.  See https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-bluetooth.html.


----------



## asys (Feb 19, 2017)

I've never asked anything in this forum without consulting the handbook firsthand. Believe me, the last thing I wanted to do is wasting other people's time.

`usbconfig show_ifdrv` gave below output:

```
ugen0.1: <XHCI root HUB 0x8086> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=SAVE (0mA)
ugen0.1.0: uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1>
ugen0.2: <product 0x3015 vendor 0x04ca> at usbus0, cfg=0 md=HOST spd=FULL (12Mbps) pwr=ON (100mA)
[b]ugen0.2.0: ubt0: <vendor 0x04ca product 0x3015, class 224/1, rev 2.01/0.01, addr 1>[/b]
ugen0.3: <HD WebCam SunplusIT INC.> at usbus0, cfg=0 md=HOST spd=HIGH (480Mbps) pwr=ON (500mA)
ugen0.4: <Ultra Fit SanDisk> at usbus0, cfg=0 md=HOST spd=SUPER (5.0Gbps) pwr=ON (224mA)
ugen0.4.0: umass0: <SanDisk Ultra Fit, class 0/0, rev 3.00/1.00, addr 3>
```
I boot from a usb stick ugen0.4.0: umass0: <SanDisk Ultra Fit, class 0/0, rev 3.00/1.00, addr 3>. So, I figure that umass0 is the driver for the usb stick. Well, doesn't that makes ubt0 in ugen0.2.0: ubt0: <vendor 0x04ca product 0x3015, class 224/1, rev 2.01/0.01, addr 1> the driver for a bluetooth module? I believe I had the driver loaded and then tried to start bluetooth service with `service bluetooth start ubt0` and get this error: /etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0.

To be sure, I loaded all the bluetooth drivers mentioned in the handbook. Below is my `kldstat` and /var/run/dmesg.boot(bluetooth device in bold) respectively:

```
Id Refs Address            Size     Name
 1   21 0xffffffff80200000 1fa7c38  kernel
 2    1 0xffffffff82619000 4fac     ng_ubt.ko
 3    6 0xffffffff8261e000 befc     netgraph.ko
 4    1 0xffffffff8262a000 a58f     ng_hci.ko
 5    3 0xffffffff82635000 107c     ng_bluetooth.ko
 6    1 0xffffffff82637000 d57d     ng_l2cap.ko
 7    1 0xffffffff82645000 1b187    ng_btsocket.ko
 8    1 0xffffffff82661000 393d     ng_socket.ko
 9    1 0xffffffff82665000 355e     ubtbcmfw.ko
10    1 0xffffffff82669000 470f     ng_bt3c.ko
```


```
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
   The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 11.0-RELEASE-p1 #0 r306420: Thu Sep 29 01:43:23 UTC 2016
    root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM 3.8.0)
VT(efifb): resolution 1366x768
CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz (2400.09-MHz K8-class CPU)
  Origin="GenuineIntel"  Id=0x406e3  Family=0x6  Model=0x4e  Stepping=3
  Features=0xbfebfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,DTS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE>
  Features2=0x7ffafbbf<SSE3,PCLMULQDQ,DTES64,MON,DS_CPL,VMX,EST,TM2,SSSE3,SDBG,FMA,CX16,xTPR,PDCM,PCID,SSE4.1,SSE4.2,x2APIC,MOVBE,POPCNT,TSCDLT,AESNI,XSAVE,OSXSAVE,AVX,F16C,RDRAND>
  AMD Features=0x2c100800<SYSCALL,NX,Page1GB,RDTSCP,LM>
  AMD Features2=0x121<LAHF,ABM,Prefetch>
  Structured Extended Features=0x29c67af<FSGSBASE,TSCADJ,SGX,BMI1,AVX2,SMEP,BMI2,ERMS,INVPCID,NFPUSG,MPX,RDSEED,ADX,SMAP,CLFLUSHOPT,PROCTRACE>
  XSAVE Features=0xf<XSAVEOPT,XSAVEC,XINUSE,XSAVES>
  VT-x: PAT,HLT,MTF,PAUSE,EPT,UG,VPID
  TSC: P-state invariant, performance statistics
real memory  = 4294967296 (4096 MB)
avail memory = 3964248064 (3780 MB)
Event timer "LAPIC" quality 600
ACPI APIC Table: <ACRSYS ACRPRDCT>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 2 core(s) x 2 hardware threads
ioapic0 <Version 2.0> irqs 0-119 on motherboard
random: entropy device external interface
kbd1 at kbdmux0
netmap: loaded module
module_register_init: MOD_LOAD (vesa, 0xffffffff8101c950, 0) error 19
random: registering fast source Intel Secure Key RNG
random: fast provider: "Intel Secure Key RNG"
cryptosoft0: <software crypto> on motherboard
acpi0: <ACRSYS ACRPRDCT> on motherboard
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
cpu2: <ACPI CPU> on acpi0
cpu3: <ACPI CPU> on acpi0
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff on acpi0
Timecounter "HPET" frequency 24000000 Hz quality 950
Event timer "HPET" frequency 24000000 Hz quality 550
Event timer "HPET1" frequency 24000000 Hz quality 440
Event timer "HPET2" frequency 24000000 Hz quality 440
Event timer "HPET3" frequency 24000000 Hz quality 440
Event timer "HPET4" frequency 24000000 Hz quality 440
atrtc0: <AT realtime clock> port 0x70-0x77 irq 8 on acpi0
atrtc0: Warning: Couldn't map I/O.
Event timer "RTC" frequency 32768 Hz quality 0
attimer0: <AT timer> port 0x40-0x43,0x50-0x53 irq 0 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
Timecounter "ACPI-safe" frequency 3579545 Hz quality 850
acpi_timer0: <24-bit timer at 3.579545MHz> port 0x1808-0x180b on acpi0
acpi_ec0: <Embedded Controller: GPE 0x50> port 0x62,0x66 on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pcib0: _OSC returned error 0x4
pci0: <ACPI PCI bus> on pcib0
vgapci0: <VGA-compatible display> port 0x5000-0x503f mem 0x92000000-0x92ffffff,0xa0000000-0xafffffff at device 2.0 on pci0
vgapci0: Boot video device
xhci0: <XHCI (generic) USB 3.0 controller> mem 0x94500000-0x9450ffff at device 20.0 on pci0
xhci0: 32 bytes context size, 64-bit DMA
usbus0: waiting for BIOS to give up control
usbus0 on xhci0
pci0: <simple comms> at device 22.0 (no driver attached)
ahci0: <Intel Sunrise Point-LP AHCI SATA controller> port 0x5080-0x5087,0x5088-0x508b,0x5060-0x507f mem 0x94528000-0x94529fff,0x94530000-0x945300ff,0x9452e000-0x9452e7ff at device 23.0 on pci0
ahci0: AHCI v1.31 with 2 6Gbps ports, Port Multiplier not supported
ahcich0: <AHCI channel> at channel 0 on ahci0
ahcich1: <AHCI channel> at channel 1 on ahci0
pcib1: <ACPI PCI-PCI bridge> at device 28.0 on pci0
pci1: <ACPI PCI bus> on pcib1
vgapci1: <VGA-compatible display> port 0x4000-0x407f mem 0x93000000-0x93ffffff,0x80000000-0x8fffffff,0x90000000-0x91ffffff at device 0.0 on pci1
pcib2: <ACPI PCI-PCI bridge> at device 28.4 on pci0
pci2: <ACPI PCI bus> on pcib2
pci2: <unknown> at device 0.0 (no driver attached)
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0x3000-0x30ff mem 0x94404000-0x94404fff,0x94400000-0x94403fff at device 0.1 on pci2
re0: Using 1 MSI-X message
re0: turning off MSI enable bit.
re0: ASPM disabled
re0: Chip rev. 0x5c800000
re0: MAC rev. 0x00000000
miibus0: <MII bus> on re0
rgephy0: <RTL8251 1000BASE-T media interface> PHY 1 on miibus0
rgephy0:  none, 10baseT, 10baseT-FDX, 10baseT-FDX-flow, 100baseTX, 100baseTX-FDX, 100baseTX-FDX-flow, 1000baseT-FDX, 1000baseT-FDX-master, 1000baseT-FDX-flow, 1000baseT-FDX-flow-master, auto, auto-flow
re0: Using defaults for TSO: 65518/35/2048
re0: Ethernet address: 1c:39:47:99:fd:e0
re0: netmap queues/slots: TX 1/256, RX 1/256
pcib3: <ACPI PCI-PCI bridge> at device 28.5 on pci0
pci3: <ACPI PCI bus> on pcib3
pci3: <network> at device 0.0 (no driver attached)
isab0: <PCI-ISA bridge> at device 31.0 on pci0
isa0: <ISA bus> on isab0
pci0: <memory> at device 31.2 (no driver attached)
hdac0: <Intel Sunrise Point-LP HDA Controller> mem 0x94520000-0x94523fff,0x94510000-0x9451ffff at device 31.3 on pci0
acpi_button0: <Sleep Button> on acpi0
acpi_tz0: <Thermal Zone> on acpi0
acpi_tz1: <Thermal Zone> on acpi0
atkbdc0: <Keyboard controller (i8042)> port 0x60,0x64 irq 1 on acpi0
atkbd0: <AT Keyboard> irq 1 on atkbdc0
kbd0 at atkbd0
atkbd0: [GIANT-LOCKED]
battery0: <ACPI Control Method Battery> on acpi0
acpi_acad0: <AC Adapter> on acpi0
acpi_lid0: <Control Method Lid Switch> on acpi0
battery1: <ACPI Control Method Battery> on acpi0
battery2: <ACPI Control Method Battery> on acpi0
battery3: <ACPI Control Method Battery> on acpi0
acpi_lid1: <Control Method Lid Switch> on acpi0
ppc0: cannot reserve I/O port range
est0: <Enhanced SpeedStep Frequency Control> on cpu0
est1: <Enhanced SpeedStep Frequency Control> on cpu1
est2: <Enhanced SpeedStep Frequency Control> on cpu2
est3: <Enhanced SpeedStep Frequency Control> on cpu3
Timecounters tick every 1.000 msec
nvme cam probe device init
hdacc0: <Realtek (0x0255) HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek (0x0255) Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek (0x0255) (Internal Analog)> at nid 20 and 18 on hdaa0
pcm1: <Realtek (0x0255) (Front Analog Headphones)> at nid 33 on hdaa0
hdacc1: <Intel (0x2809) HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel (0x2809) Audio Function Group> at nid 1 on hdacc1
usbus0: 5.0Gbps Super Speed USB v3.0
ugen0.1: <0x8086> at usbus0
uhub0: <0x8086 XHCI root HUB, class 9/0, rev 3.00/1.00, addr 1> on usbus0
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <WDC WD10JPVX-22JC3T0 01.01A01> ACS-2 ATA SATA 3.x device
cd0 at ahcich1 bus 0 scbus1 target 0 lun 0
cd0: <Slimtype DVD A  DA8A6SH GA11> Removable CD-ROM SCSI device
cd0: Serial Number 0080F0086021630BF101
cd0: 150.000MB/s transfers (SATA 1.x, UDMA6, ATAPI 12bytes, PIO 8192bytes)
cd0: Attempt to query device size failed: NOT READY, Medium not present - tray closed
ada0: Serial Number WD-WXP1EB54WW14
ada0: 600.000MB/s transfers (SATA 3.x, UDMA6, PIO 8192bytes)
ada0: Command Queueing enabled
ada0: 953869MB (1953525168 512 byte sectors)
SMP: AP CPU #1 Launched!
SMP: AP CPU #2 Launched!
SMP: AP CPU #3 Launched!
Timecounter "TSC-low" frequency 1200044430 Hz quality 1000
Trying to mount root from ufs:/dev/ufs/FreeBSD_Install [ro,noatime]...
Root mount waiting for: usbus0
uhub0: 18 ports with 18 removable, self powered
ugen0.2: <vendor 0x04ca> at usbus0
Root mount waiting for: usbus0
ugen0.3: <SunplusIT INC.> at usbus0
Root mount waiting for: usbus0
Root mount waiting for: usbus0
ugen0.4: <SanDisk> at usbus0
umass0: <SanDisk Ultra Fit, class 0/0, rev 3.00/1.00, addr 3> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0xc100
umass0:2:0: Attached to scbus2
mountroot: waiting for device /dev/ufs/FreeBSD_Install...
da0 at umass-sim0 bus 0 scbus2 target 0 lun 0
da0: <SanDisk Ultra Fit 1.00> Removable Direct Access SPC-4 SCSI device
da0: Serial Number 4C531001371027114000
da0: 400.000MB/s transfers
da0: 29327MB (60062500 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
random: unblocking device.
re0: link state changed to DOWN
[b]ubt0: <vendor 0x04ca product 0x3015, class 224/1, rev 2.01/0.01, addr 1> on usbus0[/b]
WARNING: attempt to domain_add(bluetooth) after domainfinalize()
WARNING: attempt to domain_add(netgraph) after domainfinalize()
```
If this happens because the bluetooth module on the wireless card is required for the bluetooth to function, I should forsake this pursuit. Otherwise, I would like to know if there's anything wrong that makes this integrated bluetooth module fails to work.


----------

