[General Questions and Answers] giveen:
init.rk30board.rc

import init.rk30board.usb.rc

on early-init
# mkdir /mnt/sdcard 0000 system system
# for backwards compatibility

# for united data storage
mkdir /storage 0050 system sdcard_r
mkdir /storage/sdcard0 0000 system system

# this property is used for external_storage when not flash partition
export EXTERNAL_STORAGE_USE_DATA /storage/sdcard0
export EXTERNAL_STORAGE /mnt/sdcard
export SECOND_VOLUME_STORAGE /mnt/external_sd
mkdir /mnt/external_sd 0000 system system
export THIRD_VOLUME_STORAGE /mnt/usb_storage
mkdir /mnt/usb_storage 0000 system system

# bluetooth LPM
chmod 0220 /proc/bluetooth/sleep/lpm
chmod 0220 /proc/bluetooth/sleep/btwrite
chown bluetooth net_bt_stack /proc/bluetooth/sleep/lpm
chown bluetooth net_bt_stack /proc/bluetooth/sleep/btwrite

on fs
#mount vfat mtd@user /mnt/sdcard wait noatime nodiratime nosuid nodev uid=1000,gid=1015,fmask=0702,dmask=0702

# AP6476 GPS permission
chmod 755 /system/bin/glgps
chown root system /system/bin/glgps
chmod 644 /system/lib/hw/gps.default.so
chown root system /system/lib/hw/gps.default.so
mkdir /data/gps
chmod 771 /data/gps
chown root system /data/gps

on post-fs-data
# we will remap this as /mnt/sdcard with the sdcard fuse tool
mkdir /data/media 0770 media_rw media_rw
chown media_rw media_rw /data/media

on init
symlink /etc/bluez/bcm432x/BCM4329B1_TestOnly_0237_26MHz_SEMCO_B23.hcd /bcm4329_samsung.hcd
symlink /etc/bluez/bcm432x/BCM4329B1_USI_WM-BN-BM-01.hcd /bcm4329_usi.hcd
symlink /etc/bluez/bcm432x/BCM4329B1_002.002.023.0389.0000_Cybertan-Foxconn_Cls2_extLNA_EDRmaxInputLev+PeakDEVM_NT.hcd /bcm4329_cybertan.hcd
# for adobe reader mobile
export RK_ADOBE_DE_MOBILE 1
export EBOOK_PAGE_VISIBLE_NUMBER 2
export RK_ADEPT_DEVICE_TYPE mobile
export RK_ADOBE_DE_DOC_FOLDER "/mnt/sdcard/Digital Editions"
export RK_ADEPT_ACTIVATION_FILE /mnt/sdcard/.adobe-digital-editions/activation.xml
export RK_ADEPT_DEVICE_FILE /mnt/sdcard/.adobe-digital-editions/device.xml
export RK_ADEPT_DEVICE_SALT_FILE /mnt/sdcard/.adobe-digital-editions/devicesalt
export ADOBE_FONTS_DIR /system/fonts/adobefonts/

on boot
mount debugfs /sys/kernel/debug /sys/kernel/debug
chown system system /sys/devices/system/cpu/cpu1/online
chmod 0660 /sys/devices/system/cpu/cpu1/online
insmod /system/lib/modules/vpu_service.ko
insmod /system/lib/modules/rtk_btusb.ko

#backlight
chown system system /sys/class/backlight/rk28_bl/brightness

# permissions for bluetooth.
mkdir /data/misc/bluetoothd 0775 bluetooth bluetooth
setprop ro.bt.bdaddr_path "/data/misc/bluetoothd/bt_addr"
chown bluetooth bluetooth ro.bt.bdaddr_path

# for wifi
# mt7601u
chmod 0644 /system/lib/modules/mtprealloc7601Usta.ko

mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
mkdir /data/misc/wifi/sockets/tmp 0440 wifi wifi
mkdir /data/misc/dhcp 0770 dhcp dhcp
chown dhcp dhcp /data/misc/dhcp

mkdir /data/misc/wifi 0770 wifi wifi
chmod 0660 /data/misc/wifi/wpa_supplicant.conf
chmod 0660 /data/misc/wifi/p2p_supplicant.conf
mkdir /data/misc/wifi 0770 wifi wifi
mkdir /data/misc/wifi/sockets 0770 wifi wifi
chmod 777 /data/misc/wifi/sockets
mkdir /data/misc/wpa_supplicant 0770 wifi wifi
chown wifi wifi /data/misc/wifi

#for hdmi timem out
chown root system /sys/class/graphics/fb0/blank
chmod 0664 /sys/class/graphics/fb0/blank

# bluetooth power up/down interface
chmod 0660 /dev/ttyS0
chmod 0660 /dev/ttyS2
chmod 0660 /dev/vflash
chown bluetooth bluetooth /dev/vflash
chown bluetooth bluetooth /dev/ttyS2
chown bluetooth bluetooth /dev/ttyS0
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/type
chown bluetooth bluetooth /sys/class/rfkill/rfkill0/state
chmod 0664 /sys/class/rfkill/rfkill0/state

chown system system /sys/mali400_utility/utility
chmod 0664 /sys/mali400_utility/utility

chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed
chmod 0664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

chmod 0660 /dev/ttyS0
chown bluetooth system /dev/ttyS0
chmod 0660 /dev/bthwctl
chown bluetooth system /dev/bthwctl
mkdir /data/bluetooth 0771 bluetooth system

#for rda bt
chmod 0664 /dev/tcc_bt_dev
chown bluetooth bluetooth /dev/tcc_bt_dev

chmod 0664 /dev/voice_modem
chown bluetooth bluetooth /dev/voice_modem

# create virtual SD card at /mnt/sdcard, based on the /data/media directory
# daemon will drop to user/group system/media_rw after initializing
# underlying files in /data/media will be created with user and group media_rw (1023)
service sdcard /system/bin/sdcard /data/media /storage/sdcard0 1023 1023
class late_start
disabled

on property:ro.factory.storage_policy=1
symlink /storage/sdcard0 /mnt/sdcard
symlink /storage/sdcard0 /sdcard
mount rootfs rootfs / ro remount
start sdcard

on property:ro.factory.storage_policy=0
mkdir /mnt/sdcard 0000 system system
symlink /mnt/sdcard /sdcard
mount rootfs rootfs / ro remount
stop sdcard

service wpa_supplicant /system/bin/wpa_supplicant \
-Dnl80211 -iwlan0 -c/data/misc/wifi/wpa_supplicant.conf
#-Dnl80211 -iwlan0 -puse_p2p_group_interface=1 -e/data/misc/wifi/entropy.bin
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
service wfd /system/bin/wfd
class main
disabled
oneshot

#add for wifi direct (gwl)
service p2p_supplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \
-ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -puse_p2p_group_interface=1
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot

service rtl_supplicant /system/bin/rtl_supplicant \
-ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -N \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot

service hostapd /system/bin/hostapd /data/misc/wifi/hostapd.conf
class main
disabled
oneshot

# for realtek wifi
service hostapd_rtl /system/bin/hostapd_rtl /data/misc/wifi/hostapd.conf
class main
disabled
oneshot

# for mt5931 wifi
service mtk_psupplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -N \
-ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -puse_p2p_group_interface=1
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot

service mtk_wsupplicant /system/bin/wpa_supplicant \
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf -e/data/misc/wifi/entropy.bin
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot

service mtk_ap_daemon /system/bin/wpa_supplicant \
-iap0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf -e/data/misc/wifi/entropy.bin -puse_p2p_group_interface=1
# we will start as root and wpa_supplicant will switch to user wifi
# after setting up the capabilities required for WEXT
# user wifi
# group wifi inet keystore
class main
disabled
oneshot

service hciattach /system/bin/brcm_patchram_plus --patchram bychip --baudrate 1500000 --enable_lpm --enable_hci /dev/ttyS0
console
user bluetooth
group bluetooth net_bt_admin
disabled
oneshot

service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
class main
disabled
oneshot

service iprenew_wlan0 system/bin/dhcpcd -n
class main
disabled
oneshot

service dhcpcd_p2p /system/bin/dhcpcd -aABKL
class main
disabled
oneshot

service iprenew_p2p system/bin/dhcpcd -n
class main
disabled
oneshot
# bugreport is triggered by holding down volume down, volume up and power
service bugreport /system/bin/bugreport.sh
class main
disabled
oneshot
keycodes 114 115 116

service dhcpcd_eth0 /system/bin/dhcpcd -ABKL
class main
disabled
oneshot

service iprenew_eth0 system/bin/dhcpcd -n
class main
disabled
oneshot

service battery_charger /charger
class charger

service akmd /system/bin/akmd
class main
user system
group system
oneshot

on property:sys.gmali.performance=ui
start pat_ui

service pat_ui /system/bin/performance ui
disabled
oneshot

on property:sys.gmali.performance=video
start pat_video

#factory
on property:ro.factory.tool=1
write /sys/class/gsensor_class/orientation gsensor={-1,0,0,0,0,1,0,-1,0}
write /sys/devices/platform/rk29-keypad/rk29key {menu:MENU,home:HOME,vol+:VOLUP,vol-:VOLDOWN,play:PLAY,esc:ESC,sensor:CAMERA}
write /sys/devices/platform/rk29_backlight/rk29backlight 100

service pat_video /system/bin/performance video
disabled
oneshot

service gpsd /system/bin/glgps -c /system/etc/gpsconfig.xml
class main
disabled
user root
group system

service bplus_helper /system/bin/bplus_helper
class main
oneshot

on property:ro.rk.wifichip=mt7601u
insmod /system/lib/modules/mtprealloc7601Usta.ko

---------- Post added at 05:53 AM ---------- Previous post was at 05:52 AM ----------

init.rk30board.usb.rc

on init
# write /sys/class/android_usb/android0/iSerial ${ro.serialno}
# write /sys/class/android_usb/android0/f_rndis/manufacturer RockChip
# write /sys/class/android_usb/android0/f_rndis/vendorID 2207
# write /sys/class/android_usb/android0/f_rndis/wceis 1

on boot
write /sys/class/android_usb/android0/iSerial ${ro.serialno}
write /sys/class/android_usb/android0/f_rndis/manufacturer RockChip
write /sys/class/android_usb/android0/f_rndis/vendorID 2207
write /sys/class/android_usb/android0/f_rndis/wceis 1
write /sys/class/android_usb/android0/iManufacturer ${ro.product.manufacturer}
write /sys/class/android_usb/android0/iProduct ${ro.product.model}
write /sys/class/android_usb/android0/f_mass_storage/inquiry_string $ro.product.usbfactory

on property:sys.usb.config=adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0006
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mtp
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0001
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mtp,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0011
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=rndis
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0003
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/bDeviceClass 224
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=rndis,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0013
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/bDeviceClass 224
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=ptp
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0002
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=ptp,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0012
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mass_storage
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0000
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=mass_storage,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0010
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=accessory
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct 2D00
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=accessory,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 18D1
write /sys/class/android_usb/android0/idProduct 2D01
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=acm
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0005
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=acm,adb
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0005
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
start adbd
setprop sys.usb.state ${sys.usb.config}

on property:sys.usb.config=rndis,dm
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2207
write /sys/class/android_usb/android0/idProduct 0003
write /sys/class/android_usb/android0/functions ${sys.usb.config}
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}