- #首先是创建了两个文件夹和bluetooth相关
- mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth
- mkdir /data/misc/bluetooth 0770 system system
- #新建了一个dbus的service,dbus是用于bluez和jni层交互的
- #细心的同学已经发了,他是没有disabled的,所以,会直接启动哦
- #不过dbus只是一个通路而已,我们暂时并不准备去详细地分析
- service dbus /system/bin/dbus-daemon --system --nofork
- class main
- socket dbus stream 660 bluetooth bluetooth
- user bluetooth
- group bluetooth net_bt_admin
- #新建了bluetoothd的service,这个就是bluez了
- service bluetoothd /system/bin/bluetoothd -n
- class main
- socket bluetooth stream 660 bluetooth bluetooth
- socket dbus_bluetooth stream 660 bluetooth bluetooth
- # init.rc does not yet support applying capabilities, so run as root and
- # let bluetoothd drop uid to bluetooth with the right linux capabilities
- group bluetooth net_bt_admin misc
- disabled
- #这里就是各个文件的权限配置了
- chmod 666 /dev/ttyS0
- chmod 666 /proc/bluetooth/sleep/proto
- chmod 666 /sys/class/rfkill/rfkill0/state
- chmod 666 /sys/class/rfkill/rfkill0/type
- chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
- chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
- #一个hciattach的service,hciattach是bluetooth的一个工具,这里可以用来启动蓝牙
- #涉及到一些vendor的信息后面就写成***了
- service hciattach /system/bin/logwrapper /system/bin/hciattach -n /dev/ttyS0 ***
- class main
- user bluetooth
- group bluetooth net_bt_admin
- disabled
- oneshot
init进程中和bt相关的部分
最新推荐文章于 2024-06-14 17:02:15 发布