6ul USB OTG: Difference between revisions

From embeddedTS Manuals
(Created page with "Depending on which baseboard the TS-4100 is used with, the OTG port may be usable as host, or it may be brought out to a MicroAB port allowing it to be host or device. Severa...")
 
m (Links auto-updated for 2022 re-branding ( https://github.com/embeddedarm/linux-4.9.y/blob/master/Documentation/usb/linux.inf →‎ https://github.com/embeddedTS/linux-4.9.y/blob/master/Documentation/usb/linux.inf https://github.com/embeddedarm/linux-4.9.y/blob/master/Documentation/usb/linux-cdc-acm.inf →‎ https://github.com/embeddedTS/linux-4.9.y/blob/master/Documentation/usb/linux-cdc-acm.inf))
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
Depending on which baseboard the TS-4100 is used with, the OTG port may be usable as host, or it may be brought out to a MicroAB port allowing it to be host or device. Several devices are compiled into the default kernel. Additional devices can be compiled into the kernel by following the section [[#Compile_the_Kernel|here]].
The platform includes a single USB OTG port. The default kernel build includes several device profiles. Additional devices can be [[#Compile_the_Kernel|compiled into the kernel]]. Some device usage examples are outlined below.


''' USB Serial '''
''' USB Serial '''
Line 6: Line 6:
</source>
</source>


This will create a /dev/ttyGS0.  See the kernel documentation for more information:
This will create a "/dev/ttyGS0" device on the platform itself. The host PC connected to it will appear as a CDC-ACM device.  See the kernel documentation for more information:
* [https://www.kernel.org/doc/Documentation/usb/gadget_serial.txt USB Gadget Serial documentation]
* [https://www.kernel.org/doc/Documentation/usb/gadget_serial.txt USB Gadget Serial documentation]
* [https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/usb/linux-cdc-acm.inf Windows CDC-ACM INF file]
* [https://github.com/embeddedTS/linux-4.9.y/blob/master/Documentation/usb/linux-cdc-acm.inf Windows CDC-ACM INF file]


''' USB Ethernet '''
''' USB Ethernet '''
Line 15: Line 15:
</source>
</source>


This provides a usb0 network interface which simulates an ethernet network connection between the host pc and the i.MX6.
This provides a "usb0" network interface device to both the platform and the host PC which simulates an ethernet network connection between them. IP addresses can be statically assigned, or either computer can run its own DHCP server.


* [https://github.com/embeddedarm/linux-3.10.17-imx6/blob/master/Documentation/usb/linux.inf Windows driver inf]
* [https://github.com/embeddedTS/linux-4.9.y/blob/master/Documentation/usb/linux.inf Windows RNDIS INF file]


''' Mass Storage '''
''' Mass Storage '''
Line 23: Line 23:
modprobe g_mass_storage file=/dev/mmcblk0
modprobe g_mass_storage file=/dev/mmcblk0
</source>
</source>
This will present the SD card to the host pc connected to the USB port. Eg:
This will present the SD card to the host PC connected to the USB port. Example of connection to a host PC:
<pre>
<pre>
[85421.087855] scsi 4:0:0:0: Direct-Access    Linux    File-Stor Gadget 0401 PQ: 0 ANSI: 2
[85421.087855] scsi 4:0:0:0: Direct-Access    Linux    File-Stor Gadget 0401 PQ: 0 ANSI: 2
Line 34: Line 34:
[85421.746283] sd 4:0:0:0: [sdc] Attached SCSI disk
[85421.746283] sd 4:0:0:0: [sdc] Attached SCSI disk
</pre>
</pre>
With "g_mass_storage" whole disks can be exposed, partitions, or even just files on a disk. Note that it is generally not safe to export a mounted disk in this way.

Latest revision as of 16:25, 17 January 2022

The platform includes a single USB OTG port. The default kernel build includes several device profiles. Additional devices can be compiled into the kernel. Some device usage examples are outlined below.

USB Serial

modprobe g_serial use_acm=1

This will create a "/dev/ttyGS0" device on the platform itself. The host PC connected to it will appear as a CDC-ACM device. See the kernel documentation for more information:

USB Ethernet

modprobe g_ether

This provides a "usb0" network interface device to both the platform and the host PC which simulates an ethernet network connection between them. IP addresses can be statically assigned, or either computer can run its own DHCP server.

Mass Storage

modprobe g_mass_storage file=/dev/mmcblk0

This will present the SD card to the host PC connected to the USB port. Example of connection to a host PC:

[85421.087855] scsi 4:0:0:0: Direct-Access     Linux    File-Stor Gadget 0401 PQ: 0 ANSI: 2
[85421.088486] sd 4:0:0:0: Attached scsi generic sg2 type 0
[85421.089546] sd 4:0:0:0: [sdc] 31116288 512-byte logical blocks: (15.9 GB/14.8 GiB)
[85421.196213] sd 4:0:0:0: [sdc] Write Protect is off
[85421.196218] sd 4:0:0:0: [sdc] Mode Sense: 0f 00 00 00
[85421.306216] sd 4:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[85421.530556]  sdc: sdc1
[85421.746283] sd 4:0:0:0: [sdc] Attached SCSI disk

With "g_mass_storage" whole disks can be exposed, partitions, or even just files on a disk. Note that it is generally not safe to export a mounted disk in this way.