1
2
3
4
5 package oshi.driver.linux;
6
7 import oshi.annotation.concurrent.ThreadSafe;
8 import oshi.util.ExecutingCommand;
9 import oshi.util.ParseUtil;
10
11
12
13
14 @ThreadSafe
15 public final class Lshal {
16
17 private Lshal() {
18 }
19
20
21
22
23
24
25 public static String querySerialNumber() {
26
27 String marker = "system.hardware.serial =";
28 for (String checkLine : ExecutingCommand.runNative("lshal")) {
29 if (checkLine.contains(marker)) {
30 return ParseUtil.getSingleQuoteStringValue(checkLine);
31 }
32 }
33 return null;
34 }
35
36
37
38
39
40
41 public static String queryUUID() {
42
43 String marker = "system.hardware.uuid =";
44 for (String checkLine : ExecutingCommand.runNative("lshal")) {
45 if (checkLine.contains(marker)) {
46 return ParseUtil.getSingleQuoteStringValue(checkLine);
47 }
48 }
49 return null;
50 }
51 }