Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 516532 - net-wireless/bluez-5.18 - /lib/udev/hid2hci fails to switch BCM2046B1 to hci
Summary: net-wireless/bluez-5.18 - /lib/udev/hid2hci fails to switch BCM2046B1 to hci
Status: RESOLVED TEST-REQUEST
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Pacho Ramos
URL: https://forums.gentoo.org/viewtopic-p...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-07-06 18:24 UTC by MickKi
Modified: 2015-04-03 18:33 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
dmesg when booting with bt adaptor enabled. (dmesg.txt,13.33 KB, text/plain)
2014-07-16 16:36 UTC, MickKi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description MickKi 2014-07-06 18:24:24 UTC
I apologise in advance if this problem is not related to hid2hci, but my understanding is rather incomplete about udev.  All I know is that my Dell Wireless 370 Bluetooth Mini-card is no longer initialised by the current /etc/init.d/bluetooth script, it complains that rfcomm does not exist and hcitool does not list a device.  If I have got this all wrong, please adjust the Summary of this report accordingly.  So, something changed over the last few months and currently with kernel (3.12.21-gentoo), udev (212-r1), and bluez(5.18 ) bluetooth will not come up.

Reproducible: Always

Steps to Reproduce:
1. /etc/init.d/bluetooth start
2.
3.
Actual Results:  
#  /etc/init.d/bluetooth start
 * ERROR: bluetooth needs service(s) rfcomm

Expected Results:  
The start up script should also create /dev/rfcomm0 after loading relevant modules (bnep, rfcomm).

# lsmod
Module                  Size  Used by
ip6t_rt                 1736  3 
snd_hda_codec_hdmi     26231  1 
snd_hda_codec_idt      33362  1 
snd_hda_intel          25334  5 
b43                   174020  0 
btusb                  14115  0 
bluetooth             173578  2 btusb
snd_hda_codec         107644  3 snd_hda_codec_hdmi,snd_hda_codec_idt,snd_hda_intel
mac80211              215279  1 b43
snd_hwdep               5005  1 snd_hda_codec
snd_pcm                63187  3 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel
cfg80211              145895  2 b43,mac80211
rfkill                  8825  3 cfg80211,bluetooth
snd_page_alloc          5914  2 snd_pcm,snd_hda_intel
ssb                    36233  1 b43
snd_timer              15070  1 snd_pcm
video                  10732  0 
snd                    47964  17 snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_hda_codec_idt,snd_pcm,snd_hda_codec,snd_hda_intel
firewire_ohci          26421  0 
uvcvideo               59382  0 
firewire_core          42798  1 firewire_ohci
videobuf2_vmalloc       2384  1 uvcvideo
videobuf2_memops        1463  1 videobuf2_vmalloc
dell_laptop             8419  0 
videobuf2_core         20864  1 uvcvideo

$ dmesg | grep Bluetooth
[    8.811951] usb 2-1.6.3: Product: Dell Wireless 370 Bluetooth Mini-card
[    8.989800] Bluetooth: Core ver 2.16
[    8.989814] Bluetooth: HCI device and connection manager initialized
[    8.989821] Bluetooth: HCI socket layer initialized
[    8.989823] Bluetooth: L2CAP socket layer initialized
[    8.989828] Bluetooth: SCO socket layer initialized


# hciconfig -a
hci0:	Type: BR/EDR  Bus: USB
	BD Address: 90:4C:E5:FA:F2:A8  ACL MTU: 1021:8  SCO MTU: 64:8
	DOWN 
	RX bytes:484 acl:0 sco:0 events:20 errors:0
	TX bytes:323 acl:0 sco:0 commands:20 errors:0
	Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x83
	Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
	Link policy: RSWITCH HOLD SNIFF PARK 
	Link mode: SLAVE ACCEPT 

$ lsusb | grep -i blue 
Bus 002 Device 006: ID 413c:8156 Dell Computer Corp. Wireless 370 Bluetooth Mini-card
Bus 002 Device 003: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth)

$ udevadm trigger --dry-run --subsystem-match=usb --attr-match=idVendor=413c --attr-match=idProduct=8156 --verbose
/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.3

$ /lib/udev/hid2hci --devpath=/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.3 --mode=hci --method=dell 
error: could not find '/sys/devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.3'


Please ask if you need more information.

-- 
Regards,
Mick
Comment 1 Samuli Suominen (RETIRED) gentoo-dev 2014-07-06 20:18:10 UTC
Duplicate of bug 505362 ?
Comment 2 MickKi 2014-07-06 22:12:30 UTC
(In reply to Samuli Suominen from comment #1)
> Duplicate of bug 505362 ?

Thanks Samuli, but I don't think it is an exact duplicate.  I can bring up the device with hciconfig, but the problem is that it is still not seen by bluetoothctl; bnep and rfcomm modules are not loaded and even if I load them manually I still cannot access the device with bluetoothctl.

I suspect that the device is taken over by hid and the hid2hci is not working for some reason due to the path error I reported.
-- 
Regards,
Mick
Comment 3 Pacho Ramos gentoo-dev 2014-07-07 09:34:17 UTC
Please try with 5.20-r1

Also look at:
https://wiki.archlinux.org/index.php/bluetooth#hcitool_scan:_Device_not_found

And I am unsure if maybe reloading btusb module with "reset=1" option could help
Comment 4 Pacho Ramos gentoo-dev 2014-07-08 08:51:58 UTC
Or even better with 5.21 that upstream released a few days ago :)
Comment 5 MickKi 2014-07-13 11:17:25 UTC
Thank you both,

I have now emerged v-5.21 and things have changed a little.  Trying to start bluetooth now gives:

# /etc/init.d/bluetooth start
 * rfcomm: waiting for bluetooth (50 seconds)
 * rfcomm: waiting for bluetooth (41 seconds)
 * rfcomm: waiting for bluetooth (32 seconds)
 * rfcomm: waiting for bluetooth (23 seconds)
 * rfcomm: waiting for bluetooth (14 seconds)
 * rfcomm: waiting for bluetooth (5 seconds)
 * rfcomm: timed out waiting for bluetooth
 * ERROR: cannot start rfcomm as bluetooth would not start
 * ERROR: cannot start bluetooth as rfcomm would not start

Indeed, there is still no /dev/rfcomm and furthermore neither bnep nor rfcomm modules were loaded.  In addition, the hcitool does not show any hciX devices.

Just as before, I then modprobed bnep and rfcomm by hand, used hciconfig to initialise hci0 and set it with hciconfig to do page and iscan, but /etc/init.d/bluetooth still failed to start.

Using bluetoothctl now just hangs completely and keypresses are not shown in the terminal - I have to kill its pid.  This is what the log shows:

 dbus[1380]: [system] Activating service name='org.bluez' (using servicehelper)
 dbus[1380]: [system] Activated service 'org.bluez' failed: Launch helper exited with unknown return code 1

The hid2hci command continues to fail in the same fashion, i.e. the device path is not recognised and this is where I suspect the real problem lies.  Udev does not/cannot initialise the device, because it is detected as hid instead of hci.  What I have not tried is to set up /dev/rfcomm0 manually, but this would be somewhat too much of a manual exercise - imagine having to go through all this each time say, I needed to use a bluetooth mouse or keyboard!  O_O

Given the previously reported hid2hci error should I report another bug in case this problem is lost in the bluetooth related noise?
-- 
Regards,
Mick
Comment 6 Pacho Ramos gentoo-dev 2014-07-14 09:30:14 UTC
Did you set up rfcomm in the new way? Please see bug 505786 for reference
Comment 7 MickKi 2014-07-14 11:33:20 UTC
(In reply to Pacho Ramos from comment #6)
> Did you set up rfcomm in the new way? Please see bug 505786 for reference

Thanks Pacho, I looked at the bug and copied over the /etc/init.d/rfcomm provided there, which is different from the one installed by bluez-5.21 (shown below as rfcomm_ORIG):
====================================
--- rfcomm_ORIG 2014-07-13 11:26:58.599972137 +0100
+++ rfcomm      2014-07-14 12:18:05.092038593 +0100
@@ -1,15 +1,19 @@
 #!/sbin/runscript
-# Copyright 1999-2014 Gentoo Foundation
+# Copyright 1999-2012 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/files/rfcomm-init.d-r2,v 1.1 2014/06/26 17:18:43 alonbl Exp $
+# $Header: $
 
 depend() {
        need bluetooth
 }
 
 checkconfig() {
+       if [ "${RC_SVCNAME}" = "rfcomm" ]; then
+               eerror "you need to create rfcomm.<DEVICE_NAME> symlink"
+               return 1
+       fi
        if [ -z "${ADDRESS}" ]; then
-               eerror "ADDRESS must be set"
+               eerror "${DEVICE}_address must be set"
                return 1
        fi
 
@@ -17,8 +21,9 @@
 }
 
 start() {
-       local DEVICE=${RC_SVCNAME#*.}
-
+       DEVICE=${RC_SVCNAME#*.}
+       eval ADDRESS=\$${DEVICE}_address
+       eval CHANNEL=\$${DEVICE}_channel
        checkconfig || return 1
 
        ebegin "Starting ${RC_SVCNAME}"
====================================

I do not have a /etc/conf.d/rfcomm, but have /etc/bluetooth/rfcomm.conf.  Will it read this by default, or should I specify it somewhere?  In any case, trying to start rfcomm goes into a circular argument, just like when I try to start bluetooth:

# /etc/init.d/rfcomm start
 * Caching service dependencies ...                                         [ ok ]
 * bluetooth: waiting for rfcomm (50 seconds)
 * bluetooth: waiting for rfcomm (41 seconds)
 * bluetooth: waiting for rfcomm (32 seconds)
 * bluetooth: waiting for rfcomm (23 seconds)
 * bluetooth: waiting for rfcomm (14 seconds)
 * bluetooth: waiting for rfcomm (5 seconds)
 * bluetooth: timed out waiting for rfcomm
 * ERROR: cannot start bluetooth as rfcomm would not start
 * ERROR: cannot start rfcomm as bluetooth would not start

# /etc/init.d/bluetooth start
 * rfcomm: waiting for bluetooth (50 seconds)
 * rfcomm: waiting for bluetooth (41 seconds)
 * rfcomm: waiting for bluetooth (32 seconds)
 * rfcomm: waiting for bluetooth (23 seconds)
 * rfcomm: waiting for bluetooth (14 seconds)
 * rfcomm: waiting for bluetooth (5 seconds)
 * rfcomm: timed out waiting for bluetooth
 * ERROR: cannot start rfcomm as bluetooth would not start
 * ERROR: cannot start bluetooth as rfcomm would not start

Am I supposed to do something different?
-- 
Regards,
Mick
Comment 8 Pacho Ramos gentoo-dev 2014-07-14 11:42:33 UTC
You should instead try to use the init.d scripts from 5.21 as Alon suggests:
https://bugs.gentoo.org/show_bug.cgi?id=505786#c14
Comment 9 MickKi 2014-07-14 11:55:28 UTC
(In reply to Pacho Ramos from comment #8)
> You should instead try to use the init.d scripts from 5.21 as Alon suggests:
> https://bugs.gentoo.org/show_bug.cgi?id=505786#c14

Ah!  Sorry, I should have said:  Using the bluez-5.21 script I am getting exactly the same error.
-- 
Regards,
Mick
Comment 10 Pacho Ramos gentoo-dev 2014-07-14 12:07:14 UTC
Then, try simply running the commands the init.d scripts try to run to see why are they failing:
rfcomm bind "${DEVICE}" "${ADDRESS}" ${CHANNEL} -> not sure what is your device, address, channel

/usr/libexec/bluetooth/bluetoothd
Comment 11 MickKi 2014-07-14 20:43:59 UTC
Thank you for persevering with me!  :-)

So, this is what I tried:

# hciconfig hci0 up piscan

# rfcomm bind "rfcomm0" "90:4C:E5:FA:F2:A8"

(where "90:4C:E5:FA:F2:A8" is the MAC of the laptop's bluetooth device)

The log shows that rfcomm and bnep modules are loaded, good news.  However, running bluetoothd as suggested reports this error:

# /usr/libexec/bluetooth/bluetoothd -n
bluetoothd[8143]: Bluetooth daemon 5.21
bluetoothd[8143]: Starting SDP server
bluetoothd[8143]: Bluetooth management interface 1.3 initialized
bluetoothd[8143]: Sap driver initialization failed.
bluetoothd[8143]: sap-server: Operation not permitted (1)

The log shows:

 kernel: Bluetooth: RFCOMM TTY layer initialized
 kernel: Bluetooth: RFCOMM socket layer initialized
 kernel: Bluetooth: RFCOMM ver 1.11
 bluetoothd[7921]: Bluetooth daemon 5.21
 bluetoothd[7921]: Starting SDP server
 kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
 kernel: Bluetooth: BNEP filters: protocol multicast
 kernel: Bluetooth: BNEP socket layer initialized
 bluetoothd[7921]: Bluetooth management interface 1.3 initialized
 bluetoothd[7921]: Sap driver initialization failed.
 bluetoothd[7921]: sap-server: Operation not permitted (1)
 pulseaudio[3465]: [pulseaudio] bluez5-util.c: Properties changed in unknown adapter
 pulseaudio[3465]: [pulseaudio] bluez5-util.c: Properties changed in unknown adapter
 pulseaudio[3465]: [pulseaudio] bluez5-util.c: Properties changed in unknown adapter

'hcitool scan' no longer shows the name of the phone and hcitool name does not return the name of it.

The /dev/rfcomm0 is being set up and bluetoothctl works as intented, without crashing.  :-)

The bad news is that I can't tether the phone.  :-(

When I run 'pon My_ppp_script' instead of connecting to the phone I get:

# pon My_ppp_script
Failed to open /dev/rfcomm0: No route to host

I haven't tried obexftp, but I guess it will fail.  In any case, in the past (bluez-4) I could run '/etc/init.d/bluetooth start' and all would be initialised and set up ready for me to connect to the phone using an application (bluedevil, ppp, kppp, xgnokie, etc.), now I have to follow umpteen manual incantations and still can't use DUN through bluetooth.  Is it a matter of waiting for the bluez code to improve, is it a matter of waiting for the Gentoo rc scripts to catch up, or is there something else that I can do to get this going?
-- 
Regards,
Mick
Comment 12 Pacho Ramos gentoo-dev 2014-07-14 21:07:28 UTC
Try to run "rfkill list" to ensure no locks are being set
Comment 13 MickKi 2014-07-15 05:44:52 UTC
(In reply to Pacho Ramos from comment #12)
> Try to run "rfkill list" to ensure no locks are being set

Thank you Pacho, I have already checked that neither hard nor soft locks are in place.  With locks hcitool and bluetoothctl would fail to list the device.
Comment 14 Pacho Ramos gentoo-dev 2014-07-15 09:35:37 UTC
Try this:
1. Reboot without running any bluetooth stuff
2. Run the commands manually
3. get dmesg output and attach it here
Comment 15 Pacho Ramos gentoo-dev 2014-07-15 09:35:55 UTC
I would also try with latest kernel ;)
Comment 16 MickKi 2014-07-16 11:08:41 UTC
(In reply to Pacho Ramos from comment #14)
> Try this:
> 1. Reboot without running any bluetooth stuff
> 2. Run the commands manually
> 3. get dmesg output and attach it here

OK, this is what I get when I switch on the wireless/bluetooth adaptor using the buttons on the laptop and then running the rfcomm bind command:
=============================
$ diff dmesg1.txt dmesg2.txt 
1130a1131,1252
> [  177.235058] hub 2-1:1.0: state 7 ports 8 chg 0000 evt 0040
> [  177.235350] hub 2-1:1.0: port 6, status 0101, change 0001, 12 Mb/s
> [  177.339101] hub 2-1:1.0: debounce: port 6: total 100ms stable 100ms status 0x101
> [  177.350119] hub 2-1:1.0: port 6 not reset yet, waiting 10ms
> [  177.412161] usb 2-1.6: new full-speed USB device number 4 using ehci-pci
> [  177.423165] hub 2-1:1.0: port 6 not reset yet, waiting 10ms
> [  177.497034] usb 2-1.6: ep0 maxpacket = 8
> [  177.499385] usb 2-1.6: default language 0x0409
> [  177.499751] usb 2-1.6: udev 4, busnum 2, minor = 131
> [  177.499758] usb 2-1.6: New USB device found, idVendor=0a5c, idProduct=4500
> [  177.499763] usb 2-1.6: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [  177.499767] usb 2-1.6: Product: BCM2046B1
> [  177.499772] usb 2-1.6: Manufacturer: Broadcom
> [  177.500070] usb 2-1.6: usb_probe_device
> [  177.500077] usb 2-1.6: configuration #1 chosen from 1 choice
> [  177.500325] usb 2-1.6: adding 2-1.6:1.0 (config #1, interface 0)
> [  177.500384] hub 2-1.6:1.0: usb_probe_interface
> [  177.500389] hub 2-1.6:1.0: usb_probe_interface - got id
> [  177.500396] hub 2-1.6:1.0: USB hub found
> [  177.500673] hub 2-1.6:1.0: 3 ports detected
> [  177.500679] hub 2-1.6:1.0: compound device; port removable status: FFF
> [  177.500683] hub 2-1.6:1.0: ganged power switching
> [  177.500686] hub 2-1.6:1.0: global over-current protection
> [  177.500691] hub 2-1.6:1.0: power on to power good time: 100ms
> [  177.501019] hub 2-1.6:1.0: local power source is good
> [  177.501024] hub 2-1.6:1.0: no over-current condition exists
> [  177.501106] hub 2-1.6:1.0: enabling power on all ports
> [  177.601388] hub 2-1.6:1.0: port 1: status 0101 change 0001
> [  177.601701] hub 2-1.6:1.0: port 2: status 0101 change 0001
> [  177.702110] usb 2-1.6: link qh128-0601/ffff8800c22a1200 start 3 [1/2 us]
> [  177.702212] hub 2-1.6:1.0: state 7 ports 3 chg 0006 evt 0000
> [  177.702384] hub 2-1.6:1.0: port 1, status 0101, change 0000, 12 Mb/s
> [  177.764503] usb 2-1.6.1: new full-speed USB device number 5 using ehci-pci
> [  177.775508] hub 2-1.6:1.0: port 1 not reset yet, waiting 10ms
> [  177.849174] usb 2-1.6.1: ep0 maxpacket = 8
> [  177.852615] usb 2-1.6.1: skipped 1 descriptor after interface
> [  177.852623] usb 2-1.6.1: udev 5, busnum 2, minor = 132
> [  177.852629] usb 2-1.6.1: New USB device found, idVendor=413c, idProduct=8157
> [  177.852634] usb 2-1.6.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> [  177.852907] usb 2-1.6.1: usb_probe_device
> [  177.852914] usb 2-1.6.1: configuration #1 chosen from 1 choice
> [  177.853182] usb 2-1.6.1: adding 2-1.6.1:1.0 (config #1, interface 0)
> [  177.853285] usbhid 2-1.6.1:1.0: usb_probe_interface
> [  177.853292] usbhid 2-1.6.1:1.0: usb_probe_interface - got id
> [  177.855203] input: HID 413c:8157 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.1/2-1.6.1:1.0/input/input15
> [  177.855240] usb 2-1.6.1: link qh8-0601/ffff8800c22a1680 start 4 [1/2 us]
> [  177.855625] hid-generic 0003:413C:8157.0002: input,hidraw1: USB HID v1.11 Keyboard [HID 413c:8157] on usb-0000:00:1d.0-1.6.1/input0
> [  177.855827] hub 2-1.6:1.0: port 2, status 0101, change 0000, 12 Mb/s
> [  177.866563] hub 2-1.6:1.0: port 2 not reset yet, waiting 10ms
> [  177.928605] usb 2-1.6.2: new full-speed USB device number 6 using ehci-pci
> [  177.939609] hub 2-1.6:1.0: port 2 not reset yet, waiting 10ms
> [  177.951395] b43-phy0: Radio hardware status changed to ENABLED
> [  178.013348] usb 2-1.6.2: ep0 maxpacket = 8
> [  178.017437] usb 2-1.6.2: skipped 1 descriptor after interface
> [  178.017443] usb 2-1.6.2: skipped 1 descriptor after endpoint
> [  178.017448] usb 2-1.6.2: udev 6, busnum 2, minor = 133
> [  178.017453] usb 2-1.6.2: New USB device found, idVendor=413c, idProduct=8158
> [  178.017458] usb 2-1.6.2: New USB device strings: Mfr=0, Product=0, SerialNumber=0
> [  178.017703] usb 2-1.6.2: usb_probe_device
> [  178.017708] usb 2-1.6.2: configuration #1 chosen from 1 choice
> [  178.017844] usb 2-1.6.2: adding 2-1.6.2:1.0 (config #1, interface 0)
> [  178.017902] usbhid 2-1.6.2:1.0: usb_probe_interface
> [  178.017907] usbhid 2-1.6.2:1.0: usb_probe_interface - got id
> [  178.020865] input: HID 413c:8158 as /devices/pci0000:00/0000:00:1d.0/usb2/2-1/2-1.6/2-1.6.2/2-1.6.2:1.0/input/input16
> [  178.021280] hid-generic 0003:413C:8158.0003: input,hidraw2: USB HID v1.11 Mouse [HID 413c:8158] on usb-0000:00:1d.0-1.6.2/input0
> [  178.021361] hub 2-1.6:1.0: state 7 ports 3 chg 0000 evt 0004
> [  178.083571] usbhid 2-1.6.2:1.0: disconnect by usbfs
> [  178.111585] b43-phy0: Loading firmware version 666.2 (2011-02-23 01:15:07)
> [  178.115190] b43-phy0 debug: b2062: Using crystal tab entry 19200 kHz.
> [  178.133784] hub 2-1.6:1.0: state 7 ports 3 chg 0000 evt 0008
> [  178.134038] hub 2-1.6:1.0: port 3, status 0101, change 0001, 12 Mb/s
> [  178.238597] hub 2-1.6:1.0: debounce: port 3: total 100ms stable 100ms status 0x101
> [  178.300833] usb 2-1.6.3: new full-speed USB device number 7 using ehci-pci
> [  178.311771] hub 2-1.6:1.0: port 3 not reset yet, waiting 10ms
> [  178.390386] usb 2-1.6.3: skipped 1 descriptor after interface
> [  178.390849] usb 2-1.6.3: default language 0x0409
> [  178.391681] usb 2-1.6.3: udev 7, busnum 2, minor = 134
> [  178.391688] usb 2-1.6.3: New USB device found, idVendor=413c, idProduct=8156
> [  178.391693] usb 2-1.6.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
> [  178.391698] usb 2-1.6.3: Product: Dell Wireless 370 Bluetooth Mini-card
> [  178.391702] usb 2-1.6.3: Manufacturer: Dell Computer Corp
> [  178.391943] usb 2-1.6.3: usb_probe_device
> [  178.391952] usb 2-1.6.3: configuration #1 chosen from 1 choice
> [  178.392184] usb 2-1.6.3: adding 2-1.6.3:1.0 (config #1, interface 0)
> [  178.392415] usb 2-1.6.3: adding 2-1.6.3:1.1 (config #1, interface 1)
> [  178.392572] usb 2-1.6.3: adding 2-1.6.3:1.2 (config #1, interface 2)
> [  178.392737] usb 2-1.6.3: adding 2-1.6.3:1.3 (config #1, interface 3)
> [  178.392884] hub 2-1.6:1.0: state 7 ports 3 chg 0000 evt 0008
> [  178.419898] Bluetooth: Core ver 2.16
> [  178.419926] NET: Registered protocol family 31
> [  178.419929] Bluetooth: HCI device and connection manager initialized
> [  178.419941] Bluetooth: HCI socket layer initialized
> [  178.419948] Bluetooth: L2CAP socket layer initialized
> [  178.419960] Bluetooth: SCO socket layer initialized
> [  178.443257] btusb 2-1.6.3:1.0: usb_probe_interface
> [  178.443264] btusb 2-1.6.3:1.0: usb_probe_interface - got id
> [  178.443732] btusb 2-1.6.3:1.2: usb_probe_interface
> [  178.443738] btusb 2-1.6.3:1.2: usb_probe_interface - got id
> [  178.443758] btusb 2-1.6.3:1.3: usb_probe_interface
> [  178.443764] btusb 2-1.6.3:1.3: usb_probe_interface - got id
> [  178.443818] usbcore: registered new interface driver btusb
> [  178.444112] usb 2-1.6.3: link qh1-3008/ffff8800c22a1480 start 0 [1/2 us]
> [  179.502537] b43-phy0 debug: Chip initialized
> [  179.502877] b43-phy0 debug: 64-bit DMA initialized
> [  179.503316] b43-phy0 debug: QoS disabled
> [  179.512429] b43-phy0 debug: Wireless interface started
> [  179.516673] b43-phy0 debug: Adding Interface type 2
> [  179.517276] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
> [  180.500944] usb 2-1.6.3: unlink qh1-3008/ffff8800c22a1480 start 0 [1/2 us]
> [  180.503243] usb 2-1: clear tt buffer port 6, a7 ep2 t04048d80
> [  180.643972] wlan0: authenticate with 02:ac:54:e2:c8:8a
> [  180.653317] wlan0: send auth to 02:ac:54:e2:c8:8a (try 1/3)
> [  180.655728] wlan0: authenticated
> [  180.656961] wlan0: associate with 02:ac:54:e2:c8:8a (try 1/3)
> [  180.678067] wlan0: RX AssocResp from 02:ac:54:e2:c8:8a (capab=0x421 status=0 aid=2)
> [  180.679656] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
> [  180.679739] wlan0: associated
> [  247.984950] ehci-pci 0000:00:1d.0: reused qh ffff8800c22a1480 schedule
> [  247.984961] usb 2-1.6.3: link qh1-3008/ffff8800c22a1480 start 0 [1/2 us]
> [  262.708182] Bluetooth: RFCOMM TTY layer initialized
> [  262.708203] Bluetooth: RFCOMM socket layer initialized
> [  262.708206] Bluetooth: RFCOMM ver 1.11
=============================


Then I get this when I run the bluetoothctl command:
=============================
$ diff dmesg2.txt dmesg3.txt 
1252a1253,1255
> [  345.989911] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> [  345.989916] Bluetooth: BNEP filters: protocol multicast
> [  345.989928] Bluetooth: BNEP socket layer initialized
=============================

I'll try a later kernel when I get a minute to see if it makes any difference.
-- 
Regards,
Mick
Comment 17 Pacho Ramos gentoo-dev 2014-07-16 11:16:11 UTC
nothing strange for now. Also, try to simply test with it enabled always without touching the buttons in the laptop
Comment 18 MickKi 2014-07-16 15:00:40 UTC
I get the same if I have already enabled the adaptor and boot with it on.

Is there a reason that I have to run rfcomm bind manually, when previously udev would deal with it as long as the adaptor was enabled?

Does rfcomm fail to read /etc/bluetooth/rfcomm.conf?
-- 
Regards,
Mick
Comment 19 Pacho Ramos gentoo-dev 2014-07-16 15:23:46 UTC
What messages are shown when you reboot and run simply bluetoothd manually just after rebooting? What is its output?
Comment 20 MickKi 2014-07-16 16:36:00 UTC
Created attachment 380824 [details]
dmesg when booting with bt adaptor enabled.

When I enable the adaptor and reboot the PC I get this in the log:
=========================================
  kernel: usb 2-1.6.3: new full-speed USB device number 7 using ehci-pci
  kernel: usb 2-1.6.3: skipped 1 descriptor after interface
  kernel: usb 2-1.6.3: default language 0x0409
  kernel: usb 2-1.6.3: udev 7, busnum 2, minor = 134
  kernel: usb 2-1.6.3: New USB device found, idVendor=413c, idProduct=8156
  kernel: usb 2-1.6.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
  kernel: usb 2-1.6.3: Product: Dell Wireless 370 Bluetooth Mini-card
  kernel: usb 2-1.6.3: Manufacturer: Dell Computer Corp
  kernel: usb 2-1.6.3: usb_probe_device
  kernel: usb 2-1.6.3: configuration #1 chosen from 1 choice
  kernel: usb 2-1.6.3: adding 2-1.6.3:1.0 (config #1, interface 0)
  kernel: usb 2-1.6.3: adding 2-1.6.3:1.1 (config #1, interface 1)
  kernel: usb 2-1.6.3: adding 2-1.6.3:1.2 (config #1, interface 2)
  kernel: usb 2-1.6.3: adding 2-1.6.3:1.3 (config #1, interface 3)
  kernel: hub 2-1.6:1.0: state 7 ports 3 chg 0000 evt 0008
  kernel: Bluetooth: Core ver 2.16
  kernel: NET: Registered protocol family 31
  kernel: Bluetooth: HCI device and connection manager initialized
  kernel: Bluetooth: HCI socket layer initialized
  kernel: Bluetooth: L2CAP socket layer initialized
  kernel: Bluetooth: SCO socket layer initialized
  kernel: btusb 2-1.6.3:1.0: usb_probe_interface
  kernel: btusb 2-1.6.3:1.0: usb_probe_interface - got id
  kernel: btusb 2-1.6.3:1.2: usb_probe_interface
  kernel: btusb 2-1.6.3:1.2: usb_probe_interface - got id
  kernel: btusb 2-1.6.3:1.3: usb_probe_interface
  kernel: btusb 2-1.6.3:1.3: usb_probe_interface - got id
  kernel: usbcore: registered new interface driver btusb
  kernel: usb 2-1.6.3: link qh1-3008/ffff8801325a7b00 start 0 [1/2 us]
  kernel: cfg80211: World regulatory domain updated:
  kernel: cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
  kernel: cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
  kernel: cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
  kernel: cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
  kernel: cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
  kernel: cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
  kernel: usb 1-1.4: usb auto-suspend, wakeup 0
  kernel: hub 1-1:1.0: hub_suspend
  kernel: usb 1-1: unlink qh256-0001/ffff8801325a7e80 start 1 [1/0 us]
  kernel: usb 1-1: usb auto-suspend, wakeup 1
  kernel: hub 1-0:1.0: hub_suspend
  kernel: usb usb1: bus auto-suspend, wakeup 1
  kernel: ehci-pci 0000:00:1a.0: suspend root hub
  kernel: usb 2-1.6.3: unlink qh1-3008/ffff8801325a7b00 start 0 [1/2 us]
  kernel: usb 2-1: clear tt buffer port 6, a7 ep2 t04048d80
[snip ...]

  dbus[1383]: [system] Activating service name='org.bluez' (using servicehelper)
  dbus[1383]: [system] Activated service 'org.bluez' failed: Launch helper exited with unknown return code 1
  pulseaudio[3464]: [pulseaudio] bluez5-util.c: GetManagedObjects() failed: org.freedesktop.DBus.Error.Spawn.ChildExited: Launch helper exited with unknown return code 1
=========================================

Bluetooth doesn't start, rfcomm0 is not created and rfcomm & bnep modules are not loaded.

I attach separately the corresponding dmesg output (too long).

Then I started /usr/libexec/bluetooth/bluetoothd -n by hand.  The log showed:
=========================================
  bluetoothd[3573]: Bluetooth daemon 5.21
  bluetoothd[3573]: Starting SDP server
  kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
  kernel: Bluetooth: BNEP filters: protocol multicast
  kernel: Bluetooth: BNEP socket layer initialized
  bluetoothd[3573]: Bluetooth management interface 1.3 initialized
  bluetoothd[3573]: Sap driver initialization failed.
  bluetoothd[3573]: sap-server: Operation not permitted (1)
=========================================

and dmesg showed:
=========================================
> [  133.332508] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> [  133.332512] Bluetooth: BNEP filters: protocol multicast
> [  133.332525] Bluetooth: BNEP socket layer initialized
=========================================

I can then start bluetoothctl and get info from the mobile phone, but any attempts to connect fail:

[bluetooth]# connect 00:13:FD:8C:95:BA
Attempting to connect to 00:13:FD:8C:95:BA
Failed to connect: org.bluez.Error.Failed

and the log shows:

 bluetoothd[4612]: 00:13:FD:8C:95:BA: error updating services: Host is down (112)

Still no rfcomm device is created unless I do this manually.  If I leave bluetoothctl running I get:

[CHG] Device 00:13:FD:8C:95:BA RSSI: -60
[CHG] Device 00:13:FD:8C:95:BA RSSI: -68
[CHG] Device 00:13:FD:8C:95:BA RSSI: -60

on a regular basis, so some communication with the phone is taking place.
-- 
Regards,
Mick
Comment 21 Pacho Ramos gentoo-dev 2014-07-16 17:37:31 UTC
(In reply to MickKi from comment #20)
[...]
> Bluetooth doesn't start, rfcomm0 is not created and rfcomm & bnep modules
> are not loaded.
> 
> I attach separately the corresponding dmesg output (too long).
> 
> Then I started /usr/libexec/bluetooth/bluetoothd -n by hand.  The log showed:

Did you start it without manually loading the modules, right?
Comment 22 MickKi 2014-07-16 19:58:45 UTC
(In reply to Pacho Ramos from comment #21)
> (In reply to MickKi from comment #20)
> [...]
> > Bluetooth doesn't start, rfcomm0 is not created and rfcomm & bnep
> >  modules are not loaded.
> > 
> > I attach separately the corresponding dmesg output (too long).
> > 
> > Then I started /usr/libexec/bluetooth/bluetoothd -n by hand.  The log showed:
> 
> Did you start it without manually loading the modules, right?

Yes, this is right, I did not manually load any modules.  The btusb module you see in the logs and dmesg was loaded by udev, but nothing else was.  Then when I ran bluetoothd in a terminal the bnep module was loaded.  The rfcomm module was not loaded at all and I did not load it manually.
-- 
Regards,
Mick
Comment 23 Pacho Ramos gentoo-dev 2014-07-17 07:42:50 UTC
Then, try reporting this to upstream
https://bugzilla.kernel.org/enter_bug.cgi?product=Drivers (component Bluetooth)

Only some notes:
- Don't speak about you trying to run /etc/init.d scripts at all, upstream is using systemd and they won't be able to fix/test that
- hid2hci and rfcomm are not usually needed, then, simply explain them that you are running bluetoothd manually and it's not working properly. They will probably ask you dmesg output and bluetoothd one
- For testing that try to use latest kernel and bluez. I also think that udev is going to be updated soon and maybe would be interesting to give 215 a try (bug 517106)
Comment 24 Pacho Ramos gentoo-dev 2014-07-24 07:54:19 UTC
Please try if you still need any manual intervention with 5.21-r1
Comment 25 MickKi 2014-07-30 13:25:16 UTC
(In reply to Pacho Ramos from comment #24)
> Please try if you still need any manual intervention with 5.21-r1

Yes, there is no difference with version 5.21-r1.  :-(
-- 
Regards,
Mick
Comment 26 Pacho Ramos gentoo-dev 2014-08-02 08:56:16 UTC
Did you report the issue to upstream then? Otherwise I doubt it will be fixed in the near future :/
Comment 27 Pacho Ramos gentoo-dev 2014-09-13 12:28:25 UTC
(In reply to Pacho Ramos from comment #26)
> Did you report the issue to upstream then? Otherwise I doubt it will be
> fixed in the near future :/

Also try with 5.23 please
Comment 28 MickKi 2015-04-03 18:33:29 UTC
Time passed and eventually I had another go with net-wireless/bluez-5.29,  sys-fs/udev-216 and the 3.18.9-gentoo kernel.  There is now a udev rule for hid2hci which works.  There's a minor bug with it and an easy fix, as described in #544600.

What is not yet fixed is the /etc/init.d/bluetooth and /etc/init.d/rfcomm scripts, which appear to depend on each other and therefore each one fails to initiate the respective service, waiting on its dependency to start first.

The way I can now get it going is by:

1. Initialising the hci0 device using hciconfig (it used to be the case that this would be initialised by udev when I enabled the bluetooth hardware)

# hciconfig hci0 up

2. Starting bluetoothd on a terminal:

# start-stop-daemon --start --background --exec /usr/libexec/bluetooth/bluetoothd

3. Running bluetooth control in another terminal, followed by the commands:

  power on
  agent on
  scan on

I don't need to pair again the device after it has been paired once.

4. Then I need to bind rfcomm to the bluetooth device manually, because neither the rfcomm module will be loaded not the rfcomm dev started using the /etc/init.d/rfcomm script:

# rfcomm bind hci0 00:13:BD:8A:94:FD 1

after which I can at long last use my mobile phone as a modem, with ppp.

Is it possible to revisit the init.d scripts to make them work with BlueZ 5?

-- 
Regards,
Mick