1 /*
2  * Copyright 2023 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 #include <dump/pixel_dump.h>
17 #include <android-base/file.h>
18 
19 #define PIXELBT_ACTIVITY_LOG_DIRECTORY "/data/vendor/bluetooth"
20 #define PIXELBT_SNOOP_LOG_DIRECTORY "/data/vendor/bluetooth"
21 #define PIXELBT_FW_LOG_DIRECTORY "/data/vendor/ssrdump/coredump"
22 #define PIXELBT_SNOOP_LOG_PREFIX "btsnoop_hci_vnd"
23 #define PIXELBT_BACKUP_SNOOP_LOG_PREFIX "backup_btsnoop_hci_vnd"
24 #define PIXELBT_FW_DUMP_LOG_PREFIX "coredump_bt_socdump_"
25 #define PIXELBT_CHRE_DUMP_LOG_PREFIX "coredump_bt_chredump_"
26 #define PIXELBT_HAL_DUMP_LOG_PREFIX "coredump_bt_"
27 #define PIXELBT_ACTIVITY_LOG_PREFIX "bt_activity_"
28 
main()29 int main() {
30     std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "bt");
31     if (mkdir(outputDir.c_str(), 0777) == -1) {
32         printf("Unable to create folder: %s\n", outputDir.c_str());
33         return 0;
34     }
35 
36     dumpLogs(PIXELBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 4,
37              PIXELBT_SNOOP_LOG_PREFIX);
38     dumpLogs(PIXELBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 2, PIXELBT_BACKUP_SNOOP_LOG_PREFIX);
39     dumpLogs(PIXELBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_FW_DUMP_LOG_PREFIX);
40     dumpLogs(PIXELBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_CHRE_DUMP_LOG_PREFIX);
41     dumpLogs(PIXELBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_HAL_DUMP_LOG_PREFIX);
42     dumpLogs(PIXELBT_ACTIVITY_LOG_DIRECTORY, outputDir.c_str(), 10, PIXELBT_ACTIVITY_LOG_PREFIX);
43     return 0;
44 }
45