Qmi.Device¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
Number of consecutive timeouts detected in requests sent to the device |
||
r/w/co |
File to the underlying QMI device |
||
w/co |
Don’t check for file existence when creating the Qmi device. |
||
r/w/co |
Remote node on the QRTR bus |
||
w/co |
Path of the abstract socket where the proxy is available. |
||
r |
Name of the WWAN network interface associated with the control port. |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The |
|
The |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Qmi.Device(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the initialization is finished.user_data (
object
orNone
) – the data to pass to callback function.
Asynchronously creates a
Qmi.Device
object to manage file. When the operation is finished, callback will be invoked. You can then callQmi.Device.new_finish
() to get the result of the operation.New in version 1.0.
- classmethod new_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
.- Raises:
- Returns:
A newly created
Qmi.Device
, orNone
if error is set.- Return type:
Finishes an operation started with
Qmi.Device.new
().New in version 1.0.
- classmethod new_from_node(node, cancellable, callback, *user_data)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the initialization is finished.user_data (
object
orNone
) – the data to pass to callback function.
Asynchronously creates a
Qmi.Device
object to manage node. When the operation is finished, callback will be invoked. You can then callQmi.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
) – aGio.AsyncResult
.- Raises:
- Returns:
A newly created
Qmi.Device
, orNone
if error is set.- Return type:
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.
- add_link(mux_id, base_ifname, ifname_prefix, cancellable, callback, *user_data)¶
- Parameters:
mux_id (
int
) – the mux id for the link, in the [Qmi.DEVICE_MUX_ID_MIN
,:obj:Qmi.DEVICE_MUX_ID_MAX] range, or %QMI_DEVICE_MUX_ID_AUTOMATIC to find the first available mux id.base_ifname (
str
) – the interface which the new link will be created on.ifname_prefix (
str
) – the prefix suggested to be used for the name of the new link created.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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 isQmi.DeviceExpectedDataFormat.QMAP_PASS_THROUGH
, the generic rmnet netlink operations will be used. No multiplexing support exists when the format isQmi.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.
- add_link_finish(res, mux_id)¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
.mux_id (
int
) – the mux ID for the link created.
- Raises:
- Returns:
The name of the net interface created,
None
if error is set.- Return type:
Finishes an operation started with
Qmi.Device.add_link
().New in version 1.28.
- add_link_with_flags(mux_id, base_ifname, ifname_prefix, flags, cancellable, callback, *user_data)¶
- Parameters:
mux_id (
int
) – the mux id for the link, in the [Qmi.DEVICE_MUX_ID_MIN
,:obj:Qmi.DEVICE_MUX_ID_MAX] range, or %QMI_DEVICE_MUX_ID_AUTOMATIC to find the first available mux id.base_ifname (
str
) – the interface which the new link will be created on.ifname_prefix (
str
) – the prefix suggested to be used for the name of the new link created.flags (
Qmi.DeviceAddLinkFlags
) – bitmask ofQmi.DeviceAddLinkFlags
values to pass to the kernel when creating the new link.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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 callingQmi.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.
- add_link_with_flags_finish(res, mux_id)¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
.mux_id (
int
) – the mux ID for the link created.
- Raises:
- Returns:
The name of the net interface created,
None
if error is set.- Return type:
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:
service (
Qmi.Service
) – a validQmi.Service
.cid (
int
) – a valid client ID, orQmi.CID_NONE
.timeout (
int
) – maximum time to wait.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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
) – aGio.AsyncResult
.- Raises:
- Returns:
a newly allocated
Qmi.Client
, orNone
if error is set.- Return type:
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 knownQmi.DeviceExpectedDataFormat
.- Raises:
- Returns:
True
if the data format is supported, orFalse
if error is set.- Return type:
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.
- check_link_supported()¶
-
Checks whether link management is supported by the kernel.
New in version 1.28.
- close_async(timeout, cancellable, callback, *user_data)¶
- Parameters:
timeout (
int
) – maximum time, in seconds, to wait for the device to be closed.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
Finishes an operation started with
Qmi.Device.close_async
().New in version 1.18.
- command_abortable_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
.- Raises:
- Returns:
a #QmiMessage response, or
None
if error is set. The returned value should be freed withQmi.message_unref
().- Return type:
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:
message (
GLib.ByteArray
) – the message to send.message_context (
Qmi.MessageContext
) – the context of the message.timeout (
int
) – maximum time, in seconds, to wait for the response.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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 returnQmi.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
) – aGio.AsyncResult
.- Raises:
- Returns:
a #QmiMessage response, or
None
if error is set. The returned value should be freed withQmi.message_unref
().- Return type:
Finishes an operation started with
Qmi.Device.command_full
().New in version 1.18.
- delete_all_links(base_ifname, cancellable, callback, *user_data)¶
- Parameters:
base_ifname (
str
) – the interface where all links are available.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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.
- delete_all_links_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
Finishes an operation started with
Qmi.Device.delete_all_links
().New in version 1.28.
- delete_link(ifname, mux_id, cancellable, callback, *user_data)¶
- Parameters:
ifname (
str
) – the name of the link to remove.mux_id (
int
) – the mux ID of the link to remove.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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.
- delete_link_finish(res)¶
- Parameters:
res (
Gio.AsyncResult
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
Finishes an operation started with
Qmi.Device.delete_link
().New in version 1.28.
- get_consecutive_timeouts()¶
-
Gets the number of consecutive transaction timeouts in the device.
New in version 1.32.
- get_expected_data_format()¶
- Raises:
- Returns:
a valid
Qmi.DeviceExpectedDataFormat
, orQmi.DeviceExpectedDataFormat.UNKNOWN
if error is set.- Return type:
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 withGObject.Object.unref
().- Return type:
Get the
Gio.File
associated with thisQmi.Device
.New in version 1.0.
- get_node()¶
- Returns:
a
Qrtr.Node
that must be freed withGObject.Object.unref
() orNone
if none available.- Return type:
Get the
Qrtr.Node
associated with thisQmi.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:
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:
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:
timeout (
int
) – maximum time to wait for the method to complete, in seconds.cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
orNone
.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfied.
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
) – aGio.AsyncResult
.- Raises:
- Returns:
a
GLib.Array
ofQmi.DeviceServiceVersionInfo
elements, orNone
if error is set. The returned value should be freed with g_array_unref().- Return type:
Finishes an operation started with
Qmi.Device.get_service_version_info
().New in version 1.6.
- get_wwan_iface()¶
-
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()¶
-
Checks whether the
Qmi.Device
is open for I/O.New in version 1.0.
- list_links(base_ifname)¶
- Parameters:
base_ifname (
str
) – the base interface.- Raises:
- Returns:
True
if successful,False
if error is set.- out_links:
a placeholder for the output
GLib.PtrArray
of link names.
- Return type:
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:
flags (
Qmi.DeviceOpenFlags
) – mask ofQmi.DeviceOpenFlags
specifying how the device should be opened.timeout (
int
) – maximum time, in seconds, to wait for the device to be opened.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
Finishes an asynchronous open operation started with
Qmi.Device.open
().New in version 1.0.
- peek_file()¶
-
Get the
Gio.File
associated with thisQmi.Device
, without increasing the reference count on the returned object.New in version 1.0.
- peek_node()¶
- Returns:
a
Qrtr.Node
orNone
if none available. Do not free the returned object, it is owned by self.- Return type:
Get the
Qrtr.Node
associated with thisQmi.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:
client (
Qmi.Client
) – theQmi.Client
to release.flags (
Qmi.DeviceReleaseClientFlags
) – mask ofQmi.DeviceReleaseClientFlags
specifying how the client should be released.timeout (
int
) – maximum time to wait.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
Asynchronously releases the
Qmi.Client
from theQmi.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
) – aGio.AsyncResult
.- Raises:
- Returns:
- Return type:
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 knownQmi.DeviceExpectedDataFormat
.- Raises:
- Returns:
- Return type:
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:
instance_id (
int
) – the instance ID.timeout (
int
) – maximum time to wait.cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the operation is finished.user_data (
object
orNone
) – the data to pass to callback function.
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:
res (
Gio.AsyncResult
) – aGio.AsyncResult
.link_id (
int
) – a placeholder for the output #guint16, orNone
if not required.
- Raises:
- Returns:
- Return type:
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:
- 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:
- Parameters:
device (
Qmi.Device
) – The object which received the signaloutput (
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¶
-
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:
- Default Value:
- Flags:
File to the underlying QMI device
New in version 1.0.
- Qmi.Device.props.device_no_file_check¶
- Name:
device-no-file-check
- Type:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
Remote node on the QRTR bus
New in version 1.24.
- Qmi.Device.props.device_proxy_path¶
- Name:
device-proxy-path
- Type:
- Default Value:
'qmi-proxy'
- Flags:
Path of the abstract socket where the proxy is available.
New in version 1.12.