Customize Legato Yocto USB

This topic provides details on how to customize the USB behavior of the Legato Yocto distribution when working with the following Sierra Wireless devices:

  • AR755x
  • AR8652
  • WP85xx
  • WP750x

The information is based on the USB Driver Developer Guide available from the Source.

Enumeration Sequence

USB endpoints are enumerated during the boot sequence as follows:

First, the USB boot script (S41usb) starts /usr/bin/usb/boot_hsusb_composition.

This script executes the following:

IF /etc/legato/usbmode exists
THEN execute /etc/legato/usbsetup
ELSE setup default composition

The actions taken are described in the rest of this topic.

Default Endpoints

This table shows all the possible USB interfaces available on the AR7 family:

USB_interfaces_AR7.png

On AR7 products, these endpoints are grouped into compositions. A fixed set of compositions is shown in the table below. You switch between these compositions using the AT!UDUSBCOMP command with this format:

AT!UDUSBCOMP=<Composition>

Where <Composition> is one of the composition numbers defined in this table (composition 2 is default):

USB_endpointCompositions_AR7.png

USB composition on WP75 and WP85 modules is set through the AT!USBCOMP command with this format:

AT!USBCOMP=<Config Index>,<Config Type>,<Interface Bitmask>

Where:

<Config Index> Configuration index to which the composition applies (valid value: 1)

<Config Type> Configuration type (valid value: 1 -- Generic)

<Interface Bitmask> Bit field defining which interfaces/endpoints are enabled. To obtain a list of possible compositions for your target device, use AT!USBCOMP=?.

Use AT!USBCOMP? to retrieve the current USB composition.

The response format should be:

at!usbcomp?
Config Index: 1
Config Type: 1 (Generic)
Interface bitmask: 0008011E (adb,nmea,modem,at,rmnet0,ecm)

Customize Endpoints

If none of the provided compositions meet your needs, it's possible to override the USB configuration using a mechanism built into Legato. These are the steps:

  • create or edit a usbmode file in the /etc/legato folder.
  • add one interface configuration per line
  • save the file and reboot.

A sample file called usbmode.ex is provided in /etc/legato in the default Legato distribution with a list of sample endpoints, like this:

ecm
acm
nmea

This is the full list of supported modes:

Name Interface Type Description Target endpoint Sample host endpoint
ecm CDC-ECM Providing an IP connection over USB NIC usb0 or ecm0 NIC (eg enp0s20u6i22)
eem CDC-EEM Providing an IP connection over USB NIC usb0 or ecm0 NIC (eg enp0s20u6i22)
acm CDC-ACM Providing an AT command port N/A /dev/ttyACM0
nmea serial NMEA strings when positioning is enabled N/A /dev/ttyUSB0
audio USB audio Expose the target as a sound card N/A pcmC2D0c
pcmC2D0p
serial serial A serial interface to the embedded Linux /dev/ttyGS0 /dev/ttyUSB0