Skip to content

Commit d846786

Browse files
committed
Add detailed hardware info to MoodleBox dashboard
- See issue #111.
1 parent 7a02453 commit d846786

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

classes/local/utils.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,16 @@ class utils {
8181
* @return associative array of parameters, value or false if unsupported hardware.
8282
*/
8383
public static function get_hardware_model() {
84-
$revisionnumber = null;
84+
$revisioncode = null;
8585

8686
// Read revision number from device.
8787
if ( $cpuinfo = @file_get_contents('/proc/cpuinfo') ) {
8888
if ( preg_match_all('/^Revision.*/m', $cpuinfo, $revisionmatch) > 0 ) {
89-
$revisionnumber = explode(' ', $revisionmatch[0][0]);
90-
$revisionnumber = end($revisionnumber);
89+
$revisioncode = explode(' ', $revisionmatch[0][0]);
90+
$revisioncode = end($revisioncode);
9191
}
9292
}
93-
$revisionnumber = hexdec($revisionnumber);
93+
$revisionnumber = hexdec($revisioncode);
9494

9595
// Define arrays of various hardware parameter values.
9696
$memorysizes = array('256MB', '512MB', '1GB', '2GB', '4GB', '8GB');
@@ -119,6 +119,7 @@ public static function get_hardware_model() {
119119
$memorysize = $memorysizes[$rawmemory];
120120

121121
return array(
122+
'revisioncode' => $revisioncode,
122123
'revision' => $revision,
123124
'model' => $model,
124125
'processor' => $processor,

index.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@
274274
}
275275
// System info.
276276
$table->add_data(array(get_string('systeminfo', 'tool_moodlebox'), ''));
277-
$table->add_data(array(get_string('raspberryhardware', 'tool_moodlebox'),
278-
get_string($platform, 'tool_moodlebox')), 'subinfo');
279277
$table->add_data(array(get_string('sdcardavailablespace', 'tool_moodlebox'), display_size($sdcardfreespace) .
280278
' (' . 100 * round($sdcardfreespace / $sdcardtotalspace, 3) . '%)'), 'subinfo');
281279
$table->add_data(array(get_string('cpuload', 'tool_moodlebox'),
@@ -285,6 +283,11 @@
285283
$table->add_data(array(get_string('cpufrequency', 'tool_moodlebox'), $cpufrequency), 'subinfo');
286284
$table->add_data(array(get_string('uptime', 'tool_moodlebox'), $uptime), 'subinfo');
287285
}
286+
// Hardware info.
287+
$table->add_data(array(get_string('hardwareinfo', 'tool_moodlebox'), ''));
288+
$table->add_data(array(get_string('raspberryhardware', 'tool_moodlebox'), get_string($platform, 'tool_moodlebox')), 'subinfo');
289+
$table->add_data(array(get_string('revision', 'tool_moodlebox'), $hardwaredata['revision']), 'subinfo');
290+
$table->add_data(array(get_string('revisioncode', 'tool_moodlebox'), $hardwaredata['revisioncode']), 'subinfo');
288291
// Software versions.
289292
$table->add_data(array(get_string('softwareversions', 'tool_moodlebox'), ''));
290293
if ( $releaseinfo ) {

lang/en/tool_moodlebox.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
$string['ethernetdisconnected'] = 'Ethernet disconnected';
4949
$string['forum'] = 'MoodleBox support forum';
5050
$string['forum_desc'] = '<p>If you can\'t find an answer to your question in the <a href="https://moodlebox.net/en/help/" title="MoodleBox documentation" target="_blank">MoodleBox documentation</a>, search the <a href="https://discuss.moodlebox.net/" title="MoodleBox forum" target="_blank">MoodleBox support forum</a> to see if your question has already been answered. Otherwise, feel free to open a new discussion.</p>';
51+
$string['hardwareinfo'] = 'Hardware information';
5152
$string['hidden'] = 'Hidden';
5253
$string['infofileerror'] = 'Information not available';
5354
$string['infoheading'] = 'MoodleBox support information';
@@ -91,6 +92,8 @@
9192
$string['restartmessage'] = 'The MoodleBox is restarting. It will be online again in a moment.';
9293
$string['restartstop'] = 'Restart and shutdown';
9394
$string['restartstop_help'] = 'Use these buttons to restart or turn off the MoodleBox. It is highly recommended that you do not unplug the power supply to shutdown the MoodleBox.';
95+
$string['revision'] = 'Model revision';
96+
$string['revisioncode'] = 'Model revision code';
9497
$string['rpi1'] = 'Raspberry Pi 1';
9598
$string['rpi2'] = 'Raspberry Pi 2B';
9699
$string['rpi3aplus'] = 'Raspberry Pi 3A+';

version.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626

2727
$plugin = new stdClass();
2828

29-
$plugin->version = 2022112000;
30-
$plugin->release = '2.14.2';
29+
$plugin->version = 2022040200;
30+
$plugin->release = '2.15.0-dev';
3131
$plugin->requires = 2018120300;
3232
$plugin->supported = [36, 410];
33-
$plugin->maturity = MATURITY_STABLE;
33+
$plugin->maturity = MATURITY_BETA;
3434
$plugin->component = 'tool_moodlebox';

0 commit comments

Comments
 (0)