Changes between Version 11 and Version 12 of linux/OTG


Ignore:
Timestamp:
06/13/2025 06:39:01 PM (4 days ago)
Author:
Tim Harvey
Comment:

added additional documentation for USB CDC ADM gadget

Legend:

Unmodified
Added
Removed
Modified
  • linux/OTG

    v11 v12  
    9898
    9999[=#g_serial]
    100 === g_serial - Serial Device Gadget ===
     100=== g_serial - Serial Device Gadget
    101101The Serial Gadget supports CDC-ACM and CDC-OBEX which can inter-operate with the MS-Windows hosts or with Linux hosts using the 'cdc-acm' driver to create a 'USB-to-Serial' connection.
    102102
     103On the target a serial device will be created as {{{/dev/ttyGS0}}} (or the next avaialble ttyGS device).
     104
     105On a host device (ie PC) a USB CDC ACM device (VID:PID 0525:a4a7 by default) will appear and behave as a serial device. Module parameters can specify the VID, PID, device version, manufacturer string, product string, serialnumber and whether or not to use CDC ACM, CDC OBEX, and the number of ports to create.
     106
     107A Linux USB Host supports this with the {{{cdc_acm}}} driver which will create a {{{/dev/ttyACM0}}} device (or the next available ttyACM).
     108
     109To use the Windows ACM driver you must have the "linux-cdc-acm.inf"
     110file which supports all recent versions: see ​https://www.kernel.org/doc/Documentation/usb/gadget_serial.txt
     111
    103112Example:
    104113 * on target device (Gateworks board with OTG controller):
     
    106115modprobe g_serial
    107116}}}
    108  * on host device (ie PC) a USB CDC ACM device (VID:PID 0525:a4a7 by default) will appear and behave as a serial device
    109  * module parameters can specify the VID, PID, device version,
    110 manufacturer string, product string, serialnumber
    111  * module parameters can specify whether or not to use CDC ACM, CDC OBEX, and the number of ports to create
    112 
    113 Linux USB Host notes:
    114  * the cdc_acm driver will enumerate this device as '/dev/ttyACM<n>'
    115 
    116 Windows USB Host notes:
    117  * see ​https://www.kernel.org/doc/Documentation/usb/gadget_serial.txt
     117
     118You can allow logins via the {{{/dev/ttyGS0}}} device on the target by running a {{{getty}}} process. For example:
     119 * Configure Ubuntu for console login:
     120{{{#!bash
     121# Add g_serial to modules.conf so that its loaded on bootup:
     122echo g_serial >> /etc/modules-load.d/modules.conf
     123# create a systemd service for ttyGS0 by enabling a getty instance
     124sudo systemctl enable getty@ttyGS0.service
     125# (optional) edit systemd to modify ExecStart if you want to add/edit params to the getty process
     126sudo systemctl edit getty@ttyGS0.service
     127# start the getty service
     128sudo systemctl start getty@ttyGS0.serivce
     129}}}
     130  - if you wish the device to be available earlier in the boot you would have to configure it static via CONFIG_USB_G_SERIAL=y and add /dev/ttyGS0 to the console kernel cmdline parameter.
     131
     132If you want to use a USB ACM serial console in U-Boot see [https://trac.gateworks.com/wiki/uboot#USBCDCACMSerialGadget here].
    118133
    119134Reference:
    120135 * ​https://www.kernel.org/doc/Documentation/usb/gadget_serial.txt
    121 
    122136
    123137[=#g_cdc]