I am trying to use the usb_serial: ^0.4.0
package in my Flutter project for communicating with a USB device on Android. I have followed the installation guide and the package seems to be imported successfully.
However, every time I try to open the USB connection using the open() function provided by the package, it always returns false, even though the device is connected and recognized by the Android device. I have tried debugging the issue by checking the logs, using other USB communication tools and using multiple different types of USB devices but I still can't seem to get it to work and the open()
function always seems to return false.
Here is the code I am using:
UsbPort? port = await device.create(UsbSerial.FTDI);
print(await port?.open());
port
is being assigned correctly yet this is the output I get in console
D/UsbSerialPortAdapter(18760): success.
I/FTDISerialDevice(18760): Interface succesfully claimed
I/FTDISerialDevice(18760): Control Transfer Response: -1
I/flutter (18760): false
Is there something I am missing or doing wrong? How can I get the USB connection to open successfully? I am guessing without opening correctly I would not be able to receive input from the usb device through the port's inputStream
?
Despite this, input from a PS4 controller is being detected as system input by the app. Yet the inputStream
is not receiving any input.