[Python] Python sdbus ModemManager : unable to ut the simple interface

Discussão em 'Python' iniciado por Stack, Janeiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I've gone through an issue with SDBus and it's ModemManager add-on.

    first of, the example in the github repo is working as intended :https://github.com/zhanglongqi/python-sdbus-modemmanager/blob/master/example/list_modem_sim.py

    the part where i can't wrap my head around is the "Simple Interface" of this module.

    so in the exemple referenced, if you take the "modem" variable and use modem.simple.connect() function expect a Dict[str, Tuple[str, Any]] arguments.

    as there no documentation on that part i'm trying to pass an apn and ip-type.

    in command line, i would use this line :

    mmcli -m 0 --simple-connect='apn=myapn,ip-type=ipv4v6'

    so i'm expecting that the simple.conect() would take the same.

    i've tried numerous way to pass these parameters but I always get the same error

    modem.simple.connect({'apn':('s','myapn')})

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/usr/lib/python3.12/site-packages/sdbus/dbus_proxy_sync_method.py", line 93, in __call__
    rebuilt_args = self.dbus_method._rebuild_args(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.12/site-packages/sdbus/dbus_common_elements.py", line 199, in _rebuild_args
    raise TypeError('Could not flatten the args')
    TypeError: Could not flatten the args


    This is the easiest way to reproduce is this code :

    import sdbus
    from sdbus_block.modemmanager import MM, MMModems
    sdbus.set_default_bus(sdbus.sd_bus_open_system())
    mm = MM()
    mms = MMModems()
    modem = mms.get_first()
    modem.simple.connect({'apn':('s','myapn')})


    Can someone guide me on how to pass arguments to this function ?

    Thank you in advance

    I'm dropping few information on the environnement :

    • ModemManager 1.22
    • Python 3.12
    • python3-sdbus 0.11.1
    • python3-sdbus-modemmanager 1.0.2
    • Yocto Scarthgap (6.6.23 Kernel)

    Continue reading...

Compartilhe esta Página