Skip to content

Commit aa1eea8

Browse files
committed
fix rpi4/400 bluetooth audio issue
1 parent 462e9ad commit aa1eea8

30 files changed

+1000
-10
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DIST bluez-5.24.tar.xz 1444536 RMD160 0990d531d5867d206683c32cc156cbd3a4cd202e SHA1 433c0e2bf7c8540140ad7d3dd03ad4d2e154f3b2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
josephsih@chromium.org
2+
mcchou@chromium.org
3+
yshavit@chromium.org
4+
alainm@chromium.org
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Copyright 1999-2012 Gentoo Foundation
2+
# Distributed under the terms of the GNU General Public License v2
3+
# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/bluez-4.99.ebuild,v 1.7 2012/04/15 16:53:41 maekke Exp $
4+
5+
EAPI="7"
6+
# To support choosing between current and next versions, two cros-workon
7+
# projects are declared. During emerge, both project sources are copied to
8+
# their respective destination directories, and one is chosen as the
9+
# "working directory" in src_unpack() below based on bluez-next USE flag.
10+
CROS_WORKON_COMMIT=("921ef02825a45004dfa855aaa8c0a93be75072f8" "921ef02825a45004dfa855aaa8c0a93be75072f8" "d9fdbedf0ee3a5981e2d83d85b547b7750303acb")
11+
CROS_WORKON_TREE=("45cff0a2baa2619c1d921745bd3b850024fc9e9b" "45cff0a2baa2619c1d921745bd3b850024fc9e9b" "8780bdd2acdf8969b5152dfee8a920bd78aa69bd")
12+
CROS_WORKON_LOCALNAME=("bluez/current" "bluez/next" "bluez/upstream")
13+
CROS_WORKON_PROJECT=("chromiumos/third_party/bluez" "chromiumos/third_party/bluez" "chromiumos/third_party/bluez")
14+
CROS_WORKON_OPTIONAL_CHECKOUT=(
15+
"use !bluez-next && use !bluez-upstream"
16+
"use bluez-next"
17+
"use bluez-upstream"
18+
)
19+
CROS_WORKON_DESTDIR=("${S}/bluez/current" "${S}/bluez/next" "${S}/bluez/upstream")
20+
CROS_WORKON_EGIT_BRANCH=("chromeos-5.54" "chromeos-5.54" "upstream/master")
21+
22+
inherit autotools multilib eutils systemd udev user libchrome cros-fuzzer cros-sanitizers cros-workon flag-o-matic
23+
24+
DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
25+
HOMEPAGE="http://www.bluez.org/"
26+
#SRC_URI not defined because we get our source locally
27+
28+
LICENSE="GPL-2 LGPL-2.1"
29+
KEYWORDS="*"
30+
IUSE="asan bluez-next bluez-upstream cups debug fuzzer hid2hci systemd readline bt_deprecated_tools"
31+
REQUIRED_USE="?? ( bluez-next bluez-upstream )"
32+
33+
CDEPEND="
34+
>=dev-libs/glib-2.14:2=
35+
app-arch/bzip2:=
36+
sys-apps/dbus:=
37+
virtual/libudev:=
38+
cups? ( net-print/cups:= )
39+
readline? ( sys-libs/readline:= )
40+
>=chromeos-base/metrics-0.0.1-r3152:=
41+
"
42+
DEPEND="${CDEPEND}"
43+
44+
RDEPEND="${CDEPEND}
45+
!net-wireless/bluez-hcidump
46+
!net-wireless/bluez-libs
47+
!net-wireless/bluez-test
48+
!net-wireless/bluez-utils
49+
"
50+
BDEPEND="${CDEPEND}
51+
dev-util/pkgconfig:=
52+
sys-devel/flex:=
53+
"
54+
55+
PATCHES=(
56+
"${FILESDIR}"/bluez-hid2hci.patch
57+
)
58+
59+
DOCS=( AUTHORS ChangeLog README )
60+
61+
src_unpack() {
62+
cros-workon_src_unpack
63+
64+
# Setting S has the effect of changing the temporary build directory
65+
# here onwards. Choose "bluez/next" or "bluez/current" subdir depending on
66+
# the USE flag.
67+
local checkout="bluez/$(usex bluez-next next $(usex bluez-upstream upstream current))"
68+
S+="/${checkout}"
69+
local version="$("${FILESDIR}"/chromeos-version.sh "${S}")"
70+
einfo "Using checkout ${checkout} (version ${version})"
71+
}
72+
73+
src_prepare() {
74+
default
75+
76+
eautoreconf
77+
78+
if use cups; then
79+
sed -i \
80+
-e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \
81+
Makefile.tools Makefile.in || die
82+
fi
83+
}
84+
85+
src_configure() {
86+
sanitizers-setup-env
87+
# Workaround a global-buffer-overflow warning in asan build.
88+
# See crbug.com/748216 for details.
89+
if use asan; then
90+
append-flags '-mllvm -asan-globals=0'
91+
fi
92+
93+
use readline || export ac_cv_header_readline_readline_h=no
94+
95+
export BASE_VER="$(libchrome_ver)"
96+
econf \
97+
--enable-tools \
98+
--localstatedir=/var \
99+
$(use_enable cups) \
100+
--enable-datafiles \
101+
$(use_enable debug) \
102+
--disable-test \
103+
--enable-library \
104+
--disable-systemd \
105+
--disable-obex \
106+
--enable-sixaxis \
107+
--disable-network \
108+
--disable-datafiles \
109+
$(use_enable fuzzer) \
110+
$(use_enable hid2hci) \
111+
$(use_enable bt_deprecated_tools deprecated)
112+
}
113+
114+
src_test() {
115+
# TODO(armansito): Run unit tests for non-x86 platforms.
116+
[[ "${ARCH}" == "x86" || "${ARCH}" == "amd64" ]] && \
117+
emake check VERBOSE=1
118+
}
119+
120+
src_install() {
121+
default
122+
123+
dobin tools/btmgmt tools/btgatt-client tools/btgatt-server
124+
125+
# Install scripts
126+
dobin "${FILESDIR}/dbus_send_blutooth_class.awk"
127+
dobin "${FILESDIR}/get_bluetooth_device_class.sh"
128+
dobin "${FILESDIR}/start_bluetoothd.sh"
129+
dobin "${FILESDIR}/start_bluetoothlog.sh"
130+
131+
# Install init scripts.
132+
if use systemd; then
133+
systemd_dounit "${FILESDIR}/bluetoothd.service"
134+
systemd_enable_service system-services.target bluetoothd.service
135+
systemd_dotmpfilesd "${FILESDIR}/bluetoothd-directories.conf"
136+
else
137+
insinto /etc/init
138+
newins "${FILESDIR}/${PN}-upstart.conf" bluetoothd.conf
139+
newins "${FILESDIR}/bluetoothlog-upstart.conf" bluetoothlog.conf
140+
fi
141+
142+
# Install D-Bus config
143+
insinto /etc/dbus-1/system.d
144+
doins "${FILESDIR}/org.bluez.conf"
145+
146+
# Install udev files
147+
udev_dorules "${FILESDIR}/99-uhid.rules"
148+
udev_dorules "${FILESDIR}/99-ps3-gamepad.rules"
149+
udev_dorules "${FILESDIR}/99-bluetooth-quirks.rules"
150+
151+
# Install the config files.
152+
insinto "/etc/bluetooth"
153+
doins "${FILESDIR}/main.conf"
154+
doins "${FILESDIR}/input.conf"
155+
156+
# Install the fuzzer binaries.
157+
fuzzer_install "${S}/fuzzer/OWNERS" fuzzer/bluez_pattern_match_fuzzer
158+
fuzzer_install "${S}/fuzzer/OWNERS" fuzzer/bluez_pattern_new_fuzzer
159+
160+
# We don't preserve /var/lib in images, so nuke anything we preseed.
161+
rm -rf "${D}"/var/lib/bluetooth
162+
163+
rm "${D}/lib/udev/rules.d/97-bluetooth.rules"
164+
165+
find "${D}" -name "*.la" -delete
166+
}
167+
168+
pkg_postinst() {
169+
enewuser "bluetooth" "218"
170+
enewgroup "bluetooth" "218"
171+
172+
udev_reload
173+
}
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Copyright 1999-2012 Gentoo Foundation
2+
# Distributed under the terms of the GNU General Public License v2
3+
# $Header: /var/cvsroot/gentoo-x86/net-wireless/bluez/bluez-4.99.ebuild,v 1.7 2012/04/15 16:53:41 maekke Exp $
4+
5+
EAPI="7"
6+
# To support choosing between current and next versions, two cros-workon
7+
# projects are declared. During emerge, both project sources are copied to
8+
# their respective destination directories, and one is chosen as the
9+
# "working directory" in src_unpack() below based on bluez-next USE flag.
10+
CROS_WORKON_LOCALNAME=("bluez/current" "bluez/next" "bluez/upstream")
11+
CROS_WORKON_PROJECT=("chromiumos/third_party/bluez" "chromiumos/third_party/bluez" "chromiumos/third_party/bluez")
12+
CROS_WORKON_OPTIONAL_CHECKOUT=(
13+
"use !bluez-next && use !bluez-upstream"
14+
"use bluez-next"
15+
"use bluez-upstream"
16+
)
17+
CROS_WORKON_DESTDIR=("${S}/bluez/current" "${S}/bluez/next" "${S}/bluez/upstream")
18+
CROS_WORKON_EGIT_BRANCH=("chromeos-5.54" "chromeos-5.54" "upstream/master")
19+
20+
inherit autotools multilib eutils systemd udev user libchrome cros-fuzzer cros-sanitizers cros-workon flag-o-matic
21+
22+
DESCRIPTION="Bluetooth Tools and System Daemons for Linux"
23+
HOMEPAGE="http://www.bluez.org/"
24+
#SRC_URI not defined because we get our source locally
25+
26+
LICENSE="GPL-2 LGPL-2.1"
27+
KEYWORDS="~*"
28+
IUSE="asan bluez-next bluez-upstream cups debug fuzzer hid2hci systemd readline bt_deprecated_tools"
29+
REQUIRED_USE="?? ( bluez-next bluez-upstream )"
30+
31+
CDEPEND="
32+
>=dev-libs/glib-2.14:2=
33+
app-arch/bzip2:=
34+
sys-apps/dbus:=
35+
virtual/libudev:=
36+
cups? ( net-print/cups:= )
37+
readline? ( sys-libs/readline:= )
38+
>=chromeos-base/metrics-0.0.1-r3152:=
39+
"
40+
DEPEND="${CDEPEND}"
41+
42+
RDEPEND="${CDEPEND}
43+
!net-wireless/bluez-hcidump
44+
!net-wireless/bluez-libs
45+
!net-wireless/bluez-test
46+
!net-wireless/bluez-utils
47+
"
48+
BDEPEND="${CDEPEND}
49+
dev-util/pkgconfig:=
50+
sys-devel/flex:=
51+
"
52+
53+
PATCHES=(
54+
"${FILESDIR}"/bluez-hid2hci.patch
55+
)
56+
57+
DOCS=( AUTHORS ChangeLog README )
58+
59+
src_unpack() {
60+
cros-workon_src_unpack
61+
62+
# Setting S has the effect of changing the temporary build directory
63+
# here onwards. Choose "bluez/next" or "bluez/current" subdir depending on
64+
# the USE flag.
65+
local checkout="bluez/$(usex bluez-next next $(usex bluez-upstream upstream current))"
66+
S+="/${checkout}"
67+
local version="$("${FILESDIR}"/chromeos-version.sh "${S}")"
68+
einfo "Using checkout ${checkout} (version ${version})"
69+
}
70+
71+
src_prepare() {
72+
default
73+
74+
eautoreconf
75+
76+
if use cups; then
77+
sed -i \
78+
-e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \
79+
Makefile.tools Makefile.in || die
80+
fi
81+
}
82+
83+
src_configure() {
84+
sanitizers-setup-env
85+
# Workaround a global-buffer-overflow warning in asan build.
86+
# See crbug.com/748216 for details.
87+
if use asan; then
88+
append-flags '-mllvm -asan-globals=0'
89+
fi
90+
91+
use readline || export ac_cv_header_readline_readline_h=no
92+
93+
export BASE_VER="$(libchrome_ver)"
94+
econf \
95+
--enable-tools \
96+
--localstatedir=/var \
97+
$(use_enable cups) \
98+
--enable-datafiles \
99+
$(use_enable debug) \
100+
--disable-test \
101+
--enable-library \
102+
--disable-systemd \
103+
--disable-obex \
104+
--enable-sixaxis \
105+
--disable-network \
106+
--disable-datafiles \
107+
$(use_enable fuzzer) \
108+
$(use_enable hid2hci) \
109+
$(use_enable bt_deprecated_tools deprecated)
110+
}
111+
112+
src_test() {
113+
# TODO(armansito): Run unit tests for non-x86 platforms.
114+
[[ "${ARCH}" == "x86" || "${ARCH}" == "amd64" ]] && \
115+
emake check VERBOSE=1
116+
}
117+
118+
src_install() {
119+
default
120+
121+
dobin tools/btmgmt tools/btgatt-client tools/btgatt-server
122+
123+
# Install scripts
124+
dobin "${FILESDIR}/dbus_send_blutooth_class.awk"
125+
dobin "${FILESDIR}/get_bluetooth_device_class.sh"
126+
dobin "${FILESDIR}/start_bluetoothd.sh"
127+
dobin "${FILESDIR}/start_bluetoothlog.sh"
128+
129+
# Install init scripts.
130+
if use systemd; then
131+
systemd_dounit "${FILESDIR}/bluetoothd.service"
132+
systemd_enable_service system-services.target bluetoothd.service
133+
systemd_dotmpfilesd "${FILESDIR}/bluetoothd-directories.conf"
134+
else
135+
insinto /etc/init
136+
newins "${FILESDIR}/${PN}-upstart.conf" bluetoothd.conf
137+
newins "${FILESDIR}/bluetoothlog-upstart.conf" bluetoothlog.conf
138+
fi
139+
140+
# Install D-Bus config
141+
insinto /etc/dbus-1/system.d
142+
doins "${FILESDIR}/org.bluez.conf"
143+
144+
# Install udev files
145+
udev_dorules "${FILESDIR}/99-uhid.rules"
146+
udev_dorules "${FILESDIR}/99-ps3-gamepad.rules"
147+
udev_dorules "${FILESDIR}/99-bluetooth-quirks.rules"
148+
149+
# Install the config files.
150+
insinto "/etc/bluetooth"
151+
doins "${FILESDIR}/main.conf"
152+
doins "${FILESDIR}/input.conf"
153+
154+
# Install the fuzzer binaries.
155+
fuzzer_install "${S}/fuzzer/OWNERS" fuzzer/bluez_pattern_match_fuzzer
156+
fuzzer_install "${S}/fuzzer/OWNERS" fuzzer/bluez_pattern_new_fuzzer
157+
158+
# We don't preserve /var/lib in images, so nuke anything we preseed.
159+
rm -rf "${D}"/var/lib/bluetooth
160+
161+
rm "${D}/lib/udev/rules.d/97-bluetooth.rules"
162+
163+
find "${D}" -name "*.la" -delete
164+
}
165+
166+
pkg_postinst() {
167+
enewuser "bluetooth" "218"
168+
enewgroup "bluetooth" "218"
169+
170+
udev_reload
171+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright 2016 The Chromium OS Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# The rules in this file are supposed to be applied after
6+
# 50-udev-default.rules in which all built-in rules are applied.
7+
8+
# Twist the INPUT properties by checking blutooth related properties.
9+
# If a bluetooth device advertises itself as a mouse, the properties
10+
# ID_INPUT_KEYBOARD and ID_INPUT_KEY must be set to empty. This helps
11+
# chrome OOBE to make correct decision for pairing bluetooth keyboard
12+
# and mouse.
13+
# Microsoft Sculpt Touch Mouse is an example. It is a pure mouse but
14+
# reports capabilities of both mouse events and keyboard events. This
15+
# makes OOBE to pair with it as keyboard and mouse which prevents
16+
# other actual bluetooth keyboard from being paired.
17+
SUBSYSTEM=="input", ACTION=="add|change", ENV{ID_INPUT}=="1", PROGRAM="/usr/bin/get_bluetooth_device_class.sh $attr{device/uniq}"
18+
RESULT=="mouse", ENV{ID_INPUT_KEYBOARD}=="1", ENV{ID_INPUT_KEYBOARD}=""
19+
RESULT=="mouse", ENV{ID_INPUT_KEY}=="1", ENV{ID_INPUT_KEY}=""
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2014 The Chromium OS Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
# Match the PS3 Controller RAW HID device when plugged in via USB,
6+
# place in the bluetooth group so bluetoothd can set pairing information.
7+
SUBSYSTEM=="hidraw", SUBSYSTEMS=="usb", ATTRS{idVendor}=="054c", ATTRS{idProduct}=="0268", GROUP="bluetooth", MODE="0660"
8+
9+
# Match the PS3 Controller RAW HID device when connected via Bluetooth,
10+
# place in the bluetooth group so bluetoothd can update pairing information
11+
# and stop the lights from flashing.
12+
SUBSYSTEM=="hidraw", SUBSYSTEMS=="hid", KERNELS=="*:054C:0268.*", GROUP="bluetooth", MODE="0660"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Make the /dev/uhid device only accessible by the Bluetooth daemon user
2+
# and the 'bluetooth' group for additional daemons (e.g. u2fd or WiFi Direct?)
3+
# providing HID transport.
4+
KERNEL=="uhid", OWNER="bluetooth", GROUP="bluetooth", MODE="0660"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright 2018 The Chromium OS Authors. All rights reserved.
2+
# Use of this source code is governed by a BSD-style license that can be
3+
# found in the LICENSE file.
4+
5+
d /var/lib/bluetooth 0750 bluetooth bluetooth -

0 commit comments

Comments
 (0)