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

Android support #112

Open
curonny opened this issue Jul 24, 2024 · 9 comments
Open

Android support #112

curonny opened this issue Jul 24, 2024 · 9 comments

Comments

@curonny
Copy link

curonny commented Jul 24, 2024

Permission denied, errno = 13

@rekire
Copy link
Contributor

rekire commented Dec 4, 2024

Yep, that's normal when the manufacturer forget to set correct file permissions. Basically a blind spot of Android

@AurelienBallier
Copy link

Hello,
I created a PR to libserialport.dart in order to provide Android support to flutter_libserialport:
jpnurmi/libserialport.dart#89

@rekire
Copy link
Contributor

rekire commented Jan 21, 2025

Does you patch still require root or do you bypass it somehow with the other library?

@AurelienBallier
Copy link

Yes you don't need root, it relies on USB Android SDK. It asks user permission upon serial port opening.

@luciano-cervantes
Copy link

Hello @AurelienBallier

I managed to advance the implementation using your PR, however, when using the listen method of the SerialPortReader class, it is returning an error:

Fatal signal 11 (SIGSEGV), code 1, fault addr 0x420 in tid 6636 (DartWorker)

Would you have any idea what it could be and how to fix this bug?

@luciano-cervantes
Copy link

luciano-cervantes commented Jan 28, 2025

My code:

final ports = await SerialPort.availablePorts;

    StreamSubscription<Uint8List>? subscription;

    try {
      final portSerial = SerialPort(ports.first);

      final opened = await portSerial.openReadWrite();

      if (!opened) {
        return null;
      }

      portSerial.setConfig(SerialPortConfig()
        ..baudRate = 4800
        ..bits = config.bits
        ..stopBits = config.stopBits!.value
        ..parity = config.parity!.value);

      SerialPortReader serialPortReader = SerialPortReader(portSerial);

      serialPortReader.stream.listen(
        (event) {
          print(event);
        },
      );

@AurelienBallier
Copy link

Hello @luciano-cervantes,
I haven't looked much into SerialPortReader as I only use the read/write function.
You are right it's not working as it's also tied to the underlying Sigrok libserialport, I'll have a look at it thanks for your help.
Regards,

@luciano-cervantes
Copy link

@AurelienBallier

It would be great if you could look at this, I'm in a project that needs this option, but I couldn't identify where the error is.

@vinicioshenriques
Copy link

Hi @AurelienBallier, i made some changes using your branch as a base, fixing @luciano-cervantes problem, and opened a pull request, please check it out when you can.
AurelienBallier/libserialport.dart#1

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

5 participants