2022年11月3日 星期四

mmcli

Linux: Ubuntu 22.04
mmcli version: 1.18.6
ModemManager only establishes a connection between the modem and the mobile network
  • AT Command
    網路說能用mmcli下ATC, 但要開啟debug mode
    $ mmcli -L
    /org/freedesktop/ModemManager1/Modem/1 [Cinterion] Cinterion PID 0x00B3 USB Mobile Broadband
    

    Test with normal mode
    $ sudo systemctl restart ModemManager.service //make sure it's running
    
    $ mmcli -m 1 --command="at"
    error: command failed: 'GDBus.Error:org.freedesktop.ModemManager1.Error.Core.Unauthorized: Cannot send AT command to modem: operation only allowed in debug mode'
    

    Switch to Debug mode
    $ sudo ModemManager --debug
    

    Test again. Don't be sudo and must enter Upercase
    $ mmcli -m 1 --command=AT+COPS?
    response: '+COPS: 0,0,"Chunghwa Telecom",7'
    
    $ mmcli -m 1 --command=AT^SMONI
    response: '^SMONI: 4G,3050,7,20,20,FDD,466,92,2E19,3454A18,194,19,-105,-12,,NOCONN,,,7,--'
    

  • Scan
    $ mmcli -m 1 --3gpp-scan --timeout=300
      ---------------------
      3GPP scan | networks: 46601 - Far EasTone (gprs, unknown)
                |           46605 - TWN APT (gprs, unknown)
                |           46689 - T Star (gprs, unknown)
                |           46697 - TW Mobile (gprs, unknown)
                |           46692 - Chunghwa Telecom (gprs, unknown)
    

  • Prepare a transport channel with an APN name
    $ mmcli -m 0 --create-bearer='apn=XXX,ip-type=ipv4'
    

  • Simple Connect
    $ mmcli -m 0 --simple-connect='pin=0000,apn=ZZZ,ip-type=ipv4v6'
    successfully connected the modem
    
    $ sudo udhcpc -i wwan0
    

  • GNSS
    $ mmcli -m 1 --location-status
      --------------------------------
      Location |         capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
               |              enabled: 3gpp-lac-ci
               |              signals: no
      --------------------------------
      GPS      |         refresh rate: 30 seconds
               |    a-gps supl server: supl.google.com:7276
               | supported assistance: xtra
               |   assistance servers: https://path1.xtracloud.net/xtra3Mgrbeji.bin
               |                       https://path2.xtracloud.net/xtra3Mgrbeji.bin
               |                       https://path3.xtracloud.net/xtra3Mgrbeji.bin
    

  • SMS
    List
      $ sudo mmcli --modem 0 --messaging-list-sms
    
      /org/freedesktop/ModemManager1/SMS/12 (sent)
      /org/freedesktop/ModemManager1/SMS/11 (sent)
      /org/freedesktop/ModemManager1/SMS/10 (received)
      /org/freedesktop/ModemManager1/SMS/9 (received)
      /org/freedesktop/ModemManager1/SMS/8 (received)
      /org/freedesktop/ModemManager1/SMS/7 (received)
      /org/freedesktop/ModemManager1/SMS/6 (received)
      /org/freedesktop/ModemManager1/SMS/5 (received)
      /org/freedesktop/ModemManager1/SMS/4 (received)
      /org/freedesktop/ModemManager1/SMS/3 (received)
      /org/freedesktop/ModemManager1/SMS/2 (received)
      /org/freedesktop/ModemManager1/SMS/1 (received)
      /org/freedesktop/ModemManager1/SMS/0 (received)
    

    Read
      $ sudo mmcli --modem 0 --sms 1
      -----------------------
      General    |      path: /org/freedesktop/ModemManager1/SMS/1
      -----------------------
      Content    |    number: 0911223344
                 |      text: Good morning III
      -----------------------
      Properties |  pdu type: deliver
                 |     state: received
                 |   storage: mt
                 |      smsc: +886933445566
                 | timestamp: 20XX-YY-06T09:49:59+08:00
    

    Send
    最後沒成功送出,可能是公司sim card問題@@
      $ sudo mmcli -m 0 --messaging-create-sms="text='Hello world',number='+866911223344'"
    Successfully created new SMS: /org/freedesktop/ModemManager1/SMS/11
    
    $ sudo mmcli -s 11 --send -v
    [06 Jun 2023, 10:32:55] [Debug] Assuming '11' is the SMS index
    [06 Jun 2023, 10:32:55] [Debug] ModemManager process found at ':1.151'
    [06 Jun 2023, 10:32:55] [Debug] SMS found at '/org/freedesktop/ModemManager1/SMS/11'
    
    successfully sent the SMS
    


    $ sudo mmcli -m 0 --messaging-create-sms="text='Hello world',number='+866911223344'"
    最後沒成功送出,可能是公司sim card問題@@
      $ sudo mmcli -m 0 --messaging-create-sms="text='Hello world',number='+866911223344'"
    Successfully created new SMS: /org/freedesktop/ModemManager1/SMS/11
    
    $ sudo mmcli -s 11 --send -v
    [06 Jun 2023, 10:32:55] [Debug] Assuming '11' is the SMS index
    [06 Jun 2023, 10:32:55] [Debug] ModemManager process found at ':1.151'
    [06 Jun 2023, 10:32:55] [Debug] SMS found at '/org/freedesktop/ModemManager1/SMS/11'
    
    successfully sent the SMS
    


ref:
1.使用 Quectel RM500-GL 5G 數據機,透過 5G 或 LTE 連線 Azure Percept DK
2.mmcli

沒有留言:

張貼留言