Qmi.Device

g GObject.GInterface GObject.GInterface Gio.AsyncInitable Gio.AsyncInitable GObject.GInterface->Gio.AsyncInitable GObject.Object GObject.Object Qmi.Device Qmi.Device GObject.Object->Qmi.Device Gio.AsyncInitable->Qmi.Device

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.AsyncInitable (4)

Structs:

GObject.ObjectClass (5)

class

new (file, cancellable, callback, *user_data)

class

new_finish (res)

class

new_from_node (node, cancellable, callback, *user_data)

class

new_from_node_finish (res)

add_link (mux_id, base_ifname, ifname_prefix, cancellable, callback, *user_data)

add_link_finish (res, mux_id)

add_link_with_flags (mux_id, base_ifname, ifname_prefix, flags, cancellable, callback, *user_data)

add_link_with_flags_finish (res, mux_id)

allocate_client (service, cid, timeout, cancellable, callback, *user_data)

allocate_client_finish (res)

check_expected_data_format_supported (format)

check_link_supported ()

close_async (timeout, cancellable, callback, *user_data)

close_finish (res)

command_abortable_finish (res)

command_full (message, message_context, timeout, cancellable, callback, *user_data)

command_full_finish (res)

delete_all_links (base_ifname, cancellable, callback, *user_data)

delete_all_links_finish (res)

delete_link (ifname, mux_id, cancellable, callback, *user_data)

delete_link_finish (res)

get_consecutive_timeouts ()

get_expected_data_format ()

get_file ()

get_node ()

get_path ()

get_path_display ()

get_service_version_info (timeout, cancellable, callback, *user_data)

get_service_version_info_finish (res)

get_wwan_iface ()

is_open ()

list_links (base_ifname)

open (flags, timeout, cancellable, callback, *user_data)

open_finish (res)

peek_file ()

peek_node ()

release_client (client, flags, timeout, cancellable, callback, *user_data)

release_client_finish (res)

set_expected_data_format (format)

set_instance_id (instance_id, timeout, cancellable, callback, *user_data)

set_instance_id_finish (res, link_id)

Virtual Methods

Inherited:

GObject.Object (7), Gio.AsyncInitable (2)

Properties

Name

Type

Flags

Short Description

device-consecutive-timeouts

int

r

Number of consecutive timeouts detected in requests sent to the device

device-file

Gio.File

r/w/co

File to the underlying QMI device

device-no-file-check

bool

w/co

Don’t check for file existence when creating the Qmi device.

device-node

Qrtr.Node

r/w/co

Remote node on the QRTR bus

device-proxy-path

str

w/co

Path of the abstract socket where the proxy is available.

device-wwan-iface

str

r

Name of the WWAN network interface associated with the control port.

Signals

Inherited:

GObject.Object (1)

Name

Short Description

device-removed

The ::device-removed signal is emitted when an unexpected port hang-up is received.

indication

The ::indication signal gets emitted when a QMI indication is received.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent

GObject.Object

r

Class Details

class Qmi.Device(**kwargs)
Bases:

GObject.Object, Gio.AsyncInitable

Abstract:

No

Structure:

Qmi.DeviceClass

The Qmi.Device structure contains private data and should only be accessed using the provided API.

New in version 1.0.

classmethod new(file, cancellable, callback, *user_data)
Parameters:

Asynchronously creates a Qmi.Device object to manage file. When the operation is finished, callback will be invoked. You can then call Qmi.Device.new_finish() to get the result of the operation.

New in version 1.0.

classmethod new_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

A newly created Qmi.Device, or None if error is set.

Return type:

Qmi.Device

Finishes an operation started with Qmi.Device.new().

New in version 1.0.

classmethod new_from_node(node, cancellable, callback, *user_data)
Parameters:

Asynchronously creates a Qmi.Device object to manage node. When the operation is finished, callback will be invoked. You can then call Qmi.Device.new_finish() to get the result of the operation.

This method is only available when the library is built with QRTR support.

New in version 1.28.

classmethod new_from_node_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

A newly created Qmi.Device, or None if error is set.

Return type:

Qmi.Device

Finishes an operation started with Qmi.Device.new_from_node().

This method is only available when the library is built with QRTR support.

New in version 1.28.

Parameters:

Asynchronously creates a new virtual network device node with a custom prefix on top of base_ifname. This allows having multiple net interfaces running on top of another using multiplexing.

If the kernel driver doesn’t allow this functionality, a Qmi.CoreError.UNSUPPORTED error will be returned.

The operation may fail if the given interface name is not associated to the QMI control port managed by the Qmi.Device.

Depending on the kernel driver in use and the multiplexing method, the given ifname_prefix may be ignored. The user should not assume that the returned link interface name is prefixed with ifname_prefix as it may not be the case.

When the operation is finished callback will be called. You can then call Qmi.Device.add_link_finish() to get the result of the operation.

When using the qmi_wwan kernel driver, the configured expected kernel data format will be used to select the type of multiplexing method. If the format is Qmi.DeviceExpectedDataFormat.RAW_IP the qmi_wwan specific add_mux/del_mux operations will be used. If the format is Qmi.DeviceExpectedDataFormat.QMAP_PASS_THROUGH, the generic rmnet netlink operations will be used. No multiplexing support exists when the format is Qmi.DeviceExpectedDataFormat._802_3.

For every other kernel driver (e.g. ipa), rmnet netlink operations are assumed to be supported.

When using the qmi_wwan driver from a kernel older than v5.12, some of the multiplexing features like using %QMI_DEVICE_MUX_ID_AUTOMATIC may not be fully available for programs that use ephimeral Qmi.Device objects for single operations.

New in version 1.28.

Parameters:
Raises:

GLib.Error

Returns:

The name of the net interface created, None if error is set.

Return type:

str

Finishes an operation started with Qmi.Device.add_link().

New in version 1.28.

Parameters:

Asynchronously creates a new virtual network device in the same way as Qmi.Device.add_link() does, but passing the additional flags to the kernel during the operation.

Using Qmi.DeviceAddLinkFlags.NONE as flags is equivalent to calling Qmi.Device.add_link() directly.

If the link creation with the given set of flags is unsupported by the backend, the operation may fail.

None of the flags supported are applicable when using the multiplexing support provided by the qmi_wwan kernel driver, they are only used if using the rmnet backend for link management support.

New in version 1.30.

Parameters:
Raises:

GLib.Error

Returns:

The name of the net interface created, None if error is set.

Return type:

str

Finishes an operation started with Qmi.Device.add_link_finish().

New in version 1.30.

allocate_client(service, cid, timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously allocates a new Qmi.Client in self.

If Qmi.CID_NONE is given in cid, a new client ID will be allocated; otherwise a client with the given cid will be generated.

When the operation is finished callback will be called. You can then call Qmi.Device.allocate_client_finish() to get the result of the operation.

Note: Clients for the Qmi.Service.CTL cannot be created with this method; instead get/peek the implicit one from self.

New in version 1.0.

allocate_client_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

a newly allocated Qmi.Client, or None if error is set.

Return type:

Qmi.Client

Finishes an operation started with Qmi.Device.allocate_client().

New in version 1.0.

check_expected_data_format_supported(format)
Parameters:

format (Qmi.DeviceExpectedDataFormat) – a known Qmi.DeviceExpectedDataFormat.

Raises:

GLib.Error

Returns:

True if the data format is supported, or False if error is set.

Return type:

bool

Checks whether the given data format is supported by the kernel. interface.

This method is only applicable when using the qmi_wwan kernel driver.

New in version 1.28.

Raises:

GLib.Error

Returns:

True if link management is supported, or False if error is set.

Return type:

bool

Checks whether link management is supported by the kernel.

New in version 1.28.

close_async(timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously closes a Qmi.Device, preventing any further I/O.

If this device was opened with Qmi.DeviceOpenFlags.MBIM, this operation will wait for the response of the underlying MBIM close sequence.

Closing a Qmi.Device multiple times will not return an error.

When the operation is finished callback will be called. You can then call Qmi.Device.close_finish() to get the result of the operation.

New in version 1.18.

close_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an operation started with Qmi.Device.close_async().

New in version 1.18.

command_abortable_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

a #QmiMessage response, or None if error is set. The returned value should be freed with Qmi.message_unref().

Return type:

GLib.ByteArray

Finishes an operation started with qmi_device_command_abortable().

New in version 1.24.

command_full(message, message_context, timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously sends a #QmiMessage to the device.

The message will be processed according to the specific message_context given. If no context given, the behavior is the same as qmi_device_command().

If the operation is cancelled via cancellable, a Qmi.ProtocolError.ABORTED error will be returned always. If the QMI method may be aborted, there is no guarantee that the operation is truly aborted before the error is returned so it may really happen that the operation really succeeded and the method would still return Qmi.ProtocolError.ABORTED. In order to use abortable methods and make sure the response is the correct one, use qmi_device_command_abortable().

When the operation is finished callback will be called. You can then call Qmi.Device.command_full_finish() to get the result of the operation.

New in version 1.18.

command_full_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

a #QmiMessage response, or None if error is set. The returned value should be freed with Qmi.message_unref().

Return type:

GLib.ByteArray

Finishes an operation started with Qmi.Device.command_full().

New in version 1.18.

Parameters:

Asynchronously deletes all virtual network interfaces that have been previously created with Qmi.Device.add_link() in base_ifname.

When the operation is finished callback will be called. You can then call Qmi.Device.delete_link_finish() to get the result of the operation.

There is no guarantee that other processes haven’t created new links by the time this method returns. This method should be used with caution, or in setups where only one single process is expected to do QMI network interface link management.

New in version 1.28.

Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an operation started with Qmi.Device.delete_all_links().

New in version 1.28.

Parameters:

Asynchronously deletes a virtual network interface that has been previously created with Qmi.Device.add_link().

If the kernel driver doesn’t allow this functionality, a Qmi.CoreError.UNSUPPORTED error will be returned.

When the operation is finished callback will be called. You can then call Qmi.Device.delete_link_finish() to get the result of the operation.

The Qmi.DEVICE_MUX_ID_UNBOUND value may be given as mux_id if the user can guarantee that the underlying kernel support doesn’t require the mux id info to delete the link. When using the qmi_wwan driver from a kernel older than v5.12, a valid mux_id is required.

New in version 1.28.

Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an operation started with Qmi.Device.delete_link().

New in version 1.28.

get_consecutive_timeouts()
Returns:

a int.

Return type:

int

Gets the number of consecutive transaction timeouts in the device.

New in version 1.32.

get_expected_data_format()
Raises:

GLib.Error

Returns:

a valid Qmi.DeviceExpectedDataFormat, or Qmi.DeviceExpectedDataFormat.UNKNOWN if error is set.

Return type:

Qmi.DeviceExpectedDataFormat

Retrieves the data format currently expected by the kernel in the network interface.

If Qmi.DeviceExpectedDataFormat.UNKNOWN is returned, the user should assume that 802.3 is the expected format, as that is what the qmi_wwan driver expected by default before kernel 4.5.

This method is only applicable when using the qmi_wwan kernel driver.

New in version 1.14.

get_file()
Returns:

a Gio.File that must be freed with GObject.Object.unref().

Return type:

Gio.File

Get the Gio.File associated with this Qmi.Device.

New in version 1.0.

get_node()
Returns:

a Qrtr.Node that must be freed with GObject.Object.unref() or None if none available.

Return type:

Qrtr.Node

Get the Qrtr.Node associated with this Qmi.Device.

This method is only available when the library is built with QRTR support.

New in version 1.28.

get_path()
Returns:

the system path of the device.

Return type:

str

Get the system path of the underlying QMI device.

New in version 1.0.

get_path_display()
Returns:

UTF-8 encoded system path of the device.

Return type:

str

Get the system path of the underlying QMI device in UTF-8.

New in version 1.0.

get_service_version_info(timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously requests the service version information of the device.

When the operation is finished, callback will be invoked in the thread-default main loop of the thread you are calling this method from.

You can then call Qmi.Device.get_service_version_info_finish() to get the result of the operation.

New in version 1.6.

get_service_version_info_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

a GLib.Array of Qmi.DeviceServiceVersionInfo elements, or None if error is set. The returned value should be freed with g_array_unref().

Return type:

[Qmi.DeviceServiceVersionInfo]

Finishes an operation started with Qmi.Device.get_service_version_info().

New in version 1.6.

get_wwan_iface()
Returns:

UTF-8 encoded network interface name, or None if not available.

Return type:

str

Get the WWAN interface name associated with the QMI control port. This value will be loaded every time it’s asked for it.

This method is only applicable when using the qmi_wwan kernel driver.

New in version 1.14.

is_open()
Returns:

True if self is open, False otherwise.

Return type:

bool

Checks whether the Qmi.Device is open for I/O.

New in version 1.0.

Parameters:

base_ifname (str) – the base interface.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

out_links:

a placeholder for the output GLib.PtrArray of link names.

Return type:

(bool, out_links: [str])

Synchronously lists all virtual network interfaces that have been previously created with Qmi.Device.add_link() in base_ifname.

New in version 1.28.

open(flags, timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously opens a Qmi.Device for I/O.

When the operation is finished callback will be called. You can then call Qmi.Device.open_finish() to get the result of the operation.

New in version 1.0.

open_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an asynchronous open operation started with Qmi.Device.open().

New in version 1.0.

peek_file()
Returns:

a Gio.File. Do not free the returned object, it is owned by self.

Return type:

Gio.File

Get the Gio.File associated with this Qmi.Device, without increasing the reference count on the returned object.

New in version 1.0.

peek_node()
Returns:

a Qrtr.Node or None if none available. Do not free the returned object, it is owned by self.

Return type:

Qrtr.Node

Get the Qrtr.Node associated with this Qmi.Device, without increasing the reference count on the returned object.

This method is only available when the library is built with QRTR support.

New in version 1.28.

release_client(client, flags, timeout, cancellable, callback, *user_data)
Parameters:

Asynchronously releases the Qmi.Client from the Qmi.Device.

Once the Qmi.Client has been released, it cannot be used any more to perform operations.

When the operation is finished callback will be called. You can then call Qmi.Device.release_client_finish() to get the result of the operation.

New in version 1.0.

release_client_finish(res)
Parameters:

res (Gio.AsyncResult) – a Gio.AsyncResult.

Raises:

GLib.Error

Returns:

True if successful, or None if error is set.

Return type:

bool

Finishes an operation started with Qmi.Device.release_client().

Note that even if the release operation returns an error, the client should anyway be considered released, and shouldn’t be used afterwards.

New in version 1.0.

set_expected_data_format(format)
Parameters:

format (Qmi.DeviceExpectedDataFormat) – a known Qmi.DeviceExpectedDataFormat.

Raises:

GLib.Error

Returns:

True if successful, or False if error is set.

Return type:

bool

Configures the data format currently expected by the kernel in the network interface.

This method is only applicable when using the qmi_wwan kernel driver.

New in version 1.14.

set_instance_id(instance_id, timeout, cancellable, callback, *user_data)
Parameters:

Sets the instance ID of the Qmi.Device.

When the operation is finished callback will be called. You can then call Qmi.Device.set_instance_id_finish() to get the result of the operation.

New in version 1.0.

set_instance_id_finish(res, link_id)
Parameters:
Raises:

GLib.Error

Returns:

True if successful, False if error is set.

Return type:

bool

Finishes an operation started with Qmi.Device.set_instance_id().

New in version 1.0.

Signal Details

Qmi.Device.signals.device_removed(device)
Signal Name:

device-removed

Flags:

RUN_LAST

Parameters:

device (Qmi.Device) – The object which received the signal

The ::device-removed signal is emitted when an unexpected port hang-up is received.

New in version 1.20.

Qmi.Device.signals.indication(device, output)
Signal Name:

indication

Flags:

RUN_LAST

Parameters:
  • device (Qmi.Device) – The object which received the signal

  • output (bytes) – A #QmiMessage.

The ::indication signal gets emitted when a QMI indication is received.

New in version 1.8.

Property Details

Qmi.Device.props.device_consecutive_timeouts
Name:

device-consecutive-timeouts

Type:

int

Default Value:

0

Flags:

READABLE

Number of consecutive timeouts detected in requests sent to the device

New in version 1.32.

Qmi.Device.props.device_file
Name:

device-file

Type:

Gio.File

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

File to the underlying QMI device

New in version 1.0.

Qmi.Device.props.device_no_file_check
Name:

device-no-file-check

Type:

bool

Default Value:

False

Flags:

WRITABLE, CONSTRUCT_ONLY

Don’t check for file existence when creating the Qmi device.

New in version 1.12.

Qmi.Device.props.device_node
Name:

device-node

Type:

Qrtr.Node

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

Remote node on the QRTR bus

New in version 1.24.

Qmi.Device.props.device_proxy_path
Name:

device-proxy-path

Type:

str

Default Value:

'qmi-proxy'

Flags:

WRITABLE, CONSTRUCT_ONLY

Path of the abstract socket where the proxy is available.

New in version 1.12.

Qmi.Device.props.device_wwan_iface
Name:

device-wwan-iface

Type:

str

Default Value:

None

Flags:

READABLE

Name of the WWAN network interface associated with the control port.

New in version 1.14.