Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with ppp asked? #198

Open
faanskit opened this issue Nov 30, 2023 · 0 comments
Open

Compatibility with ppp asked? #198

faanskit opened this issue Nov 30, 2023 · 0 comments

Comments

@faanskit
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant