From 803cfe46830a8c1eb9570b5a3ec92abe22ed0e09 Mon Sep 17 00:00:00 2001 From: rickwu666666 <98441647+rickwu666666@users.noreply.github.com> Date: Fri, 12 Apr 2024 10:02:42 +0800 Subject: [PATCH] Make bluetooth_obex_send job able to run on both classic and core (BugFix) (#1172) Replace `l2ping` command with `hcitool inq` because l2ping is not a part of the bluez snap. --- providers/base/units/bluetooth/jobs.pxu | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/providers/base/units/bluetooth/jobs.pxu b/providers/base/units/bluetooth/jobs.pxu index 148e8bb04c..b553f59605 100644 --- a/providers/base/units/bluetooth/jobs.pxu +++ b/providers/base/units/bluetooth/jobs.pxu @@ -423,9 +423,10 @@ category_id: com.canonical.plainbox::bluetooth id: bluetooth/bluetooth_obex_send depends: bluetooth/detect-output estimated_duration: 10.0 +environ: BTDEVADDR PLAINBOX_PROVIDER_DATA requires: - package.name == 'bluez' - executable.name == 'obexftp' + package.name == 'bluez' or snap.name == 'bluez' + executable.name == 'obexftp' and executable.name == 'hcitool' device.category == 'BLUETOOTH' command: if [ -z "$BTDEVADDR" ] @@ -436,7 +437,7 @@ command: for bt in $(echo "${BTDEVADDR}" | cut -d = -f 2 | sed s/,/\\n/g) do echo "Host:[${bt}]" - if echo 'u' | sudo -S l2ping -c 5 -t 5 "${bt}" + if hcitool inq | grep -q "${bt}" then echo "Get available BTDEVADDR:[${bt}]" set -o pipefail