Skip to content

Commit

Permalink
add raspberry pi arm/gpu memory
Browse files Browse the repository at this point in the history
Signed-off-by: si458 <simonsmith5521@gmail.com>
  • Loading branch information
si458 committed Sep 15, 2024
1 parent 5fc3683 commit 8bc7608
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions agents/modules_meshcore/computer-identifiers.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ function linux_identifiers()
identifiers['board_vendor'] = 'Raspberry Pi';
identifiers['board_name'] = require('fs').readFileSync('/sys/firmware/devicetree/base/model').toString().trim();
identifiers['board_serial'] = require('fs').readFileSync('/sys/firmware/devicetree/base/serial-number').toString().trim();
const memorySlots = [];
var child = require('child_process').execFile('/bin/sh', ['sh']);
child.stdout.str = ''; child.stdout.on('data', dataHandler);
child.stdin.write('vcgencmd get_mem arm && vcgencmd get_mem gpu\nexit\n');
child.waitExit();

This comment has been minimized.

Copy link
@Mik13

Mik13 Sep 27, 2024

First I was wondering if the await was missing since it is not sync, but I did not find the command in the nodejs docs...

try {
const lines = child.stdout.str.trim().split('\n');
if (lines.length == 2) {
memorySlots.push({ Locator: "ARM Memory", Size: lines[0].split('=')[1].trim() })
memorySlots.push({ Locator: "GPU Memory", Size: lines[1].split('=')[1].trim() })
ret.memory = { Memory_Device: memorySlots };
}
} catch (xx) { }
} else {
throw('Unknown board');
}
Expand Down

0 comments on commit 8bc7608

Please sign in to comment.