1 |
commit: 01275fe1564faa3c830bca4b0ea900fb44bafb0f |
2 |
Author: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Sep 29 10:58:47 2019 +0000 |
4 |
Commit: Pacho Ramos <pacho <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Sep 29 10:58:47 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=01275fe1 |
7 |
|
8 |
net-wireless/bluez: Version bump to 5.51 |
9 |
|
10 |
- Follow Fedora for installing few more needed extra-tools, AutoEnable |
11 |
bluetooth as soon as possible for keyboard/mouse devices. |
12 |
- Install example files for meshctl (#662110) |
13 |
- Fix QA issues (#694852) |
14 |
|
15 |
Closes: https://bugs.gentoo.org/662110 |
16 |
Bug: https://bugs.gentoo.org/683230 |
17 |
Closes: https://bugs.gentoo.org/694852 |
18 |
Closes: https://bugs.gentoo.org/695316 |
19 |
Package-Manager: Portage-2.3.76, Repoman-2.3.17 |
20 |
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org> |
21 |
|
22 |
net-wireless/bluez/Manifest | 1 + |
23 |
net-wireless/bluez/bluez-5.51.ebuild | 285 +++++++++++++++++++++++ |
24 |
net-wireless/bluez/files/69-btattach-bcm.rules | 33 +++ |
25 |
net-wireless/bluez/files/bluetooth-init.d-r4 | 2 +- |
26 |
net-wireless/bluez/files/btattach-bcm-service.sh | 30 +++ |
27 |
net-wireless/bluez/files/btattach-bcm_at.service | 6 + |
28 |
6 files changed, 356 insertions(+), 1 deletion(-) |
29 |
|
30 |
diff --git a/net-wireless/bluez/Manifest b/net-wireless/bluez/Manifest |
31 |
index 2de1b406112..042c13a4249 100644 |
32 |
--- a/net-wireless/bluez/Manifest |
33 |
+++ b/net-wireless/bluez/Manifest |
34 |
@@ -1,2 +1,3 @@ |
35 |
DIST bluez-5.50-fedora-backports.tar.xz 32232 BLAKE2B 35244036bbe18481e32bef2dcd4a223d44442ce28cee85a3a736bfbf5ee9d74372fa6366dc1102bf86babada608966a8c30b1c2537859a3741c289cabbc76026 SHA512 6d33e8bc67e50dc0d4cee3fa080402a51ddc8b6549f19b6c272de7dc51604eab23f909322f01aaca8a834abdc3cfd0bf24bb8623071af0cf0611d7427c9d8e9a |
36 |
DIST bluez-5.50.tar.xz 1755384 BLAKE2B d70763a80fa233cd31fbefc44f73ffceb54c2d7b64ee83df0d2dafb039771d2b18e69dd44b35b2cdf8eee97553c02deca2281f7ec54e958218cf6c4b364a8516 SHA512 64a680e4b3c270bc2439610c91ad2aef36131d84401e4bbdf6c2b7ec8708a19dfc942b31b9189c38a97ca072c761c669ae1aace5f4ff5d06de3ccbf33184be45 |
37 |
+DIST bluez-5.51.tar.xz 1941904 BLAKE2B e8580388961c99305c6f723160e726232a097067815a88a056c1569c55c2ea410004cf92572afbef9b782807d8a940503b4501f9c6046cacac35136fbbe580a8 SHA512 8b14eea98f541b981162abce728e0f917654ad3c990721ec398fe41bdd68069fe55ff64b61bc3c3b9f813facf42c995b07619f6d5d153965de27154b1a7b578f |
38 |
|
39 |
diff --git a/net-wireless/bluez/bluez-5.51.ebuild b/net-wireless/bluez/bluez-5.51.ebuild |
40 |
new file mode 100644 |
41 |
index 00000000000..b777edab5bc |
42 |
--- /dev/null |
43 |
+++ b/net-wireless/bluez/bluez-5.51.ebuild |
44 |
@@ -0,0 +1,285 @@ |
45 |
+# Copyright 1999-2019 Gentoo Authors |
46 |
+# Distributed under the terms of the GNU General Public License v2 |
47 |
+ |
48 |
+EAPI=7 |
49 |
+PYTHON_COMPAT=( python2_7 ) |
50 |
+ |
51 |
+inherit autotools python-single-r1 readme.gentoo-r1 systemd udev multilib-minimal |
52 |
+ |
53 |
+DESCRIPTION="Bluetooth Tools and System Daemons for Linux" |
54 |
+HOMEPAGE="http://www.bluez.org" |
55 |
+SRC_URI="mirror://kernel/linux/bluetooth/${P}.tar.xz" |
56 |
+ |
57 |
+LICENSE="GPL-2+ LGPL-2.1+" |
58 |
+SLOT="0/3" |
59 |
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~x86" |
60 |
+IUSE="btpclient cups doc debug deprecated extra-tools experimental +mesh midi +obex +readline selinux systemd test test-programs +udev user-session" |
61 |
+ |
62 |
+# Since this release all remaining extra-tools need readline support, but this could |
63 |
+# change in the future, hence, this REQUIRED_USE constraint could be dropped |
64 |
+# again in the future. |
65 |
+REQUIRED_USE=" |
66 |
+ extra-tools? ( deprecated readline ) |
67 |
+ test? ( ${PYTHON_REQUIRED_USE} ) |
68 |
+ test-programs? ( ${PYTHON_REQUIRED_USE} ) |
69 |
+" |
70 |
+ |
71 |
+TEST_DEPS="${PYTHON_DEPS} |
72 |
+ >=dev-python/dbus-python-1[${PYTHON_USEDEP}] |
73 |
+ dev-python/pygobject:3[${PYTHON_USEDEP}] |
74 |
+" |
75 |
+BDEPEND=" |
76 |
+ virtual/pkgconfig |
77 |
+ test? ( ${TEST_DEPS} ) |
78 |
+" |
79 |
+DEPEND=" |
80 |
+ >=dev-libs/glib-2.28:2[${MULTILIB_USEDEP}] |
81 |
+ >=sys-apps/hwids-20121202.2 |
82 |
+ btpclient? ( >=dev-libs/ell-0.14 ) |
83 |
+ cups? ( net-print/cups:= ) |
84 |
+ mesh? ( |
85 |
+ >=dev-libs/ell-0.14 |
86 |
+ dev-libs/json-c:= |
87 |
+ sys-libs/readline:0= |
88 |
+ ) |
89 |
+ midi? ( media-libs/alsa-lib ) |
90 |
+ obex? ( dev-libs/libical:= ) |
91 |
+ readline? ( sys-libs/readline:0= ) |
92 |
+ systemd? ( |
93 |
+ >=sys-apps/dbus-1.6:=[user-session=] |
94 |
+ sys-apps/systemd |
95 |
+ ) |
96 |
+ !systemd? ( >=sys-apps/dbus-1.6:= ) |
97 |
+ udev? ( >=virtual/udev-172 ) |
98 |
+" |
99 |
+RDEPEND="${DEPEND} |
100 |
+ selinux? ( sec-policy/selinux-bluetooth ) |
101 |
+ test-programs? ( ${TEST_DEPS} ) |
102 |
+" |
103 |
+ |
104 |
+RESTRICT="!test? ( test )" |
105 |
+ |
106 |
+PATCHES=( |
107 |
+ # Try both udevadm paths to cover udev/systemd vs. eudev locations (#539844) |
108 |
+ # http://www.spinics.net/lists/linux-bluetooth/msg58739.html |
109 |
+ # https://bugs.gentoo.org/539844 |
110 |
+ "${FILESDIR}"/${PN}-udevadm-path-r1.patch |
111 |
+ |
112 |
+ # build: Quote systemd variable names, bug #527432 |
113 |
+ # http://article.gmane.org/gmane.linux.bluez.kernel/67230 |
114 |
+ "${FILESDIR}"/${PN}-5.39-systemd-quote.patch |
115 |
+ |
116 |
+ # Fedora patches |
117 |
+ # http://www.spinics.net/lists/linux-bluetooth/msg40136.html |
118 |
+ "${FILESDIR}"/0001-obex-Use-GLib-helper-function-to-manipulate-paths.patch |
119 |
+) |
120 |
+ |
121 |
+pkg_setup() { |
122 |
+ if use test || use test-programs; then |
123 |
+ python-single-r1_pkg_setup |
124 |
+ fi |
125 |
+ |
126 |
+ if ! use udev; then |
127 |
+ ewarn |
128 |
+ ewarn "You are installing ${PN} with USE=-udev. This means various bluetooth" |
129 |
+ ewarn "devices and adapters from Apple, Dell, Logitech etc. will not work," |
130 |
+ ewarn "and hid2hci will not be available." |
131 |
+ ewarn |
132 |
+ fi |
133 |
+} |
134 |
+ |
135 |
+src_prepare() { |
136 |
+ default |
137 |
+ |
138 |
+ # http://www.spinics.net/lists/linux-bluetooth/msg38490.html |
139 |
+ if ! use user-session || ! use systemd; then |
140 |
+ eapply "${FILESDIR}"/0001-Allow-using-obexd-without-systemd-in-the-user-sessio.patch |
141 |
+ fi |
142 |
+ |
143 |
+ if use cups; then |
144 |
+ sed -i \ |
145 |
+ -e "s:cupsdir = \$(libdir)/cups:cupsdir = $(cups-config --serverbin):" \ |
146 |
+ Makefile.{in,tools} || die |
147 |
+ fi |
148 |
+ |
149 |
+ # Broken test https://bugzilla.kernel.org/show_bug.cgi?id=196621 |
150 |
+ # https://bugs.gentoo.org/618548 |
151 |
+ sed -i -e '/unit_tests += unit\/test-gatt\b/d' Makefile.am || die |
152 |
+ |
153 |
+ eautoreconf |
154 |
+ |
155 |
+ multilib_copy_sources |
156 |
+} |
157 |
+ |
158 |
+multilib_src_configure() { |
159 |
+ local myconf=( |
160 |
+ # readline is automagic when client is enabled |
161 |
+ # --enable-client always needs readline, bug #504038 |
162 |
+ # --enable-mesh is handled in the same way |
163 |
+ ac_cv_header_readline_readline_h=$(multilib_native_usex readline) |
164 |
+ ac_cv_header_readline_readline_h=$(multilib_native_usex mesh) |
165 |
+ ) |
166 |
+ |
167 |
+ if ! multilib_is_native_abi; then |
168 |
+ myconf+=( |
169 |
+ # deps not used for the library |
170 |
+ {DBUS,GLIB}_{CFLAGS,LIBS}=' ' |
171 |
+ ) |
172 |
+ fi |
173 |
+ |
174 |
+ econf \ |
175 |
+ --localstatedir=/var \ |
176 |
+ --disable-android \ |
177 |
+ --enable-datafiles \ |
178 |
+ --enable-optimization \ |
179 |
+ $(use_enable debug) \ |
180 |
+ --enable-pie \ |
181 |
+ --enable-threads \ |
182 |
+ --enable-library \ |
183 |
+ --enable-tools \ |
184 |
+ --enable-manpages \ |
185 |
+ --enable-monitor \ |
186 |
+ --with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \ |
187 |
+ --with-systemduserunitdir="$(systemd_get_userunitdir)" \ |
188 |
+ $(multilib_native_use_enable btpclient) \ |
189 |
+ $(multilib_native_use_enable btpclient external-ell) \ |
190 |
+ $(multilib_native_use_enable cups) \ |
191 |
+ $(multilib_native_use_enable deprecated) \ |
192 |
+ $(multilib_native_use_enable experimental) \ |
193 |
+ $(multilib_native_use_enable mesh) \ |
194 |
+ $(multilib_native_use_enable mesh external-ell) \ |
195 |
+ $(multilib_native_use_enable midi) \ |
196 |
+ $(multilib_native_use_enable obex) \ |
197 |
+ $(multilib_native_use_enable readline client) \ |
198 |
+ $(multilib_native_use_enable systemd) \ |
199 |
+ $(multilib_native_use_enable test-programs test) \ |
200 |
+ $(multilib_native_use_enable udev) \ |
201 |
+ $(multilib_native_use_enable udev sixaxis) |
202 |
+} |
203 |
+ |
204 |
+multilib_src_compile() { |
205 |
+ if multilib_is_native_abi; then |
206 |
+ default |
207 |
+ else |
208 |
+ emake -f Makefile -f - libs \ |
209 |
+ <<<'libs: $(lib_LTLIBRARIES)' |
210 |
+ fi |
211 |
+} |
212 |
+ |
213 |
+multilib_src_test() { |
214 |
+ multilib_is_native_abi && default |
215 |
+} |
216 |
+ |
217 |
+multilib_src_install() { |
218 |
+ if multilib_is_native_abi; then |
219 |
+ emake DESTDIR="${D}" install |
220 |
+ |
221 |
+ # Only install extra-tools when relevant USE flag is enabled |
222 |
+ if use extra-tools; then |
223 |
+ ewarn "Upstream doesn't support using this tools and their bugs are" |
224 |
+ ewarn "likely to be ignored forever, also that tools can break" |
225 |
+ ewarn "without previous announcement." |
226 |
+ ewarn "Upstream also states all this tools are not really needed," |
227 |
+ ewarn "then, if you still need to rely on them, you must ask them" |
228 |
+ ewarn "to either install that tool by default or add the needed" |
229 |
+ ewarn "functionality to the existing 'official' tools." |
230 |
+ ewarn "Please report this issues to:" |
231 |
+ ewarn "http://www.bluez.org/development/lists/" |
232 |
+ |
233 |
+ # Upstream doesn't install this, bug #524640 |
234 |
+ # http://permalink.gmane.org/gmane.linux.bluez.kernel/53115 |
235 |
+ # http://comments.gmane.org/gmane.linux.bluez.kernel/54564 |
236 |
+ dobin tools/btmgmt |
237 |
+ # gatttool is only built with readline, bug #530776 |
238 |
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1141909 |
239 |
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=720486 |
240 |
+ # https://bugs.archlinux.org/task/37686 |
241 |
+ dobin attrib/gatttool |
242 |
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1699680 |
243 |
+ dobin tools/avinfo |
244 |
+ fi |
245 |
+ |
246 |
+ # Not installed by default after being built, bug #666756 |
247 |
+ use btpclient && dobin tools/btpclient |
248 |
+ |
249 |
+ # Unittests are not that useful once installed, so make them optional |
250 |
+ if use test-programs; then |
251 |
+ # Few are needing python3, the others are python2 only. Remove |
252 |
+ # until we see how to pull in python2 and python3 for runtime |
253 |
+ rm "${ED}"/usr/$(get_libdir)/bluez/test/example-gatt-server || die |
254 |
+ rm "${ED}"/usr/$(get_libdir)/bluez/test/example-gatt-client || die |
255 |
+ rm "${ED}"/usr/$(get_libdir)/bluez/test/agent.py || die |
256 |
+ rm "${ED}"/usr/$(get_libdir)/bluez/test/test-mesh || die |
257 |
+ |
258 |
+ python_fix_shebang "${ED}"/usr/$(get_libdir)/bluez/test |
259 |
+ |
260 |
+ for i in $(find "${ED}"/usr/$(get_libdir)/bluez/test -maxdepth 1 -type f ! -name "*.*"); do |
261 |
+ dosym "${i}" /usr/bin/bluez-"${i##*/}" |
262 |
+ done |
263 |
+ fi |
264 |
+ else |
265 |
+ emake DESTDIR="${D}" \ |
266 |
+ install-includeHEADERS \ |
267 |
+ install-libLTLIBRARIES \ |
268 |
+ install-pkgconfigDATA |
269 |
+ fi |
270 |
+} |
271 |
+ |
272 |
+multilib_src_install_all() { |
273 |
+ # We need to ensure obexd can be spawned automatically by systemd |
274 |
+ # when user-session is enabled: |
275 |
+ # http://marc.info/?l=linux-bluetooth&m=148096094716386&w=2 |
276 |
+ # https://bugs.gentoo.org/show_bug.cgi?id=577842 |
277 |
+ # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=804908 |
278 |
+ # https://bugs.archlinux.org/task/45816 |
279 |
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1318441 |
280 |
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1389347 |
281 |
+ if use user-session && use systemd; then |
282 |
+ ln -s "${ED}"/usr/lib/systemd/user/obex.service "${ED}"/usr/lib/systemd/user/dbus-org.bluez.obex.service |
283 |
+ fi |
284 |
+ |
285 |
+ find "${D}" -name '*.la' -type f -delete || die |
286 |
+ |
287 |
+ keepdir /var/lib/bluetooth |
288 |
+ |
289 |
+ # Upstream don't want people to play with them |
290 |
+ # But we keep installing them due to 'historical' reasons |
291 |
+ insinto /etc/bluetooth |
292 |
+ local d |
293 |
+ for d in input network; do |
294 |
+ doins profiles/${d}/${d}.conf |
295 |
+ done |
296 |
+ # Setup auto enable as Fedora does for allowing to use |
297 |
+ # keyboards/mouse as soon as possible |
298 |
+ sed -i 's/#\[Policy\]$/\[Policy\]/; s/#AutoEnable=false/AutoEnable=true/' src/main.conf || die |
299 |
+ doins src/main.conf |
300 |
+ |
301 |
+ newinitd "${FILESDIR}"/bluetooth-init.d-r4 bluetooth |
302 |
+ |
303 |
+ einstalldocs |
304 |
+ use doc && dodoc doc/*.txt |
305 |
+ # Install .json files as examples to be used by meshctl |
306 |
+ if use mesh; then |
307 |
+ dodoc tools/mesh/*.json |
308 |
+ local DOC_CONTENTS="Some example .json files were installed into |
309 |
+ /usr/share/doc/${PF} to be used with meshctl. Feel free to |
310 |
+ uncompress and copy them to ~/.config/meshctl to use them." |
311 |
+ readme.gentoo_create_doc |
312 |
+ fi |
313 |
+ |
314 |
+ # From Fedora: |
315 |
+ # Scripts for automatically btattach-ing serial ports connected to Broadcom HCIs |
316 |
+ # as found on some Atom based x86 hardware |
317 |
+ udev_dorules "${FILESDIR}/69-btattach-bcm.rules" |
318 |
+ systemd_newunit "${FILESDIR}/btattach-bcm_at.service" "btattach-bcm@.service" |
319 |
+ exeinto /usr/libexec/bluetooth |
320 |
+ doexe "${FILESDIR}/btattach-bcm-service.sh" |
321 |
+} |
322 |
+ |
323 |
+pkg_postinst() { |
324 |
+ use udev && udev_reload |
325 |
+ systemd_reenable bluetooth.service |
326 |
+ |
327 |
+ has_version net-dialup/ppp || elog "To use dial up networking you must install net-dialup/ppp" |
328 |
+ use mesh && readme.gentoo_print_elog |
329 |
+} |
330 |
|
331 |
diff --git a/net-wireless/bluez/files/69-btattach-bcm.rules b/net-wireless/bluez/files/69-btattach-bcm.rules |
332 |
new file mode 100644 |
333 |
index 00000000000..dfe8d1e785c |
334 |
--- /dev/null |
335 |
+++ b/net-wireless/bluez/files/69-btattach-bcm.rules |
336 |
@@ -0,0 +1,33 @@ |
337 |
+# Some devices have a bluetooth HCI connected to an uart, these needs to be |
338 |
+# setup by calling btattach. The systemd btattach-bcm.service takes care of |
339 |
+# this. These udev rules hardware-activate that service when necessary. |
340 |
+# |
341 |
+# For now this only suports ACPI enumerated Broadcom BT HCIs. |
342 |
+# This has been tested on Bay and Cherry Trail devices with both ACPI and |
343 |
+# PCI enumerated UARTs. |
344 |
+ |
345 |
+# Note we check for the platform device not for the acpi device, because |
346 |
+# some DSDTs list multiple bluetooth adapters, but only some (or none) |
347 |
+# are enabled. Only enabled adapters get a platform device created. |
348 |
+ACTION!="add", GOTO="btattach_bcm_rules_end" |
349 |
+SUBSYSTEM!="platform", GOTO="btattach_bcm_rules_end" |
350 |
+ |
351 |
+KERNEL=="BCM2E1A:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
352 |
+KERNEL=="BCM2E39:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
353 |
+KERNEL=="BCM2E3A:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
354 |
+KERNEL=="BCM2E3D:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
355 |
+KERNEL=="BCM2E3F:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
356 |
+KERNEL=="BCM2E40:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
357 |
+KERNEL=="BCM2E54:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
358 |
+KERNEL=="BCM2E55:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
359 |
+KERNEL=="BCM2E64:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
360 |
+KERNEL=="BCM2E65:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
361 |
+KERNEL=="BCM2E67:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
362 |
+KERNEL=="BCM2E71:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
363 |
+KERNEL=="BCM2E7B:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
364 |
+KERNEL=="BCM2E7C:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
365 |
+KERNEL=="BCM2E7E:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
366 |
+KERNEL=="BCM2E95:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
367 |
+KERNEL=="BCM2E96:00", TAG+="systemd", ENV{SYSTEMD_WANTS}="btattach-bcm@%k.service" |
368 |
+ |
369 |
+LABEL="btattach_bcm_rules_end" |
370 |
|
371 |
diff --git a/net-wireless/bluez/files/bluetooth-init.d-r4 b/net-wireless/bluez/files/bluetooth-init.d-r4 |
372 |
old mode 100755 |
373 |
new mode 100644 |
374 |
index 97cf500008e..e69c66867fa |
375 |
--- a/net-wireless/bluez/files/bluetooth-init.d-r4 |
376 |
+++ b/net-wireless/bluez/files/bluetooth-init.d-r4 |
377 |
@@ -1,5 +1,5 @@ |
378 |
#!/sbin/openrc-run |
379 |
-# Copyright 1999-2017 Gentoo Foundation |
380 |
+# Copyright 1999-2019 Gentoo Authors |
381 |
# Distributed under the terms of the GNU General Public License v2 |
382 |
|
383 |
pidfile="/run/bluetoothd.pid" |
384 |
|
385 |
diff --git a/net-wireless/bluez/files/btattach-bcm-service.sh b/net-wireless/bluez/files/btattach-bcm-service.sh |
386 |
new file mode 100644 |
387 |
index 00000000000..c7f8b178467 |
388 |
--- /dev/null |
389 |
+++ b/net-wireless/bluez/files/btattach-bcm-service.sh |
390 |
@@ -0,0 +1,30 @@ |
391 |
+#!/bin/bash |
392 |
+ |
393 |
+# Simple shell script to wait for the tty for an uart using BT HCI to show up |
394 |
+# and then invoke btattach with the right parameters, this is intended to be |
395 |
+# invoked from a hardware-activated systemd service |
396 |
+# |
397 |
+# For now this only suports ACPI enumerated Broadcom BT HCIs. |
398 |
+# This has been tested on Bay and Cherry Trail devices with both ACPI and |
399 |
+# PCI enumerated UARTs. |
400 |
+# |
401 |
+# Note the kernel bt developers are working on solving this entirely in the |
402 |
+# kernel, so it is not worth the trouble to write something better then this. |
403 |
+ |
404 |
+BT_DEV="/sys/bus/platform/devices/$1" |
405 |
+BT_DEV="$(readlink -f $BT_DEV)" |
406 |
+UART_DEV="$(dirname $BT_DEV)" |
407 |
+ |
408 |
+# Stupid GPD-pocket has USB BT with id 0000:0000, but still claims to have |
409 |
+# an uart attached bt |
410 |
+if [ "$1" = "BCM2E7E:00" ] && lsusb | grep -q "ID 0000:0000"; then |
411 |
+ exit 0 |
412 |
+fi |
413 |
+ |
414 |
+while [ ! -d "$UART_DEV/tty" ]; do |
415 |
+ sleep .2 |
416 |
+done |
417 |
+ |
418 |
+TTY="$(ls $UART_DEV/tty)" |
419 |
+ |
420 |
+exec btattach --bredr "/dev/$TTY" -P bcm |
421 |
|
422 |
diff --git a/net-wireless/bluez/files/btattach-bcm_at.service b/net-wireless/bluez/files/btattach-bcm_at.service |
423 |
new file mode 100644 |
424 |
index 00000000000..1e7c7dbe582 |
425 |
--- /dev/null |
426 |
+++ b/net-wireless/bluez/files/btattach-bcm_at.service |
427 |
@@ -0,0 +1,6 @@ |
428 |
+[Unit] |
429 |
+Description=btattach for Broadcom devices |
430 |
+ |
431 |
+[Service] |
432 |
+Type=simple |
433 |
+ExecStart=/usr/libexec/bluetooth/btattach-bcm-service.sh %I |