1 /*
2 * Copyright 2020-2024 The OSHI Project Contributors
3 * SPDX-License-Identifier: MIT
4 */
5 package oshi.driver.linux;
6
7 import oshi.annotation.concurrent.ThreadSafe;
8 import oshi.util.FileUtil;
9 import oshi.util.platform.linux.SysPath;
10
11 /**
12 * Utility to read info from the devicetree
13 */
14 @ThreadSafe
15 public final class Devicetree {
16
17 private Devicetree() {
18 }
19
20 /**
21 * Query the model from the devicetree
22 *
23 * @return The model if available, null otherwise
24 */
25 public static String queryModel() {
26 String modelStr = FileUtil.getStringFromFile(SysPath.MODEL);
27 if (!modelStr.isEmpty()) {
28 return modelStr.replace("Machine: ", "");
29 }
30 return null;
31 }
32 }