嵌入式 Linux 上带有调制解调器管理器和网络管理器的 USB 调制解调器 (yocto dunfell)

嵌入式 Linux 上带有调制解调器管理器和网络管理器的 USB 调制解调器 (yocto dunfell)

我正在尝试让 USB 调制解调器在我的嵌入式系统上工作,该系统使用 Yocto Dunfell 的 Linux 以及 ModemManager 和 NetworkManager。

如下所示,我可以连接网络上的调制解调器,但无法创建连接并打开界面。

以下是不同命令的输出:

root@rpi-cm3:/# mmcli -L
    /org/freedesktop/ModemManager1/Modem/2 [Telit] LE910-EU V2
root@rpi-cm3:/# mmcli -m 2
  --------------------------------
  General  |            dbus path: /org/freedesktop/ModemManager1/Modem/2
           |            device id: d522cda0f436245296a7a9e47c981e9601af3bc7
  --------------------------------
  Hardware |         manufacturer: Telit
           |                model: LE910-EU V2
           |    firmware revision: 20.00.402
           |            supported: gsm-umts, lte
           |              current: gsm-umts, lte
           |         equipment id: 351622072422039
  --------------------------------
  System   |               device: /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5
           |              drivers: cdc_acm, cdc_ncm
           |               plugin: Telit
           |         primary port: ttyACM0
           |                ports: ttyACM1 (unknown), ttyACM3 (at), ttyACM5 (unknown), 
           |                       wwan0 (net), ttyACM0 (at), ttyACM4 (unknown), ttyACM2 (unknown)
  --------------------------------
  Status   |                state: registered
           |          power state: on
           |          access tech: umts
           |       signal quality: 57% (recent)
  --------------------------------
  Modes    |            supported: allowed: 2g; preferred: none
           |                       allowed: 3g; preferred: none
           |                       allowed: 2g, 3g; preferred: none
           |                       allowed: 4g; preferred: none
           |                       allowed: 2g, 4g; preferred: none
           |                       allowed: 3g, 4g; preferred: none
           |                       allowed: 2g, 3g, 4g; preferred: none
           |              current: allowed: 2g, 3g, 4g; preferred: none
  --------------------------------
  Bands    |            supported: egsm, dcs, utran-1, utran-8, eutran-1, eutran-3, eutran-7, 
           |                       eutran-8, eutran-20
           |              current: egsm, dcs, utran-1, eutran-1
  --------------------------------
  IP       |            supported: ipv4, ipv6, ipv4v6
  --------------------------------
  3GPP     |                 imei: 351622072422039
           |         registration: home
  --------------------------------
  3GPP EPS | ue mode of operation: csps-2
  --------------------------------
  SIM      |            dbus path: /org/freedesktop/ModemManager1/SIM/2
  --------------------------------
  Bearer   |            dbus path: /org/freedesktop/ModemManager1/Bearer/1
root@rpi-cm3:/# mmcli -b 1
  ------------------------
  General    |  dbus path: /org/freedesktop/ModemManager1/Bearer/1
             |       type: default
  ------------------------
  Status     |  connected: no
             |  suspended: no
             | ip timeout: 20
  ------------------------
  Properties |        apn: gprs.swisscom.ch
             |    roaming: allowed
root@rpi-cm3:/# nmcli device show
GENERAL.DEVICE:                         wwan0
GENERAL.TYPE:                           wwan
GENERAL.HWADDR:                         00:00:11:12:13:14
GENERAL.MTU:                            1500
GENERAL.STATE:                          20 (unavailable)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --

GENERAL.DEVICE:                         eth0
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         B8:27:EB:F7:A1:B3
GENERAL.MTU:                            1500
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
WIRED-PROPERTIES.CARRIER:               off
IP4.GATEWAY:                            --
IP6.GATEWAY:                            --
GENERAL.DEVICE:                         lo
GENERAL.TYPE:                           loopback
GENERAL.HWADDR:                         00:00:00:00:00:00
GENERAL.MTU:                            65536
GENERAL.STATE:                          10 (unmanaged)
GENERAL.CONNECTION:                     --
GENERAL.CON-PATH:                       --
IP4.ADDRESS[1]:                         127.0.0.1/8
IP4.GATEWAY:                            --
IP6.ADDRESS[1]:                         ::1/128
IP6.GATEWAY:                            --
root@rpi-cm3:/# nmcli c show
NAME   UUID                                  TYPE  DEVICE 
modem  e7482093-2d4c-47fa-b52b-e6e282902453  gsm   --   
root@rpi-cm3:/# nmcli c up modem
Error: Connection activation failed: No suitable device found for this connection (device lo not available because device is strictly unmanaged).

我被困在这里,无法找到有关如何创建连接的信息。

奇怪的是,我无法配置 NetworkManager 自动管理 wwan 接口,我添加了以下命令来强制它:

nmcli dev set wwan0 managed yes

感谢您的帮助

此致

答案1

有趣的是,今天晚上我正在使用类似的配置(在带有 Telit LE910 NA 的基于 am335x 的嵌入式系统上使用 yocto dunfell)。我还无法让 cdc_ncm (wwan0) 上下文正常工作,但我可以使用 ppp 来启动网络

nmcli c add type gsm ifname '*' con-name {connectionname} apn {apnname}

请注意,这需要向网络管理器添加 ppp 支持,因为它是不在默认包中。为此,我们需要覆盖。

创造networkmanager_%.bbappend

# Based on https://github.com/digi-embedded/meta-digi/blob/morty/meta-digi-dey/recipes-connectivity/networkmanager/networkmanager_%25.bbappend

FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"

SRC_URI += " \
    file://att.nmconnection \
"

# Adjust other compile time options
PACKAGECONFIG_append = " gnutls modemmanager ppp"

do_install_append() {
    install -m 0600 ${WORKDIR}/att.nmconnection ${D}${sysconfdir}/NetworkManager/system-connections/
}

然后将您的连接信息放入例如att.nmconnection。将 uuid 替换为新的 uuid,然后输入您的 apn 名称。

[connection]
id=att
uuid=88cd70ea-6501-11eb-ae93-0242ac130002
type=gsm
permissions=
autoconnect=true

[gsm]
apn=NXTGENPHONE

[ipv4]
dns-search=
method=auto

[proxy]

如果调制解调器在启动时可见,则应通过 ppp 自动连接。

ifconfig ppp0
ppp0      Link encap:Point-to-Point Protocol  
          inet addr:10.55.27.182  P-t-P:10.55.27.182  Mask:255.255.255.255
          UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1428  Metric:1
          RX packets:65110 errors:0 dropped:0 overruns:0 frame:0
          TX packets:24635 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:3 
          RX bytes:53163224 (50.7 MiB)  TX bytes:1670291 (1.5 MiB)

我也想使用 cdc_ncm 接口,但我还无法让它工作。驱动程序没问题,但它没有与调制解调器正确连接,无法从运营商处获取地址。

ifconfig wwan0
wwan0     Link encap:Ethernet  HWaddr 00:00:11:12:13:14  
          BROADCAST NOARP MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

也许我们可以一起解决这个问题。

相关内容