Skip to content

Commit

Permalink
Merge pull request #169 from vaishnav98/master
Browse files Browse the repository at this point in the history
patch to handle debugfs not mounted
  • Loading branch information
jadonk committed May 16, 2018
2 parents 2148f35 + e03ad17 commit a7282d9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -31,7 +31,8 @@
"express": "4.13.4",
"socket.io": "1.4.5",
"systemd": "0.2.6",
"winston": "2.1.1"
"winston": "2.1.1",
"shelljs": "0.8.2"
},
"optionalDependencies": {
"serialport": "3.1.2",
Expand Down
10 changes: 10 additions & 0 deletions src/hw_mainline.js
Expand Up @@ -4,6 +4,7 @@ var parse = require('./parse');
var eeprom = require('./eeprom');
var util = require('util');
var winston = require('winston');
var shell = require('shelljs');

var debug = process.env.DEBUG ? true : false;
if (debug) {
Expand Down Expand Up @@ -47,6 +48,15 @@ var readGPIODirection = function (n, gpio) {
var readPinMux = function (pin, mode, callback) {
var pinctrlFile = '/sys/kernel/debug/pinctrl/44e10800.pinmux/pins';
var muxRegOffset = parseInt(pin.muxRegOffset, 16);
//handle the case when debugfs not mounted
if (!my.file_existsSync(pinctrlFile)) {
//exit code is 1 if /sys/kernel/debug not mounted
const umount = shell.exec('mountpoint -q /sys/kernel/debug/').code;
if (umount)
shell.exec('mount -t debugfs none /sys/kernel/debug/', {
silent: true
});
}
var readPinctrl = function (err, data) {
if (err) {
mode.err = 'readPinctrl error: ' + err;
Expand Down

0 comments on commit a7282d9

Please sign in to comment.