Using second USB port for printf logs

Hi all,

I would like to configure the second USB-port on a CubeOrange+ to be used as the output for the terminal prints that we have inside the codebase, like the printf() and then what hal console prints out. I was able to find some instructions for how to do it for serial ports like the S7 on some hardware, but I wasn’t able to understand how it would be done for a USB port.

In cube yellow hwdef.dat file I saw these define available

#STDOUT_SERIAL SD7
#STDOUT_BAUDRATE 57600

When I tried that in the CubeOrange+ hwdef.dat and compiled I wasn’t able to get anything out. What I can see that the CubeOrange has two USB ports that are visible on the ubuntu machine that I have connected to the cube using usb-cable and that the printf debug logs are coming to the first one, which according to cube orange+ hwdef.dat file is determined as OTG1 and as the first entry on the SERIAL_ORDER define.

SERIAL_ORDER OTG1 USART2 USART3 UART4 UART8 UART7 OTG2

So my question is that how I could map that OTG2 that is defined in the hwdef.dat to be used as the output for the terminal prints, so that I could receive them on my ubuntu machine?
SERIAL_ORDER OTG1 USART2 USART3 UART4 UART8 UART7 OTG2