Skip to content

Commit

Permalink
patch to handle debugfs not mounted
Browse files Browse the repository at this point in the history
  • Loading branch information
vaishnavachath committed May 16, 2018
1 parent 2148f35 commit e03ad17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 e03ad17

Please sign in to comment.