SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I patched the slackbuild... hoping that the "Requires D-Bus-1.8.16" was more of a 'suggestion', as slackwares dbus is 1.6.12.
After hunting through the log I found the dbus errors, etc, and looked at the kernel source finding the trusted device changes there and in bluez. I don't have those other links anymore and can't seem to find them. Much of this was me looking through code and logfiles.
If somehow this does work, and reconnects after a reboot / restart of the bluetooth device.. please let me know. I had given up on using an updated bluez library on the newer laptop until dbus gets updated in -current.
I just tried upgrading dbus to 1.8 and libical to 1.0.1, and rebuilding dbus-python and dbus-glib (you don't need to rebuild glib), but you know what? Bluez 5 built just fine with dbus 1.6, it works fine AFAIK (there were no errors in dmesg or /var/log/messages), so I'm going to revert the dbus packages back to Slackware's until I actually get a problem.
Quote:
Originally Posted by WhiteWolf1776
so while a device will pair and work, it won't pair again automatically as other bits need upgraded as well for this to work..
Quote:
Originally Posted by WhiteWolf1776
The devices paired fine, but wouldn't reconnect as a trusted device should.
Which is it?
I'm not trying to be a jerk here; I'm trying to get a clear picture of what issues I should be prepared for.
My own tests with PhantomX's SlackBuilds have shown that my Dualshock 4 both stays paired, and reconnects as expected.
Ok, last bit and i'm sorta done saying the same thing...
Devices will pair..
You are likely to have to repeat the pairing process as the trusted device concept will not work without upgraded kernel, dbus, etc.
So, to put it as simply as I know how...
pair... works... then turn the device off... turn the device on... it won't hook back in without removing and redoing the pair.
Not sure where the disconnect is in those two statements you reference above...
Both of those quotes say "the device will pair" and both say "the device will not reconnect"... if english is a second language, get a better translator.
pair... works... then turn the device off... turn the device on... it won't hook back in without removing and redoing the pair.
I have tested this and very clearly found it to not be the case. 14.1 stock kernel, stock dbus, Bluez 5.28.
Maybe PhantomX's SlackBuilds have tweaked things correctly? He applies several patches, and one is a patch to adjust the dbus settings.
The following is bluetoothctl output from doing the following: starting bluetoothctl, holding down my Dualshock 4's PS button, telling my computer to disconnect it, holding down the PS button again, and then telling my computer to disconnect it again:
Code:
dugan@t23 ~> bluetoothctl
[NEW] Controller 00:1F:E2:E3:A4:07 %h-%d [default]
[NEW] Device 84:17:66:DB:AA:57 Wireless Controller
[CHG] Device 84:17:66:DB:AA:57 Connected: yes
[bluetooth]# disconnect 84:17:66:DB:AA:57
Attempting to disconnect from 84:17:66:DB:AA:57
Successful disconnected
[CHG] Device 84:17:66:DB:AA:57 Connected: no
[CHG] Device 84:17:66:DB:AA:57 Connected: yes
[bluetooth]# disconnect 84:17:66:DB:AA:57
Attempting to disconnect from 84:17:66:DB:AA:57
Successful disconnected
[CHG] Device 84:17:66:DB:AA:57 Connected: no
[bluetooth]#
The time between holding down the PS button and getting the connection was roughly one second, each time.
The following SlackBuild works for me. Slackware 14.1, stock dbus-1.6.12, custom 3.18.10-smp kernel.
I tested it as far as being able to pair and use my Dualshock 4 controller.
Disconnecting the device and reconnecting it (see post #21) works fine. I checked. Again. I'm actually starting to think that the reason WhiteWolf1776 got the behavior he reported was because he forgot to enter agent on and default-agent in bluetoothctl before trying to connect the device. That actually does need to be done each boot.
One weird thing is that I can't run hcitool lescan:
Code:
# hcitool lescan
Set scan parameters failed: Input/output error
In any case, this fits my personal standards for "usable":
Code:
#!/bin/sh
# Slackware build script for bluez - http://www.bluez.org
# Copyright 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
PKGNAM=bluez
VERSION=${VERSION:-$(echo $PKGNAM-*.tar.xz | rev | cut -f 3- -d . | cut -f 1 -d - | rev)}
BUILD=${BUILD:-1}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i486 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PKGNAM-$VERSION
tar xvf $CWD/${PKGNAM}-${VERSION}.tar.xz
cd $PKGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
sed -i -e 's|-lreadline|\0 -lncursesw|g' Makefile.{in,tools}
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--mandir=/usr/man \
--localstatedir=/var \
--enable-library \
--disable-systemd \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG || exit 1
# Compress and if needed symlink the man pages:
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
for manpagedir in $(find . -type d -name "man*") ; do
( cd $manpagedir
for eachpage in $( find . -type l -maxdepth 1) ; do
ln -s $( readlink $eachpage ).gz $eachpage.gz
rm $eachpage
done
gzip -9 *.?
)
done
)
fi
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cp -a \
AUTHORS COPYING* INSTALL NEWS README* \
$PKG/usr/doc/$PKGNAM-$VERSION
# If there's a ChangeLog, installing at least part of the recent history
# is useful, but don't let it get totally out of control:
if [ -r ChangeLog ]; then
DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
touch -r ChangeLog $DOCSDIR/ChangeLog
fi
cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
The following is a serious attempt at a usable Bluez 5 SlackBuild. Tests, feedback and (especially) recommendations are welcome.
On my T400, starting /etc/rc.d/rc.bluetooth for the first time prints out the following:
Code:
D-Bus setup failed: Name already in use
As far as I can tell, that's harmless, and everything works anyway.
As with all my SlackBuilds, you just run it. It will download the source. By the time you read this you might also want to adjust the VERSION. All supporting files (rc.bluetooth, slack-desc, doinst.sh, etc) are in heredocs in the SlackBuild itself.
Code:
#!/bin/sh
# Slackware build script for bluez - http://www.bluez.org
# Copyright 2009, 2010, 2011, 2012, 2013 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
set -e
PKGNAM=bluez
VERSION=${VERSION:-5.30}
BUILD=${BUILD:-1}
# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
i?86) export ARCH=i486 ;;
arm*) export ARCH=arm ;;
# Unless $ARCH is already set, use uname -m for all other archs:
*) export ARCH=$( uname -m ) ;;
esac
fi
if [ "$ARCH" = "i486" ]; then
SLKCFLAGS="-O2 -march=i486 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "s390" ]; then
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "x86_64" ]; then
SLKCFLAGS="-O2 -fPIC"
LIBDIRSUFFIX="64"
else
SLKCFLAGS="-O2"
LIBDIRSUFFIX=""
fi
CWD=$(pwd)
TMP=${TMP:-/tmp}
PKG=$TMP/package-$PKGNAM
rm -rf $TMP/$PKGNAM-$VERSION
cd $TMP
wget http://www.kernel.org/pub/linux/bluetooth/${PKGNAM}-${VERSION}.tar.xz
rm -rf $PKG
mkdir -p $TMP $PKG
cd $TMP
rm -rf $PKGNAM-$VERSION
tar xvf $TMP/${PKGNAM}-${VERSION}.tar.xz
cd $PKGNAM-$VERSION
chown -R root:root .
find . \
\( -perm 777 -o -perm 775 -o -perm 711 -o -perm 555 -o -perm 511 \) \
-exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \
-exec chmod 644 {} \;
sed -i -e 's|-lreadline|\0 -lncursesw|g' Makefile.{in,tools}
CFLAGS="$SLKCFLAGS" \
CXXFLAGS="$SLKCFLAGS" \
./configure \
--prefix=/usr \
--libdir=/usr/lib${LIBDIRSUFFIX} \
--sysconfdir=/etc \
--mandir=/usr/man \
--localstatedir=/var \
--enable-library \
--disable-systemd \
--build=$ARCH-slackware-linux
make
make install DESTDIR=$PKG || exit 1
# Add bluetoothd to /usr/sbin
mkdir -p $PKG/usr/sbin
(
cd $PKG/usr/sbin
ln -s ../libexec/bluetooth/bluetoothd
)
# Install the main configuration file.
mkdir -p $PKG/etc/bluetooth
install -m644 src/main.conf $PKG/etc/bluetooth/main.conf.new
# Add an init script
mkdir -p $PKG/etc/rc.d
cat << EOF > $PKG/etc/rc.d/rc.bluetooth.new
#!/bin/sh
########################################################################
# Begin bluetooth
#
# Description : BlueZ Boot Script
#
# Authors : Armin K. <krejzi@email.com>
#
# Version : BLFS SVN
#
# Notes : Rewritten May 29, 2014 for bluez-5 by
# Bruce Dubbs <bdubbs@linuxfromscratch.org>
#
########################################################################
### BEGIN INIT INFO
# Provides: bluetooth
# Required-Start: \$local_fs \$syslog dbus
# Required-Stop: \$local_fs \$syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts bluetooth daemons
# X-LFS-Provided-By: BLFS
### END INIT INFO
# A space delimied list of devices to start at boot time
ACTIVE_HCI_DEVICES_ON_BOOT="hci0"
# A semicolon delimited list of SDP (Service Discovery Protocol)
# operations for bluetooth devices. See the sdptool for more
# details.
SDPTOOL_OPTIONS=""
BLUETOOTH=/usr/sbin/bluetoothd
SDPTOOL=/usr/bin/sdptool
HCIATTACH=/usr/bin/hciattach
RFCOMM=/usr/bin/rfcomm
UART_CONF=/etc/bluetooth/uart.conf
RFCOMM_CONF=/etc/bluetooth/rfcomm.conf
start_hci_dev()
{
for dev in \${ACTIVE_HCI_DEVICES_ON_BOOT} ; do
hciconfig \$dev up > /dev/null 2>&1
done
}
run_sdptool()
{
# Declaring IFS local in this function, removes the need to
# save/restore it
local IFS option
test -x \$SDPTOOL || return 1
IFS=";"
for option in \${SDPTOOL_OPTIONS}; do
IFS=" "
\$SDPTOOL \$option > /dev/null 2>&1
done
}
start_uarts()
{
[ -x \$HCIATTACH ] && [ -f \$UART_CONF ] || return
grep -v '^[[:space:]]*(#|$)' \$UART_CONF | while read i; do
\$HCIATTACH \$i > /dev/null 2>&1
done
}
stop_uarts()
{
[ -x \$HCIATTACH ] || return
killall \$HCIATTACH > /dev/null 2>&1
}
start_rfcomm()
{
[ -x \$RFCOMM ] && [ -f \$RFCOMM_CONF ] || return
\$RFCOMM -f \$RFCOMM_CONF bind all > /dev/null 2>&1 || :
}
stop_rfcomm()
{
[ -x \$RFCOMM ] || return
\$RFCOMM unbind all > /dev/null 2>&1
}
case "\${1}" in
start)
echo Starting Bluetooth daemon bluetoothd...
# Start as background process and assume OK
\$BLUETOOTH &
start_hci_dev
run_sdptool
start_uarts
start_rfcomm
;;
stop)
stop_rfcomm
stop_uarts
echo Stopping Bluetooth daemon bluetoothd...
killall bluetoothd
;;
restart)
\${0} stop
sleep 1
\${0} start
;;
*)
echo "Usage: \${0} {start|stop|restart|status}"
exit 1
;;
esac
exit 0
# End bluetooth
EOF
# Compress and if needed symlink the man pages:
if [ -d $PKG/usr/man ]; then
( cd $PKG/usr/man
for manpagedir in $(find . -type d -name "man*") ; do
( cd $manpagedir
for eachpage in $( find . -type l -maxdepth 1) ; do
ln -s $( readlink $eachpage ).gz $eachpage.gz
rm $eachpage
done
gzip -9 *.?
)
done
)
fi
find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
mkdir -p $PKG/usr/doc/$PKGNAM-$VERSION
cp -a \
AUTHORS COPYING* INSTALL README* TODO \
$PKG/usr/doc/$PKGNAM-$VERSION
# If there's a ChangeLog, installing at least part of the recent history
# is useful, but don't let it get totally out of control:
if [ -r ChangeLog ]; then
DOCSDIR=$(echo $PKG/usr/doc/${PKGNAM}-$VERSION)
cat ChangeLog | head -n 1000 > $DOCSDIR/ChangeLog
touch -r ChangeLog $DOCSDIR/ChangeLog
fi
mkdir -p $PKG/install
cat << EOF > $PKG/install/doinst.sh
config() {
NEW="\$1"
OLD="\$(dirname \$NEW)/\$(basename \$NEW .new)"
# If there's no config file by that name, mv it over:
if [ ! -r \$OLD ]; then
mv \$NEW \$OLD
elif [ "\$(cat \$OLD | md5sum)" = "\$(cat \$NEW | md5sum)" ]; then # toss the redundant copy
rm \$NEW
fi
# Otherwise, we leave the .new copy for the admin to consider...
}
# Keep same perms on rc.bluetooth.new:
if [ -e etc/rc.d/rc.bluetooth ]; then
cp -a etc/rc.d/rc.bluetooth etc/rc.d/rc.bluetooth.new.incoming
cat etc/rc.d/rc.bluetooth.new > etc/rc.d/rc.bluetooth.new.incoming
mv etc/rc.d/rc.bluetooth.new.incoming etc/rc.d/rc.bluetooth.new
fi
config etc/rc.d/rc.bluetooth.new
config etc/bluetooth/main.conf.new
EOF
cat << EOF > $PKG/install/slack-desc
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description. Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in. You must
# make exactly 11 lines for the formatting to be correct. It's also
# customary to leave one space after the ':'.
|-----handy-ruler------------------------------------------------------|
bluez: bluez (Bluetooth libraries and utilities)
bluez:
bluez: Bluez is the Bluetooth stack for Linux, allowing Bluetooth adaptors
bluez: and devices to be used with Linux. This package contains the Bluez
bluez: libraries, utilities, and other support files.
bluez:
bluez: For more info, visit: http://www.bluez.org
bluez:
bluez:
bluez:
bluez:
EOF
cd $PKG
/sbin/makepkg -l y -c n $TMP/$PKGNAM-$VERSION-$ARCH-$BUILD.txz
It's about as good as it's going to be at this point. I've tested it by trying to connect a DualShock 4 and a Wii-U Pro Controller to my T400, and they both work really well. With the DualShock 4, all I had to do was pair it (it then connected), and with the Wii-U Pro controller the sequence was pair, then trust, then connect.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.