|
|
|
|
@ -52,7 +52,7 @@ app.get('/status/:gpio', function (req, res) {
|
|
|
|
|
|
|
|
|
|
const gpio = req.params.gpio;
|
|
|
|
|
const command = `pinctrl get ${gpio}`;
|
|
|
|
|
const regex = /^.*\| (..) \/.*$/;
|
|
|
|
|
const regex = new RegExp(/.*\| (..) \/.*/);
|
|
|
|
|
|
|
|
|
|
child_process.exec(command, function (error, stdout, stderr) {
|
|
|
|
|
|
|
|
|
|
@ -60,9 +60,9 @@ app.get('/status/:gpio', function (req, res) {
|
|
|
|
|
console.log(error);
|
|
|
|
|
return res.status(500).send('Error');
|
|
|
|
|
} else {
|
|
|
|
|
const status = stdout.toString().match(regex)[1];
|
|
|
|
|
const status = regex.exec(stdout)[1];
|
|
|
|
|
|
|
|
|
|
console.log('Status', gpio, stdout);
|
|
|
|
|
console.log(stdout);
|
|
|
|
|
return res.status(200).send(status);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|