All the required USB gadget function drivers are deployed by default as modules.
root@colibri-imx6:~# ls /lib/modules/3.14.52-v2.6b2+g9ace52b/kernel/fs/configfs/
configfs.ko
root@colibri-imx6:~# ls /lib/modules/3.14.52-v2.6b2+g9ace52b/kernel/drivers/usb/gadget/
g_ether.ko g_zero.ko u_serial.ko usb_f_ecm_subset.ko usb_f_rndis.ko
g_mass_storage.ko libcomposite.ko usb_f_acm.ko usb_f_mass_storage.ko usb_f_serial.ko
g_serial.ko u_ether.ko usb_f_ecm.ko usb_f_obex.ko usb_f_ss_lb.ko
However we already deploy a systemd service called usbg which reads the gadget schema from /etc/usbg/g1.schema and at boot the modules should be automatically loaded for RNDIS and ACM class.
root@colibri-imx6:~# lsmod
Module Size Used by
usb_f_rndis 11453 2
u_ether 9159 1 usb_f_rndis
usb_f_acm 4105 2
u_serial 8499 1 usb_f_acm
libcomposite 28377 12 usb_f_acm,usb_f_rndis
configfs 20785 4 usb_f_acm,usb_f_rndis,libcomposite
galcore 207508 2
So loading of g_serial is not required as u_serial and usb_f_acm is loaded.
In case you have the service disabled or not using it with the configfs and libcomposite modules not loaded, the following should work.
modprobe configfs
modprobe libcomposite
modprobe g_serial
Directly loading the USB gadget serial driver will not work, since it has dependencies on the configfs and libcomposite modules.
root@colibri-imx6:~# modprobe g_serial
[ 18.522776] g_serial gadget: Gadget Serial v2.4
[ 18.527551] g_serial gadget: g_serial ready
You should now have the below.
root@colibri-imx6:~# ls /dev | grep -i "ttyGS"
ttyGS0
Now connecting the USB client cable to X29 on Colibri Evaluation Board gives something on below lines
root@colibri-imx6:/sys/kernel/config/usb_gadget/g1# [ 2362.316443] ci_hdrc ci_hdrc.1: remove, state 4
[ 2362.320990] usb usb2: USB disconnect, device number 1
[ 2362.332674] ci_hdrc ci_hdrc.1: USB bus 2 deregistered
[ 2362.762404] g_serial gadget: high-speed config #2: CDC ACM config
On the host PC side, one should see the corresponding ttyACM0 port.
╭─sanchayan at Sanchayan-Arch in /home/sanchayan/Toradex/toradex-imx (toradex_imx_3.14.52_1.1.0_ga-next ✚5…2)
╰─λ ls /dev | grep -i "ACM" 0 < 09:58:46
ttyACM0
One can now check simple communication between the ttyGS0 on module side and ttyACM0 on host side with echo and cat.