Skip to content

Commit

Permalink
remotebuzzer_server.: make linter happy (#967)
Browse files Browse the repository at this point in the history
Change-Id: I40ed884bcdc771951bd03e7642d518061ab7c4ae
  • Loading branch information
andi34 authored Nov 7, 2024
1 parent 67047c4 commit d3838d8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/js/remotebuzzer_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,18 +307,19 @@ server.listen(config.remotebuzzer.port, () => {

/* SANITY CHECKS */
function gpioSanity(gpioconfig) {
let configPath;
try {
if (isNaN(gpioconfig)) {
throw new Error(gpioconfig + ' is not a valid number');
}

const configPath = fs.existsSync('/boot/firmware/config.txt')
? '/boot/firmware/config.txt'
: fs.existsSync('/boot/config.txt')
? '/boot/config.txt'
: (() => {
throw new Error('Configuration file not found');
})();
if (fs.existsSync('/boot/firmware/config.txt')) {
configPath = '/boot/firmware/config.txt';
} else if (fs.existsSync('/boot/config.txt')) {
configPath = '/boot/config.txt';
} else {
throw new Error('Configuration file not found');
}

cmd = 'sed -n "s/^gpio=\\(.*\\)=pu/\\1/p" ' + configPath;
stdout = execSync(cmd).toString();
Expand Down

0 comments on commit d3838d8

Please sign in to comment.