add raspberry pi arm/gpu memory
Signed-off-by: si458 <simonsmith5521@gmail.com>
si458 committed
Sep 15, 2024 at 19:39 UTC
8bc760855eb49c2c08111ca2558a112423081115
1 file changed
+13
agents/modules_meshcore/computer-identifiers.js
+13
@@ -75,6 +75,19 @@ function linux_identifiers()
75
identifiers['board_vendor'] = 'Raspberry Pi';
76
identifiers['board_name'] = require('fs').readFileSync('/sys/firmware/devicetree/base/model').toString().trim();
77
identifiers['board_serial'] = require('fs').readFileSync('/sys/firmware/devicetree/base/serial-number').toString().trim();
78
+ const memorySlots = [];
79
+ var child = require('child_process').execFile('/bin/sh', ['sh']);
80
+ child.stdout.str = ''; child.stdout.on('data', dataHandler);
81
+ child.stdin.write('vcgencmd get_mem arm && vcgencmd get_mem gpu\nexit\n');
82
+ child.waitExit();
83
+ try {
84
+ const lines = child.stdout.str.trim().split('\n');
85
+ if (lines.length == 2) {
86
+ memorySlots.push({ Locator: "ARM Memory", Size: lines[0].split('=')[1].trim() })
87
+ memorySlots.push({ Locator: "GPU Memory", Size: lines[1].split('=')[1].trim() })
88
+ ret.memory = { Memory_Device: memorySlots };
89
+ }
90
+ } catch (xx) { }
91
} else {
92
throw('Unknown board');
93
}