Search code examples
javaandroidserial-portusbserial

Failing to send data to USB device using the android UsbSerial library


Library: https://github.com/felHR85/UsbSerial

I'm new to android development, so for all I know the answer to my question may be staring me directly in the face.

When I post a command I do not receive any feedback from the device I'm sending the command to (light fixture controller). However, when I load up Serial USB Terminal (Android app) and send a random (even invalid) command, it'll take care of the command I sent with UsbSerial first and validating that it went through (responds with "OK"). Which leads me to believe the command is stuck in a buffer somewhere. I'm building the application using API 19 because the devices we are using do not update beyond Kit Kat, not sure if that makes a difference.

Any ideas?

Any ideas or help would be GREATLY appreciated. Been trying to work through this problem for a week now.


Solution

  • God I'm an idiot. I didn't add a newline after every command sent. Hopefully this will help someone like me down the road!

    For example I do

    String cmd = "sfd\n";
    usbService.write(cmd.getBytes());