Skip to content

Commit

Permalink
* Dont wrongly override udev events for usb and other devices
Browse files Browse the repository at this point in the history
* Setup usb mode switching listeners in init
* Seed default usb modes, although Ubuntu has the last say

Change-Id: I2c264fcc9861278a80771c836766fd22d2bc4e4e
  • Loading branch information
ricmm committed Feb 12, 2017
1 parent d37504d commit bd5054e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
5 changes: 3 additions & 2 deletions FP2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ PRODUCT_COPY_FILES += \
device/fairphone/FP2/media/media_codecs_8974.xml:system/etc/media_codecs.xml

PRODUCT_PROPERTY_OVERRIDES += \
ubuntu.widi.supported=1
ubuntu.widi.supported=1 \
sys.usb.config=mtp,adb

PRODUCT_PACKAGES += \
audiod \
Expand Down Expand Up @@ -142,7 +143,7 @@ PRODUCT_COPY_FILES += \
# Enable strict operation
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
persist.sys.strict_op_enable=false \
persist.sys.usb.config=mtp
persist.sys.usb.config=mtp,adb

PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
camera2.portability.force_api=1
Expand Down
20 changes: 20 additions & 0 deletions rootdir/root/init.target.rc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
#
#

# usb mode change listeners
on property:sys.usb.config=mtp
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/idVendor 2AE5
write /sys/class/android_usb/android0/idProduct F003
write /sys/class/android_usb/android0/functions mtp
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 2AE5
write /sys/class/android_usb/android0/idProduct 9039
write /sys/class/android_usb/android0/functions mtp,adb
write /sys/class/android_usb/android0/enable 1
setprop sys.usb.state ${sys.usb.config}

on early-init
mkdir /firmware 0771 system system
symlink /data/tombstones /tombstones
Expand All @@ -36,6 +53,9 @@ on init
# 0 indicates that virtual display is not a Wifi display and that the
# session is not exercised through RemoteDisplay in the android framework
setprop persist.sys.wfd.virtual 0
# in ubuntu, default to mtp,adb mode for usb
setprop persist.sys.usb.config mtp,adb
setprop sys.usb.config mtp,adb

on post-fs-data
mkdir /data/tombstones 0771 system system
Expand Down
4 changes: 0 additions & 4 deletions ubuntu/70-FP2.rules
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ ACTION=="add", KERNEL=="tty", OWNER="root", GROUP="root", MODE="0666"
ACTION=="add", KERNEL=="random", OWNER="root", GROUP="root", MODE="0666"
ACTION=="add", KERNEL=="urandom", OWNER="root", GROUP="root", MODE="0666"
ACTION=="add", KERNEL=="hw_random", OWNER="root", GROUP="system", MODE="0440"
ACTION=="add", KERNEL=="ashmem", OWNER="root", GROUP="root", MODE="0666"
ACTION=="add", KERNEL=="binder", OWNER="root", GROUP="root", MODE="0666"
ACTION=="add", KERNEL=="log/*", OWNER="root", GROUP="log", MODE="0666"
ACTION=="add", KERNEL=="msm_hw3dc", OWNER="root", GROUP="root", MODE="0666"
Expand All @@ -144,9 +143,7 @@ ACTION=="add", KERNEL=="diag_arm9", OWNER="radio", GROUP="radio", MODE="0660"
ACTION=="add", KERNEL=="android_adb", OWNER="adb", GROUP="adb", MODE="0660"
ACTION=="add", KERNEL=="android_adb_enable", OWNER="adb", GROUP="adb", MODE="0660"
ACTION=="add", KERNEL=="ttyMSM0", OWNER="bluetooth", GROUP="bluetooth", MODE="0600"
ACTION=="add", KERNEL=="uhid", OWNER="system", GROUP="net_bt_stack", MODE="0660"
ACTION=="add", KERNEL=="uinput", OWNER="system", GROUP="net_bt_stack", MODE="0660"
ACTION=="add", KERNEL=="alarm", OWNER="system", GROUP="radio", MODE="0664"
ACTION=="add", KERNEL=="tty0", OWNER="root", GROUP="system", MODE="0660"
ACTION=="add", KERNEL=="graphics/*", OWNER="system", GROUP="graphics", MODE="0660"
ACTION=="add", KERNEL=="msm_hw3dm", OWNER="system", GROUP="graphics", MODE="0660"
Expand Down Expand Up @@ -189,7 +186,6 @@ ACTION=="add", KERNEL=="qmi0", OWNER="radio", GROUP="radio", MODE="0640"
ACTION=="add", KERNEL=="qmi1", OWNER="radio", GROUP="radio", MODE="0640"
ACTION=="add", KERNEL=="qmi2", OWNER="radio", GROUP="radio", MODE="0640"
ACTION=="add", KERNEL=="bus/usb/*", OWNER="root", GROUP="usb", MODE="0660"
ACTION=="add", KERNEL=="mtp_usb", OWNER="root", GROUP="mtp", MODE="0660"
ACTION=="add", KERNEL=="usb_accessory", OWNER="root", GROUP="usb", MODE="0660"
ACTION=="add", KERNEL=="tun", OWNER="system", GROUP="vpn", MODE="0660"
ACTION=="add", KERNEL=="ts0710mux*", OWNER="radio", GROUP="radio", MODE="0640"
Expand Down

0 comments on commit bd5054e

Please sign in to comment.