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

can not set baudrate #29

Open
csj-libs opened this issue Oct 3, 2021 · 4 comments
Open

can not set baudrate #29

csj-libs opened this issue Oct 3, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@csj-libs
Copy link

csj-libs commented Oct 3, 2021

when I set baudrate it does not work at all.

@katyo
Copy link

katyo commented Nov 22, 2021

I have same issue when I attempt to set SerialPortConfig on Linux:

port.config.baudRate = 9600;
No such file or directory, errno = 2

When the exception was thrown, this was the stack:
#0      Util.call (package:libserialport/src/util.dart:39:7)
#1      _SerialPortImpl.config (package:libserialport/src/port.dart:335:12)
...
var config = SerialPortConfig();
config.baudRate = 9600;
port.config = config;
No such file or directory, errno = 2

When the exception was thrown, this was the stack:
#0      Util.call (package:libserialport/src/util.dart:39:7)
#1      _SerialPortImpl.config= (package:libserialport/src/port.dart:347:10)
...

UPD: As I seen in libserialport examples, seems the config should be set after opening the port.

@mortenboye
Copy link

Thanks @katyo for sharing that discovery. Setting the config after opening the port, solve my issue also. Great!

@VinayakaKS
Copy link

Hi, I may be late to answer to this, but thinking it will help others who end up at this problem.
The port.config needs to be set only after opening the port.

  SerialPort port = SerialPort(availablePorts[widget.comPort]);

  final portconfig = SerialPortConfig();
  portconfig.baudRate = 115200;
  
  SerialPortReader reader = SerialPortReader(port, timeout: 10000);
 
  port.openReadWrite();
  port.config = portconfig;

@lucafabbri lucafabbri added the enhancement New feature or request label Feb 21, 2024
@lucafabbri
Copy link
Collaborator

Thanks @VinayakaKS I'll check it further to avoid issues when config is set before opening

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

No branches or pull requests

6 participants
@katyo @mortenboye @csj-libs @lucafabbri @VinayakaKS and others