ed-chemnitz / qmodbus

GNU General Public License v2.0
280 stars 127 forks source link

Cannot find a serial port on Raspberry Pi #28

Open enovikoff opened 4 years ago

enovikoff commented 4 years ago

I successfully compiled and ran qmodbus on my Raspberry Pi 3B, but when I try to connect to the bus, it tells me that it cannot find any serial ports. I'm trying to connect to /dev/ttySC0. Ubuntu 18.04. Other software on the same machine is able to access the modbus via this TTY.

shiftee commented 4 years ago

Did this other software run using sudo? If so you need to add your user to the dialout group.

I just built on a raspberry pi 3B+ running Raspbian (based on Buster) and can find /dev/ttyS0

The serial port detection seems to be using QextSerialEnumerator which I suspect is obsolete :(

enovikoff commented 4 years ago

The other software runs without sudo (I just used the Python minimalmodbus library.) It works fine but manipulating a device with API calls from the console is so error prone that I bricked one by mistake! Also my control system Rexygen accesses the device/bus just fine though I suspect its executive runs as root.

I’m also logged in as root so I’m not sure sudo accomplishes much, and does root really need to be added to any group?

I ended up compiling and running qModbusMaster which is a similar app based on qmodbus. It works fine as well without sudo. However it’s not the most intuitive so I will give your suggestions a try.

Thanks,

Eric

From: shiftee notifications@github.com Reply-To: ed-chemnitz/qmodbus reply@reply.github.com Date: Wednesday, May 6, 2020 at 2:55 PM To: ed-chemnitz/qmodbus qmodbus@noreply.github.com Cc: Eric Novikoff eric@enki.cloud, Author author@noreply.github.com Subject: Re: [ed-chemnitz/qmodbus] Cannot find a serial port on Raspberry Pi (#28)

Did this other software run using sudo? If so you need to add your user to the dialout group.

I just built on a raspberry pi 3B+ running Raspbian (based on Buster) and can find /dev/ttyS0

The serial port detection seems to be using QextSerialEnumerator which I suspect is obsolete :(

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ed-chemnitz/qmodbus/issues/28#issuecomment-624886344, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKFWKBTW2GAXWWYDSZOY7ALRQHFFNANCNFSM4M2GFIAQ.

shiftee commented 4 years ago

Root should be fine yes.

I've created a modified version here which uses the official Qt library for serial port detection. It gives me a different serial port (ttyAMA0 instead of ttyS0), maybe it will help you. I think both solutions use udev anyway.

enovikoff commented 4 years ago

Thanks, I’ll give it a shot tomorrow. I’m actually using ttySC0, which is created by the driver for an extender card. I use a lot of serial ports! Cheers, Eric

From: shiftee notifications@github.com Reply-To: ed-chemnitz/qmodbus reply@reply.github.com Date: Thursday, May 7, 2020 at 2:17 PM To: ed-chemnitz/qmodbus qmodbus@noreply.github.com Cc: Eric Novikoff eric@enki.cloud, Author author@noreply.github.com Subject: Re: [ed-chemnitz/qmodbus] Cannot find a serial port on Raspberry Pi (#28)

Root should be fine yes.

I've created a modified version herehttps://github.com/shiftee/qmodbus/tree/port_to_qserialportinfo which uses the official Qt library for serial port detection. It gives me a different serial port (ttyAMA0 instead of ttyS0), maybe it will help you. I think both solutions use udev anyway.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ed-chemnitz/qmodbus/issues/28#issuecomment-625474886, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKFWKBQLUIGHNIVBLQUY5ITRQMJOLANCNFSM4M2GFIAQ.