Making the USB port a CDC Serial Port

I'm using OpenWRT on some HLK-7688A modules from Hi-Link.
They are working great. I'm not using them as a router, but as a generic embedded linux module with wifi and ethernet.

The module has a USB port which I am not using at the moment.
I would like to use the USB port as a CDC (Serial) device - but I'm not sure what to select / configure in the build to make this happen.

In "menuconfig" I see kenrnel modules for USB support, and I see "kmod-usb-serial" but I think that it to allow the kernel to detect and use Serial devices plugged into the port, rather than making the port a serial device.

Can anyone advise me on how to make this unused USB port become a CDC Device?
Thanks in advance!

That's not how it works. A USB port only runs as USB, that is all the hardware is capable of. You would need a serial converter plugged into it, and a driver for that converter.

@mk24 Thanks Mike.
I guess that makes sense - just wondered if it was possible to make the USB port behave like an embedded CDC device - a bit like g_serial from here: https://www.kernel.org/doc/Documentation/usb/gadget_serial.txt

It's a USB host port according to Hi-Link's page. But you need a USB device port if you want to connect a computer to the port.

http://hlktech.net/product_detail.php?ProId=69

Google cp2102

Becareful of voltages,
classic com 5v
TTL 3.3v
on some new QCA boards 1.x volts

TTL is 5 V
CMOS typically 3.3V

Edit:

https://learn.sparkfun.com/tutorials/logic-levels/all

If you must insist....good luck searching aliexpress.... :sweat_smile:

Just search serial and 3.3v

Or even better

USB to Serial 3.3V UART

To do what you want here you need to convert the port as USB guest device, and then you can use "usb gadgets" type drivers like CDC or virtual ethernet or whatever.

USB ports on devices that support this feature can be switched to "guest mode" or "host mode" with a pull up resistor or a bootloader setting.

Ask Hilink about documentation to reconfigure that port.