ardupilot icon indicating copy to clipboard operation
ardupilot copied to clipboard

AP_Frsky_Telem: avoid use if int16-t read call

Open peterbarker opened this issue 1 year ago • 3 comments

Tested in SITL with gdb

peterbarker avatar Jun 27 '24 08:06 peterbarker

The number of characters is checked above, is it actually possible for the read to fail here? If so that’s certainly a gotcha that needs to be documented.

tpwrules avatar Jun 27 '24 14:06 tpwrules

The number of characters is checked above, is it actually possible for the read to fail here? If so that’s certainly a gotcha that needs to be documented.

Technically yes, but you really have to work at it and/or do silly things. e.g. read from the same port in a higher-priority thread (you might be able to arrange it using mavlink-passthrough, for example). There's no technical mutex against multiple consumers on a serial port, 'though we do have protections floating around for various scenarios (e.g. that pass-through support)

Still, as I've done in https://github.com/ArduPilot/ardupilot/pull/27397/files , you can close that hole and avoid problems revolving around that int16_t return value at the same time...

peterbarker avatar Jun 28 '24 01:06 peterbarker

Multiple consumers on a port is definitely a little scary... What do you mean by mavlink passthrough?

tpwrules avatar Jun 28 '24 01:06 tpwrules