I am trying to port a service written for Windows systems in C# onto Linux, with the aim of replacing Windows altogether. The hardware remains identical in both Windows and Linux environments.
So far this has gone great - I've installed Mono-complete, modified those bits that need modifying to stop it looking for Nuget, compiled the software with only cosmetic errors, run it with mono-service and have established communication with the Serial Port.
That's where things start going wrong.
I am able to open the port, and I am able to send a message to the port which results in the proper response.
By running 'cat /dev/ttyUSB0' I am seeing the proper response from the port - the symbol @
However the symbol is simply not being read by the software and I'm hitting a timeout every time.
I have changed nothing in the code except to open port '/dev/ttyUSB0' instead of 'COM1' (or whatever port it needs).
Why then can I write to, but not read from, the serial port?
I have tried messing with the Encoding of the returning bits, I thought it might be a big-endian / little endian issue but it is correctly sending the signal to the device ("M2" - no quotation marks).
Return communication also looks good - cat /dev/ttyUSB0 shows a series of '@' symbols being returned, each on a new line.
What is not happening though is the software then reading this, instead it is hitting the timeout waiting for the response.
I wondered if it might be a newline issue - but then why would it work as-is on the Windows system, and why would it send perfectly happily (newline currently is explicitly set to '\r\n')
Is there something specific to Linux that I am missing?