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/properties.h>
18 #include <android-base/file.h>
19 
20 #define BCMBT_ACTIVITY_LOG_DIRECTORY "/data/vendor/bluetooth"
21 #define BCMBT_SNOOP_LOG_DIRECTORY "/data/vendor/bluetooth"
22 #define BCMBT_FW_LOG_DIRECTORY "/data/vendor/ssrdump/coredump"
23 #define BCMBT_SNOOP_LOG_PREFIX "btsnoop_hci_vnd"
24 #define BCMBT_BACKUP_SNOOP_LOG_PREFIX "backup_btsnoop_hci_vnd"
25 #define BCMBT_FW_DUMP_LOG_PREFIX "coredump_bt_socdump_"
26 #define BCMBT_CHRE_DUMP_LOG_PREFIX "coredump_bt_chredump_"
27 #define BCMBT_HAL_DUMP_LOG_PREFIX "coredump_bt_"
28 #define BCMBT_ACTIVITY_LOG_PREFIX "bt_activity_"
29 
main()30 int main() {
31     std::string outputDir = concatenatePath(BUGREPORT_PACKING_DIR, "bcmbt");
32     if (mkdir(outputDir.c_str(), 0777) == -1) {
33         printf("Unable to create folder: %s\n", outputDir.c_str());
34         return 0;
35     }
36 
37     dumpLogs(BCMBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 4,
38              BCMBT_SNOOP_LOG_PREFIX);
39     dumpLogs(BCMBT_SNOOP_LOG_DIRECTORY, outputDir.c_str(), 2, BCMBT_BACKUP_SNOOP_LOG_PREFIX);
40     dumpLogs(BCMBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_FW_DUMP_LOG_PREFIX);
41     dumpLogs(BCMBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_CHRE_DUMP_LOG_PREFIX);
42     dumpLogs(BCMBT_FW_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_HAL_DUMP_LOG_PREFIX);
43     dumpLogs(BCMBT_ACTIVITY_LOG_DIRECTORY, outputDir.c_str(), 10, BCMBT_ACTIVITY_LOG_PREFIX);
44     return 0;
45 }
46