1 # 2 # Copyright (C) 2016 The Android Open Source Project 3 # 4 # Licensed under the Apache License, Version 2.0 (the "License"); 5 # you may not use this file except in compliance with the License. 6 # You may obtain a copy of the License at 7 # 8 # http://www.apache.org/licenses/LICENSE-2.0 9 # 10 # Unless required by applicable law or agreed to in writing, software 11 # distributed under the License is distributed on an "AS IS" BASIS, 12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 # See the License for the specific language governing permissions and 14 # limitations under the License. 15 # 16 17 on fs 18 setprop sys.wifitracing.started 0 19 20 on property:sys.boot_completed=1 && property:sys.wifitracing.started=0 21 # Create trace buffer, and set basic configuration. 22 mkdir /sys/kernel/debug/tracing/instances/wifi 711 23 restorecon_recursive /sys/kernel/debug/tracing/instances/wifi 24 write /sys/kernel/debug/tracing/instances/wifi/tracing_on 0 25 write /sys/kernel/debug/tracing/instances/wifi/buffer_size_kb 1 26 write /sys/kernel/debug/tracing/instances/wifi/trace_options disable_on_free 27 28 # Enable cfg80211 events for connection and key management events. 29 # - Events are not actually logged until WifiService writes "1" to 30 # /sys/kernel/debug/tracing/instances/wifi/tracing_on. 31 # - WifiService is responsible for turning tracing off and on. 32 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/cfg80211_gtk_rekey_notify/enable 1 33 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/rdev_add_key/enable 1 34 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/rdev_assoc/enable 1 35 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/rdev_auth/enable 1 36 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/rdev_connect/enable 1 37 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/rdev_set_default_key/enable 1 38 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/rdev_set_default_mgmt_key/enable 1 39 write /sys/kernel/debug/tracing/instances/wifi/events/cfg80211/rdev_set_rekey_data/enable 1 40 41 # Enable datapath events for Wifi. 42 # - Events are not actually logged until WifiService writes "1" to 43 # /sys/kernel/debug/tracing/instances/wifi/tracing_on. 44 # - WifiService will ensure that tracing is turned back off, 45 # when a connection attempt ends (whether in success or failure) 46 write /sys/kernel/debug/tracing/instances/wifi/events/net/filter name==${wifi.interface:-wlan0} 47 write /sys/kernel/debug/tracing/instances/wifi/events/net/net_dev_queue/enable 1 48 write /sys/kernel/debug/tracing/instances/wifi/events/net/net_dev_xmit/enable 1 49 write /sys/kernel/debug/tracing/instances/wifi/events/net/netif_rx/enable 1 50 write /sys/kernel/debug/tracing/instances/wifi/events/net/netif_receive_skb/enable 1 51 52 # Set DAC to allow system_server to enable/disable, and read wifi trace 53 # events. 54 chown system /sys/kernel/debug/tracing/instances/wifi/tracing_on 55 chown system /sys/kernel/debug/tracing/instances/wifi/free_buffer 56 chown system /sys/kernel/debug/tracing/instances/wifi/trace 57 chmod 200 /sys/kernel/debug/tracing/instances/wifi/tracing_on 58 chmod 400 /sys/kernel/debug/tracing/instances/wifi/free_buffer 59 chmod 600 /sys/kernel/debug/tracing/instances/wifi/trace 60 setprop sys.wifitracing.started 1 61 62 on property:sys.boot_completed=1 && property:wifi.interface=* && sys.wifitracing.started=1 63 # Override default value. 64 write /sys/kernel/debug/tracing/instances/wifi/events/net/filter name==${wifi.interface} 65