1.AndroidR上wakeup_source和之前变化比较大,增加了wakeup class.
/sys/class/wakeup # ls wakeup0 wakeup105 wakeup112 wakeup12 wakeup127 wakeup135 wakeup16 wakeup3 wakeup38 wakeup47 wakeup54 wakeup61 wakeup69 wakeup76 wakeup83 wakeup90 wakeup98 ...... /sys/class/wakeup # ls -l total 0 lrwxrwxrwx 1 root root 0 2020-08-28 20:04 wakeup0 -> ../../devices/platform/soc/.../c440000.qcom,spmi:qcom,pm8150@0:qcom,power-on@800/wakeup/wakeup0 lrwxrwxrwx 1 root root 0 2020-08-28 20:04 wakeup1 -> ../../devices/platform/soc/.../c440000.qcom,spmi:qcom,pm8150b@2:qcom,power-on@800/wakeup/wakeup1
2.软链接创建过程
wakeup_source_register() //drivers\base\power\wakeup.c wakeup_source_sysfs_add() //drivers\base\power\wakeup_stats.c wakeup_source_device_create() //drivers\base\power\wakeup_stats.c dev->class = wakeup_class; //device_add()中就会链接到/sys/class/wakeup下 dev->groups = wakeup_source_groups; //这个就是那wakeup100下的文件 retval = kobject_set_name(&dev->kobj, "wakeup%d", ws->id); device_add(dev); //drivers\base\core.c device_add_class_symlinks(dev); //drivers\base\core.c sysfs_create_link(&dev->class->p->subsys.kobj, &dev->kobj, dev_name(dev)); //drivers\base\core.c wakeupX链接到子系统的目录下
3.数量上不一致?
/sys/devices/virtual/wakeup # ls /sys/class/wakeup/ wakeup0 wakeup106 wakeup114 wakeup122 wakeup130 wakeup139 wakeup23 wakeup35 wakeup45 wakeup54 wakeup62 wakeup70 wakeup79 wakeup87 wakeup95 wakeup1 wakeup107 wakeup115 wakeup123 wakeup131 wakeup140 wakeup25 wakeup36 wakeup47 wakeup55 wakeup63 wakeup71 wakeup8 wakeup88 wakeup96 wakeup10 wakeup108 wakeup116 wakeup124 wakeup132 wakeup141 wakeup27 wakeup37 wakeup48 wakeup56 wakeup64 wakeup72 wakeup80 wakeup89 wakeup97 wakeup100 wakeup109 wakeup117 wakeup125 wakeup133 wakeup142 wakeup29 wakeup39 wakeup49 wakeup57 wakeup65 wakeup73 wakeup81 wakeup9 wakeup98 wakeup101 wakeup11 wakeup118 wakeup126 wakeup134 wakeup15 wakeup3 wakeup4 wakeup5 wakeup58 wakeup66 wakeup74 wakeup82 wakeup90 wakeup99 wakeup102 wakeup110 wakeup119 wakeup127 wakeup135 wakeup17 wakeup31 wakeup40 wakeup50 wakeup59 wakeup67 wakeup75 wakeup83 wakeup91 wakeup103 wakeup111 wakeup12 wakeup128 wakeup136 wakeup19 wakeup32 wakeup41 wakeup51 wakeup6 wakeup68 wakeup76 wakeup84 wakeup92 wakeup104 wakeup112 wakeup120 wakeup129 wakeup137 wakeup2 wakeup33 wakeup42 wakeup52 wakeup60 wakeup69 wakeup77 wakeup85 wakeup93 wakeup105 wakeup113 wakeup121 wakeup13 wakeup138 wakeup21 wakeup34 wakeup44 wakeup53 wakeup61 wakeup7 wakeup78 wakeup86 wakeup94 /sys/devices/virtual/wakeup # /sys/devices/virtual/wakeup # ls wakeup100 wakeup105 wakeup110 wakeup115 wakeup120 wakeup125 wakeup130 wakeup135 wakeup140 wakeup47 wakeup62 wakeup81 wakeup90 wakeup96 wakeup101 wakeup106 wakeup111 wakeup116 wakeup121 wakeup126 wakeup131 wakeup136 wakeup141 wakeup54 wakeup77 wakeup82 wakeup91 wakeup97 wakeup102 wakeup107 wakeup112 wakeup117 wakeup122 wakeup127 wakeup132 wakeup137 wakeup142 wakeup59 wakeup78 wakeup83 wakeup93 wakeup98 wakeup103 wakeup108 wakeup113 wakeup118 wakeup123 wakeup128 wakeup133 wakeup138 wakeup4 wakeup6 wakeup79 wakeup84 wakeup94 wakeup99 wakeup104 wakeup109 wakeup114 wakeup119 wakeup124 wakeup129 wakeup134 wakeup139 wakeup41 wakeup60 wakeup80 wakeup88 wakeup95 OP4AD9:/sys/devices/virtual/wakeup #
4.权限不一致
OP4AD9:/sys/devices/virtual/wakeup # ls -laZ total 0 drwxr-xr-x 71 root root u:object_r:sysfs_wakeup:s0 0 2020-01-01 00:03 . drwxr-xr-x 58 root root u:object_r:sysfs:s0 0 1970-01-01 08:00 .. drwxr-xr-x 2 root root u:object_r:sysfs_wakeup:s0 0 2020-01-01 00:03 wakeup100 drwxr-xr-x 2 root root u:object_r:sysfs_wakeup:s0 0 2020-01-01 00:03 wakeup101 drwxr-xr-x 2 root root u:object_r:sysfs_wakeup:s0 0 2020-01-01 00:03 wakeup102 ...... P4AD9:/sys/devices/virtual/wakeup # ls /sys/class/wakeup/ -laZ total 0 drwxr-xr-x 2 root root u:object_r:sysfs_wakeup:s0 0 1970-01-01 08:00 . drwxr-xr-x 113 root root u:object_r:sysfs:s0 0 1970-01-01 08:00 .. lrwxrwxrwx 1 root root u:object_r:sysfs:s0 0 2020-01-01 00:03 wakeup100 -> ../../devices/virtual/wakeup/wakeup100 lrwxrwxrwx 1 root root u:object_r:sysfs:s0 0 2020-01-01 00:03 wakeup101 -> ../../devices/virtual/wakeup/wakeup101 lrwxrwxrwx 1 root root u:object_r:sysfs:s0 0 2020-01-01 00:03 wakeup102 -> ../../devices/virtual/wakeup/wakeup102
权限配置文件位置:source/android/system/sepolicy/private/genfs_contexts
软链接后的权限就不一致了。。
本文参考链接:https://www.cnblogs.com/hellokitty2/p/13579707.html