init进程中和bt相关的部分

  1. #首先是创建了两个文件夹和bluetooth相关  
  2.     mkdir /data/misc/bluetoothd 0770 bluetooth bluetooth  
  3. mkdir /data/misc/bluetooth 0770 system system  
  4. #新建了一个dbus的service,dbus是用于bluez和jni层交互的  
  5. #细心的同学已经发了,他是没有disabled的,所以,会直接启动哦  
  6. #不过dbus只是一个通路而已,我们暂时并不准备去详细地分析  
  7. service dbus /system/bin/dbus-daemon --system --nofork  
  8.     class main  
  9.     socket dbus stream 660 bluetooth bluetooth  
  10.     user bluetooth  
  11.     group bluetooth net_bt_admin  
  12. #新建了bluetoothd的service,这个就是bluez了  
  13. service bluetoothd /system/bin/bluetoothd -n  
  14.     class main  
  15.     socket bluetooth stream 660 bluetooth bluetooth  
  16.     socket dbus_bluetooth stream 660 bluetooth bluetooth  
  17.     # init.rc does not yet support applying capabilities, so run as root and  
  18.     # let bluetoothd drop uid to bluetooth with the right linux capabilities  
  19.     group bluetooth net_bt_admin misc  
  20.     disabled  
  21. #这里就是各个文件的权限配置了  
  22.     chmod 666 /dev/ttyS0  
  23.     chmod 666 /proc/bluetooth/sleep/proto  
  24.     chmod 666 /sys/class/rfkill/rfkill0/state  
  25.     chmod 666 /sys/class/rfkill/rfkill0/type  
  26.     chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state  
  27.     chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type  
  28. #一个hciattach的service,hciattach是bluetooth的一个工具,这里可以用来启动蓝牙  
  29. #涉及到一些vendor的信息后面就写成***了  
  30. service hciattach /system/bin/logwrapper /system/bin/hciattach -n /dev/ttyS0 ***  
  31.     class main  
  32.     user bluetooth  
  33.     group bluetooth net_bt_admin  
  34.     disabled  
  35.     oneshot 

你可能感兴趣的:(init进程中和bt相关的部分)