Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f64ab6dd authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Update chromeos/examples

Test: try with initctl and dbus
Change-Id: Ic106e682676a88d0bc727b53a6767657af295a2d
parent 6c411745
Loading
Loading
Loading
Loading
+24 −10
Original line number Diff line number Diff line
<!-- This configuration file specifies the required security policies
     for Bluetooth Manager daemon to work. -->

<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
 "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>

<busconfig>
  <!-- ../system.conf have denied everything, so we just punch some holes -->

  <policy user="bluetooth">
  <policy user="root">
    <allow own="org.chromium.bluetooth"/>
    <allow own="org.chromium.bluetooth.Manager"/>

    <allow send_destination="org.chromium.bluetooth"/>
    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
    <allow send_interface="org.freedesktop.DBus.Properties"/>

    <allow send_destination="org.chromium.bluetooth.Manager"/>
    <allow send_interface="org.chromium.bluetooth.Manager"/>
  </policy>

  <!-- allow users of bluetooth group to communicate -->
  <policy group="bluetooth">
  <policy user="bluetooth">
    <allow own="org.chromium.bluetooth"/>
    <allow own="org.chromium.bluetooth.Manager"/>

    <allow send_destination="org.chromium.bluetooth"/>
    <allow send_interface="org.freedesktop.DBus.ObjectManager"/>
    <allow send_interface="org.freedesktop.DBus.Properties"/>

    <allow send_destination="org.chromium.bluetooth.Manager"/>
    <allow send_interface="org.chromium.bluetooth.Manager"/>
  </policy>

  <policy context="default">
    <allow send_destination="org.chromium.bluetooth.Manager"/>
  <policy user="chronos">
    <allow send_destination="org.chromium.bluetooth"/>
  </policy>

  <policy context="default">
    <deny send_destination="org.chromium.bluetooth"/>
    <deny send_destination="org.chromium.bluetooth.Manager"/>
  </policy>
</busconfig>
 No newline at end of file
+34 −0
Original line number Diff line number Diff line
description     "Start the bluetooth daemon"
author          "chromium-os-dev@chromium.org"

start on started system-services
stop on stopping system-services

limit memlock unlimited unlimited

env BLUETOOTH_LIBDIR=/var/lib/bluetooth
env BLUETOOTH_RUNDIR=/var/run/bluetooth
env BLUETOOTH_DAEMON_OPTION=""
env BLUETOOTH_WANT_FILE=/var/lib/misc/bluetooth-daemon.current

pre-start script
  mkdir -p -m 0750 ${BLUETOOTH_LIBDIR}
  chown -R bluetooth:bluetooth ${BLUETOOTH_LIBDIR}
  mkdir -p -m 0750 ${BLUETOOTH_RUNDIR}
  chown -R bluetooth:bluetooth ${BLUETOOTH_RUNDIR}

  # Make sure file exists before accessing it
  mkdir -p "$(dirname $BLUETOOTH_WANT_FILE)"
  touch "$BLUETOOTH_WANT_FILE"

  # Check if we want to start bluez. If "floss" is wanted instead, exit early
  # without starting bluez.
  want_daemon="$(cat $BLUETOOTH_WANT_FILE)"
  if [ "$want_daemon" = "floss" ]; then
    exit 1
  fi
end script

respawn

exec /usr/bin/start_bluetoothd.sh
 No newline at end of file
+9 −4
Original line number Diff line number Diff line
description "Bluetooth Adapter"
author "ChromeOS BT <chromeos-bt-team@google.com>"

start on started system-services
stop on stopping system-services
# Limit respawning in case of crashloop
respawn limit 10 5
respawn

import HCI
instance $HCI

post-stop script
  rm /var/run/bluetooth/bluetooth${HCI}.pid
end script

script
  exec /usr/bin/bluetoothd --hci=$HCI
  exec runuser -u bluetooth -- /usr/bin/btadapterd --hci=$HCI
end script
 No newline at end of file