Code Monkey home page Code Monkey logo

modemmanager's Introduction

ModemManager.
The problem ModemManager tries to solve is to provide a unified high level API
for communicating with (mobile broadband) modems. While the basic commands are
standardized, the more advanced operations (like signal quality monitoring 
while connected) varies a lot.

Using.
ModemManager is a system daemon and is not meant to be used directly from
the command line. However, since it provides DBus API, it is possible to use
'dbus-send' command to control it from the terminal. There's an example
program (tests/mm-test.py) that demonstrates the basic API usage.

Implementation.
ModemManager is a DBus system bus activated service (meaning it's started 
automatically when a request arrives). It is written in C. The devices are
queried from udev and automatically updated based on hardware events. There's
a GInterface (MMModem) that defines the modem interface and any device specific
implementation must implement it. There are two generic MMModem implementations
to support the basic operations (one for GSM, one for CDMA,) which are common
for all cards.

Plugins.
Plugins are loaded on startup, and must implement the MMPlugin interface. It
consists of a couple of methods which tell the daemon whether the plugin
supports a port and to create custom MMModem implementations. It most likely
makes sense to derive custom modem implementations from one of the generic
classes and just add (or override) operations which are not standard. There's a
fully working plugin in the plugins/ directory for Huawei cards that can be
used as an example for writing new plugins. Writing new plugins is highly
encouraged!

API.
The API is open for changes, so if you're writing a plugin and need to add or
change some public method, feel free to suggest it!

modemmanager's People

Contributors

agx avatar alphix avatar andrewbird avatar antonblanchard avatar cbchan avatar cristatus avatar crosser avatar curlybeast avatar dcbw avatar duffolonious avatar eshienbrood avatar kwarek avatar martinpitt avatar mbiebl avatar mispozta avatar mkotsbak avatar nf2 avatar noeljb avatar tambeti avatar tcgoetz avatar toabctl avatar toreanderson avatar vgimly avatar vuntz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

modemmanager's Issues

using mmlib-glib in C to access a cellular modem

Hello,

I am having issues initiating a GDBusConnection to a cellular modem device located at /dev/cdc-wdm0. I have attempted declaring a GFile and opening it against that path, then initializing a GIOFileStream with that file. After that I am passing that GFileIOstream into a GDBusConnection that I can use to initialize a MMManager object, however the call to g_dbus_connection_new_sync seems to be hanging forever. Furthermore if i end the program i notice the modem is no longer visible when pinging it from modemmanage commadn line via mmcli --modem=0.

I have posted code below as well as output from modemmanager containing info on the modem. Thanks

#include <libmm-glib.h>
#include <gio/gio.h>
//#include <gtk/gtk.h>
#include <stdio.h>
#include <stdbool.h>




GDBusConnection *pConnection;


int main (void)
{
    printf("begin\n");

    GCancellable                     *cancellable;
    GError                           *pError;
    MMManager                        *pManager;
    GDBusAuthObserver                *observer = NULL;
    const gchar                      *guid     = NULL; 
    const gchar                      *pErrMsg  = "error"; 


    pError = g_error_new_literal(G_FILE_ERROR,
                                 G_FILE_ERROR_NOENT,
                                 pErrMsg);

    GFile * pFile = g_file_new_for_path("/dev/cdc-wdm0");



    if(pFile == NULL)
    {
        printf("null GFile\n");
    }    
    else
    {
        printf("GFile OK\n");

    }

    GFileIOStream *pStream = g_file_open_readwrite(pFile, NULL, NULL);


    if(pStream == NULL)
    {
        printf("null pStream\n");
    }    
    else
    {
        printf("pStream OK\n");
    }
   

    GDBusObjectManagerClientFlags objflags = G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT;



    pConnection= g_dbus_connection_new_sync(pStream,
                                            guid, // for authent. as a server
                                            objflags,
                                            observer,
                                            NULL, // cancellable,
                                            NULL);



    if(pConnection == NULL)
    {
        printf("null GDBusConnection(%s)\n",
        pError->message);
    }

    pManager = mm_manager_new_sync(pConnection,
					  objflags,
					  cancellable,
					  &pError);

    if(pManager == NULL)
    {
        printf("null pManager\n");
    }

    mm_manager_scan_devices_sync(pManager,
				 cancellable,
				 &pError);

    MMObject modem;

    printf("d\n");
    //const gchar* pChar = mm_object_get_path(&modem);

    //free resources here
    g_error_free(pError);

    printf("end\n");
    return(0);
}

Below is the output from modemmanager mmcli --modem=0

 ----------------------------------
  General  |                   path: /org/freedesktop/ModemManager1/Modem/0
           |              device id: 
  ----------------------------------
  Hardware |           manufacturer: Telit
           |                  model: LE910C4-NF
           |      firmware revision: 25.21.660  1  [Mar 04 2021 12:00:00]
           |         carrier config: default
           |           h/w revision: 1.30
           |              supported: gsm-umts, lte
           |                current: gsm-umts, lte
           |           equipment id: 0
  ----------------------------------
  System   |                 device: /sys/devices/platform/soc@0/32c00000.bus/32e50000.usb/ci_hdrc.1/usb1/1-1/1-1.2
           |                drivers: qmi_wwan, option
           |                 plugin: telit
           |           primary port: cdc-wdm0
           |                  ports: cdc-wdm0 (qmi), ttyUSB0 (ignored), ttyUSB1 (gps),
           |                         ttyUSB4 (ignored), wwan0 (net)
  ----------------------------------
  Status   |                   lock: sim-pin2
           |         unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (10), sim-puk2 (10)
           |                  state: connected
           |            power state: on
           |            access tech: lte
           |         signal quality: 75% (cached)
  ----------------------------------
  Modes    |              supported: allowed: 3g; preferred: none
           |                         allowed: 4g; preferred: none
           |                         allowed: 3g, 4g; preferred: 4g
           |                         allowed: 3g, 4g; preferred: 3g
           |                current: allowed: 3g, 4g; preferred: 4g
  ----------------------------------
  Bands    |              supported: utran-4, utran-5, utran-2, eutran-2, eutran-4, eutran-5,
           |                         eutran-12, eutran-13, eutran-14, eutran-66, eutran-71
           |                current: utran-4, utran-5, utran-2, eutran-2, eutran-4, eutran-5,
           |                         eutran-12, eutran-13, eutran-14, eutran-66, eutran-71
  ----------------------------------
  IP       |              supported: ipv4, ipv6, ipv4v6
  ----------------------------------
  3GPP     |                   imei: 3
           |          enabled locks: fixed-dialing
           |            operator id: 311480
           |          operator name: VZW
           |           registration: home
  ----------------------------------
  3GPP EPS |    initial bearer path: /org/freedesktop/ModemManager1/Bearer/0
           |     initial bearer apn: super
           | initial bearer ip type: ipv4
  ----------------------------------
  SIM      |       primary sim path: /org/freedesktop/ModemManager1/SIM/0
           |         sim slot paths: slot 1: /org/freedesktop/ModemManager1/SIM/0 (active)
           |                         slot 2: none
  ----------------------------------
  Bearer   |                  paths: /org/freedesktop/ModemManager1/Bearer/2
           |                         /org/freedesktop/ModemManager1/Bearer/1

Thank you

No AT port available to run

Hello,

I have a modem, I am trying to talk to via AT Commands. I have printout information from mmcli showing modem information. I have started modemManager service with --debug argument, yet when I try to issue AT Commands I get the error "No AT port available to run". Can someone provide some feedback on how to further understand and debug this issue?


General | path: /org/freedesktop/ModemManager1/Modem/0
| device id:

Hardware | manufacturer: Telit
| model: LE910C4-NF
| firmware revision: 25.21.660 1 [Mar 04 2021 12:00:00]
| carrier config: default
| h/w revision: 1.30
| supported: gsm-umts, lte
| current: gsm-umts, lte
| equipment id:

System | device: /sys/devices/platform/soc@0/32c00000.bus/32e50000.usb/ci_hdrc.1/usb1/1-1/1-1.2
| drivers: qmi_wwan, option
| plugin: telit
| primary port: cdc-wdm0
| ports: cdc-wdm0 (qmi), ttyUSB0 (ignored), ttyUSB1 (gps),
| ttyUSB4 (ignored), wwan0 (net)

Status | lock: sim-pin2
| unlock retries: sim-pin (3), sim-puk (10), sim-pin2 (10), sim-puk2 (10)
| state: enabled
| power state: on
| access tech: lte
| signal quality: 59% (cached)

Modes | supported: allowed: 3g; preferred: none
| allowed: 4g; preferred: none
| allowed: 3g, 4g; preferred: 4g
| allowed: 3g, 4g; preferred: 3g
| current: allowed: 3g, 4g; preferred: 4g

Bands | supported: utran-4, utran-5, utran-2, eutran-2, eutran-4, eutran-5,
| eutran-12, eutran-13, eutran-14, eutran-66, eutran-71
| current: utran-4, utran-5, utran-2, eutran-2, eutran-4, eutran-5,
| eutran-12, eutran-13, eutran-14, eutran-66, eutran-71

IP | supported: ipv4, ipv6, ipv4v6

3GPP | imei:
| enabled locks: fixed-dialing
| operator id:
| registration: idle

3GPP EPS | initial bearer apn: super
| initial bearer ip type: ipv4

SIM | primary sim path: /org/freedesktop/ModemManager1/SIM/0
| sim slot paths: slot 1: /org/freedesktop/ModemManager1/SIM/0 (active)
| slot 2: none

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.