Adam Shih | cf72660 | 2022-10-04 13:09:00 +0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2022 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 <stdio.h> |
| 17 | #include <string> |
| 18 | #include <android-base/file.h> |
| 19 | |
| 20 | // Format title and content output. |
| 21 | void dumpFileContent(const char* title, const char* file_path) { |
| 22 | std::string content; |
| 23 | printf("------ %s (%s) ------\n", title, file_path); |
| 24 | if (android::base::ReadFileToString(file_path, &content)) { |
| 25 | printf("%s\n", content.c_str()); |
| 26 | } else { |
| 27 | printf("Unable to read %s\n", file_path); |
| 28 | } |
| 29 | return; |
| 30 | } |
| 31 | |
| 32 | // Dump chip ID. |
| 33 | int main() { |
| 34 | dumpFileContent("AP HW TUNE", "/sys/devices/system/chip-id/ap_hw_tune_str"); |
| 35 | dumpFileContent("EVT VERSION", "/sys/devices/system/chip-id/evt_ver"); |
| 36 | dumpFileContent("LOT ID", "/sys/devices/system/chip-id/lot_id"); |
| 37 | dumpFileContent("PRODUCT ID", "/sys/devices/system/chip-id/product_id"); |
| 38 | dumpFileContent("REVISION", "/sys/devices/system/chip-id/revision"); |
| 39 | dumpFileContent("RAW STR", "/sys/devices/system/chip-id/raw_str"); |
| 40 | return 0; |
| 41 | } |