FS#26667 - [bluez] script in rc.d prevents bluetooth connect at startup

Attached to Project: Arch Linux
Opened by Thomas Blank (Langley) - Friday, 28 October 2011, 15:32 GMT
Last edited by Andrea Scarpino (BaSh) - Tuesday, 20 December 2011, 08:46 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To No-one
Architecture All
Severity Very Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

I tried to make a bluetooth keyboard connect at startup. Therefore, after adding bluetooth to rc.conf's DAEMONS,
I enabled HIDD and added "--connect ##:##:##:##:##:##" to the HIDD_OPTIONS in /etc/conf.d/bluetooth, as indicated here: https://wiki.archlinux.org/index.php/Bluetooth_Keyboard

This doesn't work, because /etc/rc.d/bluetooth adds the option "--server" (see line 49) at all times, adding upt to the call
"/usr/bin/hidd --timeout 8 --master --server --connect ##:##:##:##:##:## --server" when starting hidd. But tests show, that connecting will not take place unless the --connect option is the last one (shown below.) So either this is an upstream bug and the bluez guys should should try to get their inputs parsed right, or the script needs an update, removing the --server option and ensuring in some other way that it is present in the final call. I can't reach anyone from bluez without subscribing to things, so I file a bug here.

Additional info:
Name : bluez
Version : 4.96-1

Steps to reproduce:
comment out line 13 in conf.d/bluetooth to disable HIDD for a second, then emulate the starting of bluetoothd and hidd as in the script, while typing wildly on the keyboard:

This works:
[root@machine]# /etc/rc.d/bluetooth stop; /etc/rc.d/bluetooth start; hidd --master --server --connect 78:CA:39:4F:73:59
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd [DONE]
:: Starting bluetooth subsystem: bluetoothd [DONE]


This doesn't, but this is how the script tries to do it:
[root@machine]# /etc/rc.d/bluetooth stop; /etc/rc.d/bluetooth start; hidd --master --connect 78:CA:39:4F:73:59 --server;
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd [DONE]
:: Starting bluetooth subsystem: bluetoothd [DONE]
"Can't get device information: No route to host"


This works, and is how the script might want to do it:
[root@machine]# /etc/rc.d/bluetooth stop; /etc/rc.d/bluetooth start; hidd --server --master --server --connect 78:CA:39:4F:73:59;
:: Stopping bluetooth subsystem: pand dund rfcomm hidd bluetoothd [DONE]
:: Starting bluetooth subsystem: bluetoothd [DONE]
For ten seconds the keyboard doesn't work. Works afterwards.
This task depends upon

Closed by  Andrea Scarpino (BaSh)
Tuesday, 20 December 2011, 08:46 GMT
Reason for closing:  Fixed
Additional comments about closing:  bluez 4.96-3

--server flag moved in the HIDD_OPTIONS
Comment by Thomas Blank (Langley) - Friday, 28 October 2011, 15:55 GMT
The smaller file is /etc/conf.d/bluetooth, the bigger one /etc/rc.d/bluetooth.

To mention it explicitly: This works for me now, by just altering line 49 in /etc/rc.d/bluetooth to $HIDD_EXEC --server $HIDD_OPTIONS instead of $HIDD_EXEC $HIDD_OPTIONS --server, may $HIDD_OPTIONS in /etc/conf.d/bluetooth contain an additional "--server" or not, as long as just the --connect" statement comes last. All I'm asking for is this to be updated in the repository package, as others might follow those instructions in the wiki, too.
Comment by Mathis (sitham) - Wednesday, 23 November 2011, 10:34 GMT
Confirm: I am having the same problems. Editing /etc/rc.d/bluetooth in the way described above indeed resolves the problem.
Bluez-version: 4.96-1
Output of /etc/rc.d/bluetooth restart of original version:
Nov 23 11:33:42 localhost bluetoothd[2462]: Stopping hci0 event socket
Nov 23 11:33:42 localhost bluetoothd[2462]: Stopping SDP server
Nov 23 11:33:42 localhost bluetoothd[2462]: Exit
Nov 23 11:33:43 localhost bluetoothd[2566]: Bluetooth daemon 4.96
Nov 23 11:33:43 localhost bluetoothd[2566]: Starting SDP server
Nov 23 11:33:43 localhost bluetoothd[2566]: Listening for HCI events on hci0
Nov 23 11:33:43 localhost bluetoothd[2566]: HCI dev 0 up
Nov 23 11:33:43 localhost bluetoothd[2566]: Adapter /org/bluez/2566/hci0 has been enabled
Nov 23 11:33:44 localhost hidd[2570]: Bluetooth HID daemon

Output of /etc/rc.d/bluetooth restart of the edited version:
Nov 23 11:31:34 localhost bluetoothd[2362]: Stopping hci0 event socket
Nov 23 11:31:34 localhost bluetoothd[2362]: Stopping SDP server
Nov 23 11:31:34 localhost bluetoothd[2362]: Exit
Nov 23 11:31:35 localhost bluetoothd[2462]: Bluetooth daemon 4.96
Nov 23 11:31:35 localhost bluetoothd[2462]: Starting SDP server
Nov 23 11:31:35 localhost bluetoothd[2462]: Listening for HCI events on hci0
Nov 23 11:31:35 localhost bluetoothd[2462]: HCI dev 0 up
Nov 23 11:31:35 localhost bluetoothd[2462]: Adapter /org/bluez/2462/hci0 has been enabled
Nov 23 11:31:39 localhost hidd: New HID device 7C:6D:62:40:79:1A (Apple Wireless Keyboard)
Nov 23 11:31:39 localhost kernel: [ 2136.721559] input: Apple Wireless Keyboard as /devices/pci0000:00/0000:00:06.0/usb4/4-1/4-1.1/4-1.1:1.0/bluetooth/hci0/hci0:12/input17
Nov 23 11:31:39 localhost kernel: [ 2136.721649] apple 0005:05AC:023A.000D: input,hidraw4: BLUETOOTH HID v0.44 Keyboard [Apple Wireless Keyboard] on 7C:6D:62:96:61:47

Loading...