question

tdupas avatar image
tdupas asked

ttyUSBx access flow / concurrency control

Apologies if this is a duplicate, tried the search but nothing came up :-).

I'm seeking for guidance on how the ttyUSB port access are governed.
On a vanilla carbo GX I tried some usb UART integration scripts, but ran in some concurrency issues, ranging from "port already in use" to "something else on the cerbo gx is sending payloads the channel messing with the data"


Initially I went with a bazooka approach and commented out some udev rules from /etc/udev/rules.d/serial-starter.rules, worked well enough for the script itself, but in this mode it couldn't find Multiplus inverters connected over VEBus, so reverted that.

There is a myriad on ttyUSB interactions I see in the process list (cgwacs, gps, vedirect, modbus-client), how do they play nice amongst eachother, are there some rules to follow? Ability to disable some services if you know you don't need them?

I see for example modus-client sending a mix of RS485 payloads to detect smappee and other devices initially over those ports (but I think it gives up after a few attempts); is it the expectation that at the beginning there might be a ton of different detection attempts on the USB port and it settles down afterwards?

cerbo gx
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

1 Answer
bathnm avatar image
bathnm answered ·

@tdupas take a look at this document which takes about adding a driver to VenusOS. There is discussions and details in the document about how VenusOS uses and controls serial interfaces and attaches drivers to a serial interface through auto detection.

What you are seeing in terms of mix of RS485 payloads is the system autodetecting what is on a serial interface.

1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

tdupas avatar image tdupas commented ·
Thanks, that's exactly what I was searching for
0 Likes 0 ·