4G WWAN device type

WWAN device type

USB dongle is one of the important ways for devices to access the Internet. Typically, it is connected to the main device through the USB interface, and then the main device is connected to the Internet through 4G/5G. As a mobile broadband device, what types of devices and exposure methods does it have?

  1. Mobile Broadband Device Types : ModemManager is capable of interacting with almost any type of Mobile Broadband modem, as long as the device exposes at least one control port. Devices without a control port (for example, some USB dongles that only expose a network port) are not supported.

  2. How it is exposed in the system : For supported mobile broadband devices, they communicate with ModemManager through the control port, enabling them to manage and control the functions of these devices. Devices without control ports cannot be supported by ModemManager.

USB devices

The types of USB devices and how they behave in the system are as follows.

USB device type

USB devices are the most common type of device and come in very different form factors. USB dongles can be connected to a computer's physical USB port, but modules connected to miniPCIe or M.2 slots are also very common in embedded systems and laptops.

How it behaves in the system

Devices enumerated in the USB bus can expose multiple ports in the system, so there is no limit to the number of control ports or data ports. USB modems usually have multiple control ports, for example to allow different operations to run in parallel on different ports; but there are also modems with multiple data ports, for example to allow individual connections to multiple APNs without complex multiplexing setups.

USB device type port

The expected port types for this type of device are:

  • Serial ports (eg ttyUSB0, ttyACM0...).
  • Network ports (eg wwan0, usb0, eth0...).
  • QMI or MBIM control port (e.g. cdc-wdm0...).
  • WWAN subsystem QMI or MBIM control ports (eg wwan0mbim0, wwan0qmi0).

Devices that require a USB mode switch

Some USB devices start up with a non-modem USB layout by default, exposing themselves as USB disks, for example. This is common in USB dongles (such as from Huawei, ZTE, etc.) that require special drivers to be installed in the Windows OS; the dongle provides a tool to install the drivers. In Linux based systems, users want devices to work without having to install any additional drivers, and to achieve this, there are usb-modeswitchtools like this one, which are able to automatically switch the device to a valid modem USB layout without manual intervention .

Devices that support multiple USB configurations

Some devices (such as many Foxconn or Huawei modules) expose multiple USB configurations by default, each providing a different USB interface layout. For example, one configuration may include an MBIM control port and a network interface, another configuration may include an AT port and an NCM network interface, and so on. By default the kernel will expose devices in the USB configuration that best matches the common layout. For example, if a device exposes both MBIM and QMI layouts in different configurations, the kernel always prefers the MBIM layout because it is considered more general than QMI. However, sometimes this is not enough, since devices with both NCM and MBIM layouts are generic, the kernel may default to NCM over MBIM, which is actually often preferred. To address these cases, usb-modeswitchthe tool allows to automatically select the MBIM configuration regardless of whether there are other configurations in the USB device.

Supports configuration of devices with multiple layouts via the control port

Some devices (such as many Sierra Wireless modules) allow a choice of USB layout, such as adding an additional AT port to a device that originally only had a QMI and net port layout, or even switching from a QMI-based layout to an MBIM-based layout entirely.

RS232 devices


Due to the simplicity, RS232 devices are still used in some configurations, but are mostly replaced by USB modems that support exposing multiple ports through a USB connection.

Integration

RS232 devices can be integrated into the system via a physical RS232 connection or a USB to RS232 adapter, forming a single serial port ModemManagerfor control and data transfer.

RS232 Modem Setting Requirements

Different from the USB modem, the RS232 modem needs to negotiate the settings with the host in advance, such as baud rate, stop bit, etc., and a wrong configuration may cause communication failure.

expected port type

Platform serial ports (eg ttyS0...) and USB serial ports (eg ttyUSB0...).

PCI device

PCIe devices are more complex and advanced than most USB devices because they require tighter integration with the host system. This allows them to achieve higher data throughput than USB 3.0 and USB 2.0 when making connections.

Unlike USB devices, PCIe devices do not expose multiple optional configurations or layouts. The device is pre-configured in firmware with a list of channels that the kernel driver can access. While some configurability may be supported, it's relatively uncommon compared to USB devices.

These devices are the same shape as miniPCIe or M.2 USB modems, but use the PCI bus instead of the USB bus. A device that works in PCIe mode cannot work as a USB device, and vice versa. Some manufacturers allow changing the PCIe/USB mode via software (e.g. a proprietary AT command), while others allow changing the mode via hardware (e.g. changing the voltage level of an input GPIO).

PCIe devices have been integrated upstream in the Linux kernel, using the WWAN subsystem introduced in kernel version 5.13. This subsystem also allows the kernel to explicitly define the control protocol expected to be used on a port, so ModemManagerno custom port type hints are required in .

Expected port type:

  • Network port (eg wwan0)
  • AT, QMI or MBIM control port for WWAN subsystem (eg wwan0mbim0、wwan0qmi0、wwan0at0...)

Qualcomm SoCs

Qualcomm SoCs are quite different from the usual modem management situation because instead of an external device connected to the host, it is integrated in the host system and thus requires a different means of communication.

It supports modem control operations through nodes in the QRTR bus and character devices in the WWAN subsystem built on top of the rpmsg subsystem. Which method to use depends on the capabilities of the SoC; older SoCs only support rpmsg, others support both rpmsg and QRTR (but the latter is not used for modem management), and newer SoCs fully support QRTR (including modem management) .

Network interface support in Qualcomm SoCs is also somewhat different, as a given data connection needs to be explicitly bound to a specific network interface. In SoCs using the bam-dmux kernel driver, there is usually a certain number of network interfaces already in the system, whereas in setups based on newer versions of the ipa driver, new virtual network interfaces need to be instantiated when a connection is established.

Expected port type:

  • network port (for example rmnet_ipa0)
  • AT or QMI control port for the WWAN subsystem (for example wwan0qmi0, wwan0at0in the QC MSM8916)
  • Nodes accessed via QRTR bus QRTR(eg in QC 7cG3)

These control ports do not expose any character devices in /dev and are only accessible through the AF_QIPCRTR socket.

View device layout commands

usb device

  • Use the tree view of the lsusb command to quickly inspect the devices on the USB bus, including information about the interfaces available in the currently selected configuration.
$ lsusb --tree
  • Use the lsusb command to query USB device details, including all USB configurations (even if only one of them is currently selected).
$ lsusb -v -d <vid:pid>
  • Use the usb-devices command to provide information about the kernel drivers that actually manage the individual ports of the device.
$ usb-devices

PCI device

  • Use the lspci command similar to lsusb, but for PCI devices.
$ lspci -t
$ lspci -v

QRTR Compatible Devices

  • For Qualcomm devices accessed through the QRTR subsystem, several command-line tools are available in Bjorn Andersson's GitHub repository.

https://github.com/andersson/qrtr

$ qrtr-lookup

Udev device traversal

  • Run udevadm to see how udev recognizes a given port, especially handy when writing new udev rules.

  • Use sudo udevadm info -p /sys/class/<subsystem>/<name>commands to query all information about a specific device.

  • Use sudo udevadm info -a /sys/class/<subsystem>/<name>the command to query all properties of the device and its parent (if any).

These commands and tools can be used to view various types of device layouts to aid in understanding device characteristics and configurations.

おすすめ

転載: blog.csdn.net/u011897062/article/details/132060865