felHR85 / UsbSerial

Usb serial controller for Android
MIT License
1.78k stars 581 forks source link

Unhandled Exception: PlatformException(UsbSerialPortAdapter, Not an Serial device., null, null) #372

Open chituanh opened 1 week ago

chituanh commented 1 week ago

I can connect this device on windows but it gives me this error when I connect to android

[UsbDevice: /dev/bus/usb/002/003, 1ac2-f DESKO USB DEVICE, DESKO GmbH 00000017]

Unhandled Exception: PlatformException(UsbSerialPortAdapter, Not an Serial device., null, null)

Future.delayed(Duration.zero, () async { List devices = await UsbSerial.listDevices();

  print(devices);
  final port = await devices.first.create();
  await port?.setDTR(true);
  await port?.setRTS(true);
  port?.setPortParameters(9600, UsbPort.DATABITS_8, UsbPort.STOPBITS_1, UsbPort.PARITY_NONE);
  port?.setFlowControl(UsbPort.FLOW_CONTROL_OFF);

  await port?.open();
  port?.inputStream?.listen((event) {
    print(event);
  });
});
chituanh commented 1 week ago

I want to receive data from a qr code scanning device but it displays the same error code. I don't know if it's due to the device or the way I installed it