-1

I am trying to communicate with a machine connected to a usb port using the cp210x driver of the RPi. I have a java method which open a FileOutputStream and a FileInputStream for each /dev/ttyUSBX file. It then demands the machine to return an ID and if this ID is correct, the connection is set.

This is not working properly so far, except if I install a small software. This small software asks me to "register" the device I'm trying to connect. Once I've done this step, the communication is set properly. If I uninstall this software, or un-register the device, it is not working anymore.

My problem is that I have no idea what this little software does and how I can communicate without. So here's my question :

  1. Is there a way to know what exactly a software do while running ?
  2. How do I "register" a usb device on RPi (if that's something common) ?
  3. Is there a better way to set up the usb-serial connection (through java code, if possible, sorry if that's not the right place to ask) ?

Through "lsusb" command, I know that the device uses the cp210x driver, but I'm still new to linux environment and don't fully understand how drivers and ports work.

[EDIT]

I've managed to make the serial usb work : I just tried to spy on the port when communicating with it, through the command stty raw -echo < /dev/ttyUSB0; cat -vte /dev/ttyUSB0. Now I need to now exactly what this does on the port (some kind of "clear" or "dump" I guess), and do it before accessing this port.

Thank you for any help you could provide.

  • for the first question: you can use strace -p <PID> to trace the system calls of the software – mperlet Jan 26 '17 at 12:46
  • This question is really unclear. some software is used to register some device which then communicates via UART using some sort of protocol. Even if I had exactly the same problem as you, there would be no way for me realize that I could use the answer, not to mention finding your question in the first place. – Dmitry Grigoryev Feb 2 '17 at 10:37
  • I realize that my question lacks of information, and that is actually my whole problem : this software is not accessible to public and I don't have much intel on it, same thing for the device. I hesitated a long time before posting it, for I knew there was not much you could help me with, with so little info. – C. Lesourd Feb 2 '17 at 15:42
0

Thanks for the advice. I manage to make it work by changing the ttyUSB settings with the stty command. By removing some special character (with -canon and -isig), my program can now communicate with my device, without using the third-part software.

So if one day you are having trouble with a device you don't know much about, but the driver cp210x seems to work, you can try that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.