Prerequisites:
Running a Node.js server on a Raspberry Pi with a CAT-M1 modem attached, using pppd to connect to the internet via ppp0.
Pppd is using the modem via /dev/ttyUSB3 and the node.js query the modem via nodegsm.
Modules:
- express
- express-session
- http
- ws
- patch
- body-parser
- nodegsm
All worked fine before I added a simple 'onoff' driven button, with simple code.
The code does what it is expected to do. At button press, info is sent on the websocket.
// Push Button
const pushButton = new Gpio(4, 'in', 'rising', {debounceTimeout: 10});
// Close on kill
function unexportOnClose() {
pushButton.unexport(); // Unexport Button GPIO to free resources
};
process.on('SIGINT', unexportOnClose);
// Watch for buttonpush
pushButton.watch(function (err, state) {
if (err) {
console.error('There was an error with the button', err);
return;
}
if(state === 1){
wss.clients.forEach(client => {
if (client.readyState === WebSocket.OPEN) {
sendButton(client, "RISING")
}
});
}
});
Issue:
After I added this code, the pppd will not start properly. It will connect, but immediately disconnect from a SIGTERM signal.
If I comment out the onoff code, it all works fine again.
Looking for guidance and advice on how I can use this module with pppd, and if anyone has succesfully done that.
I have a hunch that it might be related to low level interrupt handing of this module, but that is pure speculation.
Any advice appreciated.
/Marcus
Prerequisites:
Running a Node.js server on a Raspberry Pi with a CAT-M1 modem attached, using pppd to connect to the internet via ppp0.
Pppd is using the modem via /dev/ttyUSB3 and the node.js query the modem via
nodegsm.Modules:
All worked fine before I added a simple 'onoff' driven button, with simple code.
The code does what it is expected to do. At button press, info is sent on the websocket.
Issue:
After I added this code, the pppd will not start properly. It will connect, but immediately disconnect from a SIGTERM signal.
If I comment out the
onoffcode, it all works fine again.Looking for guidance and advice on how I can use this module with pppd, and if anyone has succesfully done that.
I have a hunch that it might be related to low level interrupt handing of this module, but that is pure speculation.
Any advice appreciated.
/Marcus