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

available_ports() always empty #4

Closed
itsgoofer opened this issue Sep 18, 2024 · 2 comments
Closed

available_ports() always empty #4

itsgoofer opened this issue Sep 18, 2024 · 2 comments

Comments

@itsgoofer
Copy link

Trying to get a list of serial ports on my PC. I have COM1, COM2 and COM3 opened, but the list is always empty.

function ports() {
        SerialPort.available_ports()
            .then((res) => {
                console.log('available_ports: ', res);
            })
            .catch((err) => {
                console.error(err);
            });
    }

I'm getting Serial port list: {}

I have the plugin installed, declared in lib.rs and the permissions setup.
Any ideas?

Thanks.

@s00d
Copy link
Owner

s00d commented Sep 22, 2024

Hello, the library used for working with ports is https://github.com/serialport/serialport-rs. In the available_ports method, there is only a filter for the port type; there is no other functionality. You will need to try to get the list of ports directly, and if the list is still empty, please contact the developer of the serialport-rs library, as the issue lies somewhere on the library's side.

@s00d
Copy link
Owner

s00d commented Sep 22, 2024

It seems the issue may be related to the following discussions:

As of now, it appears that the problem has not been resolved. I recommend trying the available_ports_direct method for version 2.0.0-rc.4.

  • available_ports_direct: This method serves as a fallback when available_ports fails. It directly executes system commands to list serial ports based on the operating system (Windows, Linux, macOS). It returns a list of detected ports with a default type of "Unknown."

@s00d s00d closed this as completed Sep 23, 2024
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

2 participants