Re: [GLLUG] Reading USB serial port broken

2019-09-24 Thread James Courtier-Dutton via GLLUG
On Fri, 20 Sep 2019 at 08:02, Henrik Morsing via GLLUG
 wrote:
>
>
> Hi,
>
> I have an Arduino connected via USB to a PC, to read sensors around my house. 
> It calls a Python script as a Munin plugin.
>
> For quite some time now, and I think this possible broke after an upgrade, 
> the Python script gets no output from ttyACM0.
>
> Unless I run a 'tail -f' on the device from the command line! Then it works. 
> Otherwise the script just times out getting nothing.
>
> I'm guessing it's down to a kernel change in how it opens or signals through 
> USB serial devices but what? Googling for a year has found nothing similar to 
> this problem. I'm not really an expert on serial devices and even less on USB 
> serial devices.
>
> It's getting really frustrating now as the monitoring just never works 
> anymore, so any help appreciated.
>

Serial programming is notoriously complicated.
I have done it in python before, doing a similar thing that you are doing.
Would you be able to post the python script so we can see how you are
setting up the tty and how you read/write bytes to it?
It is very messing writing python code that catches all possible errors.
For example, I was seeing RF noise coming from all the sensors,
occasionally knocking the USB link off/on.
My python code then had to detect this, close the tty, wait a mo for
it to settle, then open it again.
After that, in the end I dumped Python, and used a mixture of Java, C and C++.
Essentially moving from domogik (Python) to openhab (mainly Java but
with C, C++ for low level device/tty access.)

Kind Regards

James

-- 
GLLUG mailing list
GLLUG@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/gllug

Re: [GLLUG] Reading USB serial port broken

2019-09-24 Thread Henrik Morsing via GLLUG

On Fri, Sep 20, 2019 at 03:25:30PM +0100, Dimitrios Siganos wrote:

In that case, your problem is likely to be with the DSR pin handling.
Experiment with dsrdtr flow control and with toggling the dsr pin manually.



Hi,

I'm not really any wiser. Do you mean toggle it in Python or with something 
like stty? I've tried both, neither helps.

I feel a bit stuck. 


Thanks
Henrik


--
GLLUG mailing list
GLLUG@mailman.lug.org.uk
https://mailman.lug.org.uk/mailman/listinfo/gllug