The error
failure: device is busy, check /port
is correct. The last command of the script enables the gps to use the serial port which fails as it is already in use for remote access. This is the trigger/bug that internally connects the GPS to serial0. Then connecting to the port specified for remote access gets you the GPS data.
I have only tested this running RouterOS 7.5. No idea if this will work on v6.
After some testing this morning I noticed that sometimes the scheduler executes the script very early in the boot sequence. I inserted a 30 second delay to let the LtAP settle. I also updated the script to log when it's running and cycle the gps port before enabling. There is no error message now as it is executed in a do/on-error block.
add comment="Prepare the GPS for access via remote access" dont-require-permissions=no name=enable-gps-for-remote-access owner=gregw policy=read,write source="{\r\
\n\r\
\n:log info (\"Starting remote GPS hack\");\r\
\n\r\
\n:local remoteport \"10000\";\r\
\n:local remoteprotocol \"raw\";\r\
\n\r\
\n# Turn off access to the serial0 port\r\
\n/system/console/set [find where port=serial0] disabled=yes;\r\
\n/port/remote-access/remove [find where port=serial0];\r\
\n/system/gps/set enabled=no port=serial0;\r\
\n\r\
\n# setup remote access\r\
\n/port/remote-access/add port=serial0 protocol=\$remoteprotocol tcp-port=\$remoteport;\r\
\n\r\
\n# Get GPS output on serial0 so that it can be accessed by remote-access\r\
\n#\r\
\n# this will fail but output to usb2 seems to \"trigger\" the GPS output\r\
\n# put back to serial0 afterwards.\r\
\n/system/gps/set port=usb2;\r\
\n:delay 1000ms;\r\
\n/system/gps/set port=serial0;\r\
\n:delay 1000ms;\r\
\n:do {\r\
\n /system/gps/set enabled=yes port=serial0;\r\
\n} on-error={\r\
\n : log info (\"triggering gps hack\");\r\
\n}\r\
\n\r\
\n:log info (\"Finished remote GPS hack\");\r\
\n}\r\
\n"
/system scheduler {
add name=remote-access-to-gps on-event=":delay 30s; /system/script/run enable-gps-for-remote-access;" \
policy=read,write,policy start-time=startup
}
/system routerboard mode-button {
set enabled=yes on-event="/system/script/run enable-gps-for-remote-access;"
}