Able to set GUIDED mode, unable to ARM despite arming checks apparently done (log supplied)

I am trying to control the SITL drone using my C Mavlink program.

I have a serial passthrough setup with socat:

user@pc:~$ socat -d -d pty,raw,echo=0,b57600 pty,raw,echo=0,b57600
2021/12/07 17:54:14 socat[17144] N PTY is /dev/pts/3
2021/12/07 17:54:14 socat[17144] N PTY is /dev/pts/6
2021/12/07 17:54:14 socat[17144] N starting data transfer loop with FDs [5,5] and [7,7]

I have SITL running as follows:

python3 Tools/autotest/ -v ArduCopter -f quad -L KSFO --console --map -A "--serial2=uart:/dev/pts/3"

SIM_VEHICLE: Using defaults from (/home/user/ardupilot/Tools/autotest/default_params/copter.parm)
SIM_VEHICLE: Run ArduCopter
SIM_VEHICLE: "/home/user/ardupilot/Tools/autotest/" "ArduCopter" "/home/user/ardupilot/build/sitl/bin/arducopter" "-S" "--model" "+" "--speedup" "1" "--slave" "0" "--serial2=uart:/dev/pts/3" "--defaults" "/home/user/ardupilot/Tools/autotest/default_params/copter.parm" "-I0" "--home" "37.619373,-122.376637,5.3,118.0"
SIM_VEHICLE: "" "--out" "" "--out" "" "--master" "tcp:" "--sitl" "" "--map" "--console"
RiTW: Starting ArduCopter : /home/user/ardupilot/build/sitl/bin/arducopter -S --model + --speedup 1 --slave 0 --serial2=uart:/dev/pts/3 --defaults /home/user/ardupilot/Tools/autotest/default_params/copter.parm -I0 --home 37.619373,-122.376637,5.3,118.0
Connect tcp: source_system=255
Loaded module console
Loaded module map
Log Directory: 
Telemetry log: mav.tlog
Waiting for heartbeat from tcp:
MAV> STABILIZE> Received 1283 parameters (ftp)
Saved 1283 parameters to mav.parm


My program sees the initial flight mode of STABILIZE and then sets the mode to GUIDED and observes the successful change to GUIDED received back from the virtual drone. The problem is, when I then try to arm the drone, I get back MAV_RESULT_FAILED.

log_2_2021-12-7-17-58-15.bin (570.5 KB)

Please can anyone more experienced than I see why this is not working? As a side note, I have no problems doing this on a real drone. Thanks.

I now have this working over a local UDP connection, however I would have preferred to test with a serial link.

My current theory is that socat is buffering data so as soon as my C program connects to the pseudo ts, it gets spammed with the buffered data.