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