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

Add sudo and timeout options to linux-connect #142

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KeithYeh
Copy link

Allow users to use the connect method with sudo permission or customize waiting timeout on Linux.

Description

I use the connect code example on Raspberry Pi 4.

// connect.js
wifi.connect({ ssid: 'ssid', password: 'password' }, error => {
  if (error) {
    console.log(error);
  }
  console.log('Connected');
});

It works by using node connect.js

When I use pm2 start connect.js, the permission error was thrown.

Not sure what's the root cause yet, but using sudo can be a workaround to solve this issue.

Motivation and Context

Related issue: #10

Usage examples

// You can use sudo (need sudoer permission) or set timeout on linux
wifi.connect({ ssid: 'ssid', password: 'password', sudo: true, timeout: 10 /* seconds */ }, error => {
  if (error) {
    console.log(error);
  }
  console.log('Connected');
});

How Has This Been Tested?

Tested on Raspberry Pi 4, Raspbian OS

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactorization (non-functional change which improve code readability)

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

Successfully merging this pull request may close these issues.

1 participant