altera2015 / usbserial

Flutter Android USB Serial plugin
BSD 3-Clause "New" or "Revised" License
124 stars 83 forks source link

the listDevices always null #2

Closed zxj17815 closed 5 years ago

zxj17815 commented 5 years ago

I simulation usb COM1(android) and usb COM2,but the listDevices always null,when I click send, error:

E/flutter ( 2498): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception: E/flutter ( 2498): NoSuchMethodError: The method 'write' was called on null. E/flutter ( 2498): Receiver: null E/flutter ( 2498): Tried calling: write(Uint8Array) E/flutter ( 2498): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5) E/flutter ( 2498): #1 _MyAppState.build.<anonymous closure> package:usb/main.dart:71 E/flutter ( 2498): <asynchronous suspension> E/flutter ( 2498): #2 _InkResponseState._handleTap package:flutter/…/material/ink_well.dart:507

altera2015 commented 5 years ago

I'm guessing your solution is not simulating a USB CDC (or similar) device but directly a COM port in the Linux kernel. This code base is intended to access UART hardware connected via USB. Can you give me more details on how you simulated your comports? What hardware vendor and product ids?

Thanks

zxj17815 commented 5 years ago

I can connect now, but the problem is that I did not receive the returned information after sending, I do not know whether the instruction sent in the past does not belong to hex? Because I can receive the return message when I test with another software

zxj17815 commented 5 years ago

I find the pid=24577&vid=1027,it doesn't work; and I use the other pid=8963&vid=1659, it work.

zxj17815 commented 5 years ago

oh,but I tested by FTDIs'app ,it's working, I have no idea...

zxj17815 commented 5 years ago

Is it a driver problem? But open is ok, when I send the data, the receiving light on the control panel flashes, does it mean that the hardware and driver are ok, just my code has problems.

altera2015 commented 5 years ago

I'm not sure, can you link your code?

altera2015 commented 5 years ago

I've updated to the latest UsbSerial underlying library. Give it a go with 0.2.1, it might solve your trouble.

zxj17815 commented 5 years ago

Thank you, it work now