Home | History | Annotate | Download | only in wingray
      1 import init.stingray.usb.rc
      2 
      3 on early-init
      4     mount debugfs debugfs /sys/kernel/debug
      5 
      6     # EXTERNAL_STORAGE and SECONDARY_STORAGE are needed for sqlite3 _DELETE_FILE trigger
      7     export EXTERNAL_STORAGE /storage/sdcard0
      8     export SECONDARY_STORAGE /storage/sdcard1
      9     mkdir /storage 0050 system sdcard_r
     10     mkdir /storage/sdcard0 0000 system system
     11     mkdir /storage/sdcard1 0000 system system
     12     # for backwards compatibility
     13     symlink /storage/sdcard0 /sdcard
     14     symlink /storage/sdcard0 /mnt/sdcard
     15     mkdir /pds 0777 system system
     16 
     17 on fs
     18     mount_all /fstab.stingray
     19     setprop ro.crypto.fuse_sdcard true
     20 
     21 on post-fs-data
     22     mkdir /data/misc/wifi 0770 wifi wifi
     23     mkdir /data/misc/wifi/sockets 0770 wifi wifi
     24     mkdir /data/misc/dhcp 0770 dhcp dhcp
     25     chown dhcp dhcp /data/misc/dhcp
     26 
     27     mkdir /data/tpapi 0771 system system
     28     mkdir /data/tpapi/etc 0771 system system
     29     mkdir /data/tpapi/etc/tpa 0771 system system
     30     mkdir /data/tpapi/etc/tpa/persistent 0771 system system
     31     chown system system /data/tpapi/etc/tpa/mmap_vars.dat
     32     chmod 0660 /data/tpapi/etc/tpa/mmap_vars.dat
     33     chown system system /data/tpapi/etc/tpa/keymgr.lock
     34     chmod 0660 /data/tpapi/etc/tpa/keymgr.lock
     35     chown system system /data/tpapi/etc/tpa/persistent/keymaptable.lock
     36     chmod 0660 /data/tpapi/etc/tpa/persistent/keymaptable.lock
     37     chown system system /data/tpapi/etc/tpa/persistent/keyring.lock
     38     chmod 0660 /data/tpapi/etc/tpa/persistent/keyring.lock
     39     chown system system /data/tpapi/etc/tpa/persistent/iprm.lock
     40     chmod 0660 /data/tpapi/etc/tpa/persistent/iprm.lock
     41 
     42     # cleanup obsolete symlink hack that may be lying around
     43     rm /data/misc/ril
     44 
     45     # we will remap this as /storage/sdcard0 with the sdcard fuse tool
     46     mkdir /data/media 0770 media_rw media_rw
     47     chown media_rw media_rw /data/media
     48 
     49     # GPS
     50     #Create location directory, BRCM guci library stores LTO file and read/write
     51     # config file.
     52     mkdir /data/location 0770 radio radio
     53 
     54     # Set indication (checked by vold) that we have finished this action
     55     setprop vold.post_fs_data_done 1
     56 
     57 on boot
     58 # bluetooth
     59     # power up/down interface
     60     chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
     61     chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
     62     chmod 0660                /sys/class/rfkill/rfkill0/state
     63 
     64     # UART device
     65     chown bluetooth bluetooth /dev/ttyHS2
     66     chmod 0660                /dev/ttyHS2
     67 
     68     # bluetooth MAC address programming
     69     chown bluetooth bluetooth /sys/module/board_stingray/parameters/bdaddr
     70     setprop ro.bt.bdaddr_path /sys/module/board_stingray/parameters/bdaddr
     71 
     72 # Sensor
     73     chown compass compass /dev/kxtf9
     74     chmod 660 /dev/kxtf9
     75     chown compass compass /dev/max9635
     76     chmod 660 /dev/max9635
     77     chown compass compass /dev/bmp085
     78     chmod 660 /dev/bmp085
     79     chown compass compass /dev/l3g4200d
     80     chmod 660 /dev/l3g4200d
     81     chown compass compass /dev/akm8975_dev
     82     chmod 660 /dev/akm8975_dev
     83     chown compass compass /dev/akm8975_aot
     84     chmod 660 /dev/akm8975_aot
     85 
     86 # light
     87     chown system system /sys/class/leds/notification-led/brightness
     88     chmod 660 /sys/class/leds/notification-led/brightness
     89     chown system system /sys/class/leds/notification-led/blink
     90     chmod 660 /sys/class/leds/notification-led/blink
     91 
     92     chmod 666 /dev/nvhost-ctrl
     93     chmod 666 /dev/nvhost-display
     94     chmod 666 /dev/nvhost-dsi
     95     chmod 666 /dev/nvhost-gr2d
     96     chmod 666 /dev/nvhost-gr3d
     97     chmod 666 /dev/nvhost-isp
     98     chmod 666 /dev/nvhost-mpe
     99     chmod 666 /dev/nvhost-vi
    100 
    101 # Camera
    102     chown media camera /sys/class/leds/privacy-led/brightness
    103     chown media camera /sys/class/leds/flash/brightness
    104     chown media camera /sys/class/leds/torch/brightness
    105     chmod 660 /sys/class/leds/privacy-led/brightness
    106     chmod 660 /sys/class/leds/flash/brightness
    107     chmod 660 /sys/class/leds/torch/brightness
    108 
    109 # UART Device
    110     chown radio radio /dev/ttyHS4
    111     chmod 640 /dev/ttyHS4
    112 
    113 # broadcom 4750 device
    114     chown radio radio /dev/gps_brcm4750
    115     chmod 660 /dev/gps_brcm4750
    116 
    117 # Whisper UART Device
    118     chown radio radio /dev/ttyHS0
    119     chmod 640 /dev/ttyHS0
    120 
    121 # Whisper audio settings
    122     chown media media /sys/class/switch/dock/dock_prop
    123     chmod 660 /sys/class/switch/dock/dock_prop
    124 
    125 # Modem Control CDMA
    126     chown radio radio /sys/class/radio/mdm6600/command
    127     chmod 220 /sys/class/radio/mdm6600/command
    128     chown radio radio /sys/bus/usb/devices/usb2/power/control
    129     chmod 660 /sys/bus/usb/devices/usb2/power/control
    130 
    131 # Modem Control LTE
    132     chown radio radio /sys/class/radio/wrigley/command
    133     chmod 220 /sys/class/radio/wrigley/command
    134     chown radio radio /sys/bus/usb/devices/usb1/power/control
    135     chmod 660 /sys/bus/usb/devices/usb1/power/control
    136 
    137 # Power Management Settings
    138     #write /sys/devices/platform/ohci.0/usb2/2-3/power/level auto
    139     write /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq 216000
    140     write /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq 1000000
    141     write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
    142     write /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq 216000
    143     write /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq 1000000
    144     write /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor interactive
    145     # timer 20ms, min sample 80ms, go max at 80%
    146     write /sys/devices/system/cpu/cpufreq/interactive/timer_rate 20000
    147     write /sys/devices/system/cpu/cpufreq/interactive/min_sample_time 80000
    148     write /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load 80
    149     # Wakelock debug
    150     write /sys/module/wakelock/parameters/debug_mask 7
    151     # No need to continuously scan w1 bus
    152     write /sys/devices/w1\ bus\ master/w1_master_search 1
    153     # Disable charging LED
    154     write /sys/class/gpio/gpio168/value 1
    155 
    156 # LTE specific TCP buffer setting for stingray
    157     # ReadMin, ReadInitial, ReadMax, WriteMin, WriteInitial, WriteMax,
    158     setprop net.tcp.buffersize.lte     524288,1048576,2097152,262144,524288,1048576
    159 
    160 # make binder state/stats readable by root only, so that they are not
    161 # captured by default in bugreports
    162     chmod 0400 /sys/kernel/debug/binder/stats
    163     chmod 0400 /sys/kernel/debug/binder/state
    164 
    165 # Ecompass daemon
    166 service akmd2 /system/bin/akmd2
    167     class late_start
    168     user compass
    169     group compass misc input
    170 
    171 service wpa_supplicant /system/bin/wpa_supplicant \
    172     -iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin
    173 #   we will start as root and wpa_supplicant will switch to user wifi
    174 #   after setting up the capabilities required for WEXT
    175 #   user wifi
    176 #   group wifi inet keystore
    177     class main
    178     socket wpa_wlan0 dgram 660 wifi wifi
    179     disabled
    180     oneshot
    181 
    182 service dhcpcd_wlan0 /system/bin/dhcpcd -aABKL
    183     class main
    184     disabled
    185     oneshot
    186 
    187 service dhcpcd_p2p /system/bin/dhcpcd -aABKL
    188     class main
    189     disabled
    190     oneshot
    191 
    192 service dhcpcd_eth0 /system/bin/dhcpcd -ABKL
    193     class main
    194     disabled
    195     oneshot
    196 
    197 # bluetooth
    198 service dhcpcd_bnep0 /system/bin/dhcpcd -ABKL
    199     disabled
    200     oneshot
    201 
    202 service iprenew_wlan0 /system/bin/dhcpcd -n
    203     disabled
    204     oneshot
    205 
    206 service iprenew_p2p /system/bin/dhcpcd -n
    207     disabled
    208     oneshot
    209 
    210 service iprenew_eth0 /system/bin/dhcpcd -n
    211     disabled
    212     oneshot
    213 
    214 # bluetooth
    215 service iprenew_bnep0 /system/bin/dhcpcd -n
    216     disabled
    217     oneshot
    218 
    219 # bugreport is triggered by the VOLUME-DOWN and VOLUME-UP keys.
    220 # bugtogo.sh tool will invoke bugreport and propt email composer
    221 # if not in user build.
    222 service bugreport /system/bin/bugmailer.sh -b /system/media/audio/ui/Dock.ogg -e /system/media/audio/ui/Undock.ogg
    223     class main
    224     disabled
    225     oneshot
    226     keycodes 115 114
    227 
    228 service hciattach /system/bin/brcm_patchram_plus --enable_hci --enable_lpm \
    229     --baudrate 3000000 --use_baudrate_for_download --scopcm 0,2,0,0,0,0,0,0,0,0 \
    230     --patchram /etc/firmware/bcm4329.hcd /dev/ttyHS2
    231     class main
    232     user bluetooth
    233     group bluetooth net_bt_admin
    234     disabled
    235 
    236 service location /system/bin/location
    237     class late_start
    238     socket gpshal_socket stream 660 radio system
    239     socket location_shim stream 660 system system
    240     socket gps_tcmd stream 660 radio system
    241     user radio
    242     group radio system mot_accy
    243     oneshot
    244 
    245 service locDrv /system/bin/brcm_guci_drv -config /system/etc/gpsconfig.xml
    246     class late_start
    247     user radio
    248     group radio inet sdcard_rw sdcard_r
    249 
    250 service tcmd /system/bin/tcmd
    251     class core
    252     socket local_tcmd stream 0660 root root
    253     socket batch_socket stream 0600 root root
    254     disabled
    255 
    256 service ftmipcd /system/bin/ftmipcd
    257     class core
    258     disabled
    259 
    260 # Immediately drops to user radio, after starting the real-time thread
    261 service whisper /system/bin/whisperd
    262     class late_start
    263     group radio system mot_accy
    264 
    265 # create virtual SD card at /storage/sdcard0, based on the /data/media directory
    266 # daemon will drop to user/group system/media_rw after initializing
    267 # underlying files in /data/media will be created with user and group media_rw (1023)
    268 service sdcard /system/bin/sdcard /data/media 1023 1023
    269     class late_start
    270 
    271 service motolocation /system/bin/sh /system/bin/am startservice -n com.motorola.android.locationproxy/com.motorola.android.locationproxy.LocationProxyService
    272     class late_start
    273     disabled
    274     oneshot
    275 
    276 on property:gsm.mot.locatonproxy=start
    277     start motolocation
    278 
    279 # Get BP version and save to misc
    280 service savebpver /system/bin/savebpver
    281    class main
    282    oneshot
    283    disabled
    284 
    285 on property:dev.bootcomplete=1
    286    start savebpver
    287 
    288 service gadget-lte-modem /system/bin/tty2ttyd ril.wrigley.modem.tty /dev/ttyGS0 0 512
    289     disabled
    290 
    291 service gadget-qbp-modem /system/bin/tty2ttyd persist.ril.modem.ttydevice /dev/ttyGS1 0 1024
    292     disabled
    293 
    294 service gadget-qbp-diag /system/bin/tty2ttyd persist.ril.diag.ttydevice /dev/ttyGS2 0 1024
    295     disabled
    296 
    297 service wrigley-diag /system/bin/wrigley-diag.sh
    298     oneshot
    299     disabled
    300 
    301 service logcatd-blan /system/bin/logcatd-blan
    302     user root
    303     # Immediately drops root, keeps CAP_SYS_ADMIN, and runs as below
    304     # user system
    305     # group system log inet
    306     disabled
    307 
    308 on property:ro.bootmode=factorycable
    309     start tcmd
    310     start ftmipcd
    311 
    312 on property:ro.bootmode=qbp-hw-bypass
    313     setprop ril.moto-qc.usb-hw-bypass.state "on"
    314 
    315 on property:ro.bootmode=bp-tools
    316     start tcmd
    317     start gadget-lte-modem
    318     start gadget-qbp-diag
    319     start gadget-qbp-modem
    320     start wrigley-diag
    321     start logcatd-blan
    322 
    323 service wlan_prod /system/bin/insmod /system/lib/modules/bcm4329.ko "firmware_path=/vendor/firmware/fw_bcm4329.bin nvram_path=/system/etc/wifi/bcm4329.cal"
    324     group wifi mot_tcmd system
    325     oneshot
    326     disabled
    327 
    328 service wlan_mfg /system/bin/insmod /system/lib/modules/bcm4329.ko "firmware_path=/vendor/firmware/fw_bcm4329_mfg.bin nvram_path=/system/etc/wifi/bcm4329.cal"
    329     group wifi mot_tcmd system
    330     oneshot
    331     disabled
    332 
    333 service wlan_unload /system/bin/rmmod bcm4329
    334     group wifi mot_tcmd system
    335     oneshot
    336     disabled
    337 
    338 # turn on wifi for tcmd load production firmware
    339 on property:tcmd.load_wlan="production"
    340     start wlan_prod
    341 
    342 # turn on wifi for tcmd load manufacturing firmware
    343 on property:tcmd.load_wlan="manufacturing"
    344     start wlan_mfg
    345 
    346 # turn off wifi for tcmd
    347 on property:tcmd.load_wlan="unload"
    348     start wlan_unload
    349