The first USB over serial device like a Pixhawk is /dev/ttyACM0 on Linux and then the numbers increase. You can also find it at /dev/serial/by-id/... usually.
In the other direction, for NuttX it’s a bit more complicated. @dagar is there a table anywhere which describes the mapping for Pixhawk 4?