init.rc: Add support for new USB accessory configurations
Also moved USB scripts to new file init.usb.rc Change-Id: I98e099fbd8de3eb3e1e18c9ef69312608033a50c Signed-off-by: Mike Lockwood <lockwood@google.com>
This commit is contained in:
parent
03e0cb3a38
commit
4f5d5176a3
|
@ -50,6 +50,8 @@ $(file) : $(LOCAL_PATH)/ueventd.rc | $(ACP)
|
|||
ALL_PREBUILT += $(file)
|
||||
$(INSTALLED_RAMDISK_TARGET): $(file)
|
||||
|
||||
# init.usb.rc is handled by build/target/product/core.rc
|
||||
|
||||
# Just like /system/etc/init.goldfish.sh, the /init.godlfish.rc is here
|
||||
# to allow -user builds to properly run the dex pre-optimization pass in
|
||||
# the emulator.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#
|
||||
|
||||
import /init.${ro.hardware}.rc
|
||||
import /init.usb.rc
|
||||
|
||||
on early-init
|
||||
# Set init and its forked children's oom_adj.
|
||||
|
@ -201,11 +202,6 @@ on post-fs-data
|
|||
# Set indication (checked by vold) that we have finished this action
|
||||
#setprop vold.post_fs_data_done 1
|
||||
|
||||
chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file
|
||||
chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file
|
||||
chown system system /sys/class/android_usb/android0/f_rndis/ethaddr
|
||||
chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr
|
||||
|
||||
on boot
|
||||
# basic network init
|
||||
ifup lo
|
||||
|
@ -311,49 +307,6 @@ on property:vold.decrypt=trigger_shutdown_framework
|
|||
class_reset late_start
|
||||
class_reset main
|
||||
|
||||
# Used to disable USB when switching states
|
||||
on property:sys.usb.config=none
|
||||
stop adbd
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/bDeviceClass 0
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
# adb only USB configuration
|
||||
# This should only be used during device bringup
|
||||
# and as a fallback if the USB manager fails to set a standard configuration
|
||||
on property:sys.usb.config=adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 18d1
|
||||
write /sys/class/android_usb/android0/idProduct D002
|
||||
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}
|
||||
|
||||
# USB accessory configuration
|
||||
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}
|
||||
|
||||
# USB accessory configuration, with adb
|
||||
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}
|
||||
|
||||
# Used to set USB configuration at boot and to switch the configuration
|
||||
# when changing the default configuration
|
||||
on property:persist.sys.usb.config=*
|
||||
setprop sys.usb.config ${persist.sys.usb.config}
|
||||
|
||||
## Daemon processes to be run by init.
|
||||
##
|
||||
service ueventd /sbin/ueventd
|
||||
|
|
|
@ -0,0 +1,91 @@
|
|||
# Copyright (C) 2012 The Android Open Source Project
|
||||
#
|
||||
# USB configuration common for all android devices
|
||||
#
|
||||
|
||||
on post-fs-data
|
||||
chown system system /sys/class/android_usb/android0/f_mass_storage/lun/file
|
||||
chmod 0660 /sys/class/android_usb/android0/f_mass_storage/lun/file
|
||||
chown system system /sys/class/android_usb/android0/f_rndis/ethaddr
|
||||
chmod 0660 /sys/class/android_usb/android0/f_rndis/ethaddr
|
||||
|
||||
# Used to disable USB when switching states
|
||||
on property:sys.usb.config=none
|
||||
stop adbd
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/bDeviceClass 0
|
||||
setprop sys.usb.state ${sys.usb.config}
|
||||
|
||||
# adb only USB configuration
|
||||
# This should only be used during device bringup
|
||||
# and as a fallback if the USB manager fails to set a standard configuration
|
||||
on property:sys.usb.config=adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 18d1
|
||||
write /sys/class/android_usb/android0/idProduct D002
|
||||
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}
|
||||
|
||||
# USB accessory configuration
|
||||
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}
|
||||
|
||||
# USB accessory configuration, with adb
|
||||
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}
|
||||
|
||||
# audio accessory configuration
|
||||
on property:sys.usb.config=audio_source
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 18d1
|
||||
write /sys/class/android_usb/android0/idProduct 2d02
|
||||
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}
|
||||
|
||||
# audio accessory configuration, with adb
|
||||
on property:sys.usb.config=audio_source,adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 18d1
|
||||
write /sys/class/android_usb/android0/idProduct 2d03
|
||||
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}
|
||||
|
||||
# USB and audio accessory configuration
|
||||
on property:sys.usb.config=accessory,audio_source
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 18d1
|
||||
write /sys/class/android_usb/android0/idProduct 2d04
|
||||
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}
|
||||
|
||||
# USB and audio accessory configuration, with adb
|
||||
on property:sys.usb.config=accessory,audio_source,adb
|
||||
write /sys/class/android_usb/android0/enable 0
|
||||
write /sys/class/android_usb/android0/idVendor 18d1
|
||||
write /sys/class/android_usb/android0/idProduct 2d05
|
||||
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}
|
||||
|
||||
# Used to set USB configuration at boot and to switch the configuration
|
||||
# when changing the default configuration
|
||||
on property:persist.sys.usb.config=*
|
||||
setprop sys.usb.config ${persist.sys.usb.config}
|
Loading…
Reference in New Issue