Compare commits

33 Commits
Author SHA1 Message Date
SymbX d00f3ccde2 workaround to get lower device name 2026-10-15 01:33:08 +03:00
SymbX befee319b4 add ability to supply kernel driver name from udev 2026-10-15 00:10:44 +03:00
Dan Williams f2b9ab1ad7 Merge request !1384 from 'mm-1-24-2'
release: bump version to 1.24.2

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1384
2025-07-28 15:15:43 -05:00
Dan Williams 5160a4f409 release: bump version to 1.24.2
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-28 15:07:18 -05:00
Dan Williams 8b51fb4385 Merge request !1383 from '1-24-suspend-bearer-timeout'
[1.24] base-manager: increase suspend timeout for each active bearer/disable unsolicited 3GPP events during quick suspend/resume

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1383
2025-07-28 14:25:36 -05:00
Dan Williams 79d495c892 base-manager: increase suspend timeout for each active bearer
Some modems can take a very long time (~20s) to reply to bearer
disconnect requests especially in marginal signal situations where
the modem must resend messages to the network after internal
timeouts. Give the modem a chance to suspend successfully if
there are active bearers.

Related: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1311#note_2938638

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-28 09:46:13 -05:00
Dan Williams e867a49d92 sleep-context: add ability to increase timeout
Track when the timeout was started, so that if it needs to be increased
we can calculate how long the new timeout should be. Then cancel the
original timeout and start a new one with.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-28 09:46:13 -05:00
Dan Williams b59666f484 broadband-modem,iface-modem: move bearer counting to interface and generalize
Allow counting more kinds of bearers than just multiplexed ones.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-28 09:46:13 -05:00
biemster d22bc4d402 iface-modem: disable unsolicited 3GPP events during quick suspend/resume
This introduces the "terse" mode during quick suspend/resume, right now
it is used by 3GPP interface to disable unsolicited events, but in
future it can be used by other interfaces as well.

This prevents device to wake-up from suspend for each unsolicited while
still allowing to wake up on calls or SMS messages.

Signed-off-by: biemster <biemster@gmail.com>
Signed-off-by: Bhushan Shah <bshah@kde.org>
2025-07-28 09:45:10 -05:00
Dan Williams 3a1184785b base-manager: rename manager/device shutdown to manager/device cleanup
In preparation for a "terse" mode, but also because "shutdown" was
kind of weird since we're not always shutting the modem down; sometimes
we're just putting it in low-power mode.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-07-28 09:39:46 -05:00
Dan Williams 4a3aba8928 Merge request !1349 from 'mm-1-24-mbim-multipart-fix'
[1.24] broadband-modem-qmi,broadband-modem-mbim: always use SMS_PART_INVALID_INDEX unstored parts

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1349
2025-05-15 08:42:40 -05:00
Dan Williams 19f6d15edf broadband-modem-qmi,broadband-modem-mbim: always use SMS_PART_INVALID_INDEX unstored parts
MMSmsList has logic to allow multiple unstored messages as long as
they use SMS_PART_INVALID_INDEX. These messages aren't stored so
they don't have an index.

But the MBIM and QMI modems used index 0 for unstored messages,
meaning there could only ever be one and also that multipart
messages would fail to be combined.

Let's fix that by just using SMS_PART_INVALID_INDEX for every
scenario where an unstored message comes in.

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/979

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 1d5cc0addb)
2025-05-08 20:44:02 -05:00
Dan Williams 958bc69299 Merge request !1348 from '1-24-cherry-picks-05-08-25'
[1.24] stable cherry-picks 2025-05-08

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1348
2025-05-08 18:12:47 -05:00
Dan Williams 3827a63d33 modem-helpers: report C*REG=2 AcT 9 as NB-IOT access technology
Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 2e27b02004)
2025-05-08 16:08:28 -05:00
Dan Williams 46cc38570d broadband-modem: reload registration info after manual registration
This refreshes operator information after manual registration. QMI and
MBIM implementations return operator info along with registration info
so they handle this easily, while with AT-based devices we must run
additional commands to retrieve that after the manual registration has
finished.

Suggested by: Kirill Buksha <kirill.buksha@axians.rs>
Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/971

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit febab17f07)
2025-05-08 16:08:21 -05:00
Dan Williams dc3a7f0d3b broadband-modem: detect old Mediatek 62xx chipsets as GSM-capable
They don't necessarily reply to +WS46 but like old Motorola ESX
devices they reply to +CGMM with a known string.

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/980

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 8cf25a97a1)
2025-05-08 16:07:58 -05:00
Dan Williams 9f0db52ed0 iface-modem-voice: recheck call state polling when call is started
When an outgoing call is created and added to the call list its state
is UNKNOWN. The call list emits the ADDED signal which MMIfaceModemVoice
listens for to check whether to begin polling call state.

But since UNKNOWN is not an in-progress call state polling isn't started.
And nothing was rechecking whether to start polling when the call state
changed to something other than UNKNOWN.

Do that so that we can track call progress as it dials out and is
answered.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 92e666e1c9)
2025-05-08 16:07:39 -05:00
Dan Williams 240a9145ad modem-helpers-cinterion: allow spaces in ^SXRAT test response
^SXRAT: (0-6), (0,2,3), (0,2,3)

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/974

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 6b6997362b)
2025-05-08 16:07:33 -05:00
Dan Williams 018e440848 shared-fibocom: don't assume parent implements the firmware interface
MMBroadbandModemMbimMtkFibocom doesn't, so don't assert it.

Fixes: https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/issues/975

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 046b79a676)
2025-05-08 16:07:22 -05:00
Dan Williams 0c7d573969 modem-helpers: fix checking of CDMA/EVDO access technology
Missing ! for strncmp() meant the test was backwards and would
erroneously report 1xRTT and EVDOr0 when those access technologies
were not in use.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
(cherry picked from commit 9e205f4784)
2025-05-08 16:07:11 -05:00
Jan Alexander Steffens (heftig) 1ec2b86239 docs: Fix gtk-doc build
Fix a duplicate `id` and the inclusions of gdbus docs.

Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
(cherry picked from commit 078a92cd5c)
2025-05-08 16:07:02 -05:00
Dan Williams 4fa4084600 Merge request !1347 from 'sleep-wait-1.24'
[1.24] Wait until device operations complete before dropping suspend inhibitor

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1347
2025-05-08 16:04:02 -05:00
Dan Williams dae00a9f2f broadband-modem: close serial ports in dispose
We want ports to be closed as early as possible; so make sure they
are closed in dispose() which is run explicitly by MMDevice when
cleaning up and removing the modem. Otherwise they could stay
open longer than we want, causing problems for suspend/resume.

This caused problems with suspend because cancelling the
MMBaseModem's cancellable triggered an idle handler that held
a reference to the modem, preventing finalize() from running
until after the suspend code was finished, thus preventing
ports from being closed and cleaned up. Closing them in
dispose() handles this.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 3157a90c5b broadband-modem: remove invalid idle handler during dispose
base_modem_invalid_idle() needs to keep a reference to the
MMBaseModem until its done. But if the modem is cancelled during
removal right before we're trying to forget about it, keeping
that reference can prevent everything getting cleaned up by
MMBaseModem's dispose() until after the mainloop has run again
and all our removal operations are supposedly complete.

MMDevice uses an explicit dispose() trigger that mitigates
most of this (and requires it for other reasons, like breaking
reference cycles between the modem and it's various child
classes) but it's somewhat error-prone to keep the modem
around if we don't really need to.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 34148f8e8b broadband-modem-qmi,mbim: remove redundant port closes
This will just be done immediately after by MMBaseModem's
dispose() handler.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams c146dd6094 base-manager: convert shutdown to steps
Make the call flow clearer.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams d80f98da01 base-manager,device: consolidate modem cancelling into mm_device_remove_modem()
Every use of mm_device_remove_modem() was already trying to cancel the
modem's canellable, so let's just put it there and simplify the callers.

Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams b97f864acd base-manager,sleep-monitor: wait for modem operations before sleeping
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 5e29ece5ec base-modem: clarify port cleanup/close behavior for serial ports
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams e12b3adb35 base-modem: allow port teardown operation to use callbacks if needed
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 649350dfff port-serial: don't log force-closes if not really being forced close
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-05-08 15:44:36 -05:00
Dan Williams 18521b6882 Merge request !1332 from 'bump-1-24-1'
build: unstable release version bump to 1.24.1

https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1332
2025-04-10 01:57:37 +00:00
Dan Williams 7fc6788737 build: unstable release version bump to 1.24.1
Signed-off-by: Dan Williams <dan@ioncontrol.co>
2025-04-09 20:43:22 -05:00
277 changed files with 3756 additions and 22446 deletions
-3
View File
@@ -4,6 +4,3 @@
tags
/.vscode
/cscope.out
/.cache
subprojects/libmbim
subprojects/libqmi
+10 -53
View File
@@ -12,8 +12,8 @@ stages:
.common_variables:
variables:
FDO_UPSTREAM_REPO: mobile-broadband/ModemManager
FDO_DISTRIBUTION_VERSION: '22.04'
FDO_DISTRIBUTION_TAG: '2026-01-05.1'
FDO_DISTRIBUTION_VERSION: '20.04'
FDO_DISTRIBUTION_TAG: '2023-01-03.1'
FDO_DISTRIBUTION_PACKAGES: ca-certificates git gcc meson ninja-build gawk
libgettextpo-dev libgirepository1.0-dev libglib2.0-dev
libgudev-1.0-dev python3-dbus python3-gi autopoint
@@ -24,11 +24,8 @@ stages:
LIBQMI_BRANCH: 'main'
LIBQRTR_BRANCH: 'main'
LIBMBIM_BRANCH: 'main'
BUILD_MBIM: true
BUILD_QMI: true
BUILD_QRTR: true
build_container:
build container:
extends:
- .fdo.container-build@ubuntu
- .common_variables
@@ -39,6 +36,11 @@ build_container:
- tags
- schedules
before_script:
- export BUILD_MBIM=true
- export BUILD_QMI=true
- export BUILD_QRTR=true
.prepare_deps: &prepare_deps
- >
if [ "$BUILD_MBIM" == "true" ]; then
@@ -62,7 +64,7 @@ build_container:
if [ "$BUILD_QMI" == "true" ]; then
git clone --depth 1 --branch ${LIBQMI_BRANCH} https://gitlab.freedesktop.org/mobile-broadband/libqmi.git
pushd libqmi
meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false -Dmbim_qmux=$BUILD_MBIM -Dqrtr=$BUILD_QRTR
meson setup build --prefix=/usr -Dgtk_doc=false -Dintrospection=false -Dbash_completion=false -Dmbim_qmux=$BUILD_MBIM -Dqrtr=$BUILD_QRTR -Dcollection=basic
ninja -C build
ninja -C build install
popd
@@ -73,8 +75,6 @@ verify-dco:
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
needs:
- build_container
only:
- merge_requests
script: |
@@ -91,8 +91,6 @@ verify-dco:
build-no-qmi:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -111,8 +109,6 @@ build-no-qmi:
build-qmi-qrtr-no-mbim:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -130,8 +126,6 @@ build-qmi-qrtr-no-mbim:
build-qmi-no-qrtr-no-mbim:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -150,8 +144,6 @@ build-qmi-no-qrtr-no-mbim:
build-no-qmi-no-mbim:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -172,8 +164,6 @@ build-no-qmi-no-mbim:
build-no-qmi-no-mbim-no-tests:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -193,8 +183,6 @@ build-no-qmi-no-mbim-no-tests:
build-no-deprecated:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -208,15 +196,13 @@ build-no-deprecated:
- export BUILD_QRTR=false
- export BUILD_QMI=false
- *prepare_deps
- meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dqmi=false -Dqrtr=false -Dmbim=false -Ddeprecated=false
- CFLAGS="-DMM_DISABLE_DEPRECATED" meson setup build --prefix=/usr -Dwerror=true -Dgtk_doc=false -Dqmi=false -Dqrtr=false -Dmbim=false
- ninja -C build
- ninja -C build test
- ninja -C build install
build-no-suspend-resume:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -233,8 +219,6 @@ build-no-suspend-resume:
build-suspend-resume-powerd:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -251,8 +235,6 @@ build-suspend-resume-powerd:
build-single-plugins:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -269,8 +251,6 @@ build-single-plugins:
build-single-plugins-builtin:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -287,8 +267,6 @@ build-single-plugins-builtin:
build-debug:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -307,8 +285,6 @@ build-debug:
build-release:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -327,8 +303,6 @@ build-release:
build-release-builtin:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
@@ -344,20 +318,3 @@ build-release-builtin:
- ninja -C build test
- ninja -C build install
- ninja -C build uninstall
build-asan:
stage: build
needs:
- build_container
extends:
- .fdo.distribution-image@ubuntu
- .common_variables
only:
- main
- merge_requests
- tags
- schedules
script:
- *prepare_deps
- meson setup build-asan -Db_sanitize=address -Dwerror=true -Dgtk_doc=false -Dqmi=true -Dqrtr=true -Dmbim=true
- meson test -C build-asan --suite=daemon --timeout-multiplier=5 --print-errorlogs
+28
View File
@@ -1,3 +1,31 @@
ModemManager 1.24.2
-------------------------------------------
This is a new stable release of ModemManager.
The most important features and changes in this release are the following:
* Core:
** Wait until bearers are disconnected before allowing system to suspend
** Fix checks for CDMA/EVDO access technology in some modems
** Detect old Mediatek 62xx-based devices as GSM-capable
** Refresh registration info after manual registration for AT-based devices
** Correctly report NB-IOT access technology
** Disable unsolicited 3GPP events during quick suspend/resume
* MBIM:
** Fix re-assembly of multi-part unstored SMS messages
* QMI:
** Fix re-assembly of multi-part unstored SMS messages
* Voice interface:
** Correctly start call state polling on some modems
* Plugins:
** fibocomm: don't assert when checking for firmware interface
** cinterion: allow spaces in ^SXRAT response
ModemManager 1.24.0
-------------------------------------------
This is a new stable release of ModemManager.
@@ -1 +0,0 @@
mm-enumflags-types.c.template
@@ -1 +0,0 @@
mm-enumflags-types.h.template
-3
View File
@@ -138,7 +138,6 @@ print_bearer_info (MMBearer *bearer)
g_autoptr(MMBearerProperties) properties = NULL;
g_autoptr(MMBearerStats) stats = NULL;
g_autoptr(GError) connection_error = NULL;
gboolean disconnect_request = FALSE;
gint profile_id;
gchar *profile_id_str;
@@ -148,7 +147,6 @@ print_bearer_info (MMBearer *bearer)
stats = mm_bearer_get_stats (bearer);
profile_id = mm_bearer_get_profile_id (bearer);
connection_error = mm_bearer_get_connection_error (bearer);
disconnect_request = mm_bearer_get_disconnect_request (bearer);
profile_id_str = (profile_id != MM_3GPP_PROFILE_ID_UNKNOWN) ? g_strdup_printf ("%d", profile_id) : NULL;
@@ -158,7 +156,6 @@ print_bearer_info (MMBearer *bearer)
mmcli_output_string (MMC_F_BEARER_STATUS_CONNECTED, mm_bearer_get_connected (bearer) ? "yes" : "no");
mmcli_output_string_take (MMC_F_BEARER_STATUS_CONNECTION_ERROR_NAME, connection_error ? g_dbus_error_encode_gerror (connection_error) : NULL);
mmcli_output_string (MMC_F_BEARER_STATUS_CONNECTION_ERROR_MESSAGE, connection_error ? connection_error->message : NULL);
mmcli_output_string (MMC_F_BEARER_STATUS_DISCONNECT_REQUEST, disconnect_request ? "yes" : "no");
mmcli_output_string (MMC_F_BEARER_STATUS_SUSPENDED, mm_bearer_get_suspended (bearer) ? "yes" : "no");
mmcli_output_string (MMC_F_BEARER_STATUS_MULTIPLEXED, mm_bearer_get_multiplexed (bearer) ? "yes" : "no");
mmcli_output_string (MMC_F_BEARER_STATUS_INTERFACE, mm_bearer_get_interface (bearer));
-4
View File
@@ -115,7 +115,6 @@ mmcli_cbm_shutdown (void)
static void
print_cbm_info (MMCbm *cbm)
{
const gchar *lang;
gchar *channel;
gchar *update;
gchar *code;
@@ -123,12 +122,9 @@ print_cbm_info (MMCbm *cbm)
update = g_strdup_printf ("%u", mm_cbm_get_update (cbm));
channel = g_strdup_printf ("%u", mm_cbm_get_channel (cbm));
code = g_strdup_printf ("%u", mm_cbm_get_message_code (cbm));
lang = mm_cbm_get_language (cbm);
mmcli_output_string (MMC_F_CBM_GENERAL_DBUS_PATH, mm_cbm_get_path (cbm));
mmcli_output_string (MMC_F_CBM_CONTENT_TEXT, mm_cbm_get_text (cbm));
if (lang)
mmcli_output_string (MMC_F_CBM_PROPERTIES_LANG, mm_cbm_get_language (cbm));
mmcli_output_string_take (MMC_F_CBM_PROPERTIES_CHANNEL, channel);
mmcli_output_string_take (MMC_F_CBM_PROPERTIES_UPDATE, update);
mmcli_output_string_take (MMC_F_CBM_PROPERTIES_MESSAGE_CODE, code);
+1 -1
View File
@@ -344,7 +344,7 @@ set_supl_server_process_reply (gboolean result,
const GError *error)
{
if (!result) {
g_printerr ("error: couldn't set SUPL server address: '%s'\n",
g_printerr ("error: couldn't set SUPL servert address: '%s'\n",
error ? error->message : "unknown error");
exit (EXIT_FAILURE);
}
+1 -1
View File
@@ -458,7 +458,7 @@ mmcli_modem_signal_run_synchronous (GDBusConnection *connection)
exit (EXIT_FAILURE);
}
g_debug ("Synchronously setting up threshold values...");
g_debug ("Asynchronously setting up threshold values...");
result = mm_modem_signal_setup_thresholds_sync (ctx->modem_signal,
properties,
NULL,
+1 -11
View File
@@ -316,11 +316,8 @@ print_modem_info (void)
MMModemBand *bands = NULL;
guint n_bands = 0;
MMModemPortInfo *ports = NULL;
MMModemPortInfo *ignored_ports = NULL;
guint n_ports = 0;
guint n_ignored_ports = 0;
gchar *ports_string;
gchar *ignored_ports_string;
MMUnlockRetries *unlock_retries;
guint signal_quality = 0;
gboolean signal_quality_recent = FALSE;
@@ -346,12 +343,7 @@ print_modem_info (void)
g_free (bands);
mm_modem_get_ports (ctx->modem, &ports, &n_ports);
ports_string = mm_common_build_ports_string (ports, n_ports);
if (ports)
mm_modem_port_info_array_free (ports, n_ports);
mm_modem_get_ignored_ports (ctx->modem, &ignored_ports, &n_ignored_ports);
ignored_ports_string = mm_common_build_ports_string (ignored_ports, n_ignored_ports);
if (ignored_ports)
mm_modem_port_info_array_free (ignored_ports, n_ignored_ports);
mm_modem_port_info_array_free (ports, n_ports);
if (mm_modem_get_current_modes (ctx->modem, &allowed_modes, &preferred_mode)) {
allowed_modes_string = mm_modem_mode_build_string_from_mask (allowed_modes);
preferred_mode_string = mm_modem_mode_build_string_from_mask (preferred_mode);
@@ -384,7 +376,6 @@ print_modem_info (void)
mmcli_output_string (MMC_F_SYSTEM_PLUGIN, mm_modem_get_plugin (ctx->modem));
mmcli_output_string (MMC_F_SYSTEM_PRIMARY_PORT, mm_modem_get_primary_port (ctx->modem));
mmcli_output_string_list (MMC_F_SYSTEM_PORTS, ports_string);
mmcli_output_string_list (MMC_F_SYSTEM_IGNORED_PORTS, ignored_ports_string);
mmcli_output_string_array (MMC_F_NUMBERS_OWN, (const gchar **) mm_modem_get_own_numbers (ctx->modem), FALSE);
@@ -549,7 +540,6 @@ print_modem_info (void)
mmcli_output_dump ();
g_free (ports_string);
g_free (ignored_ports_string);
g_free (supported_ip_families_string);
g_free (current_bands_string);
g_free (supported_bands_string);
-3
View File
@@ -120,7 +120,6 @@ static FieldInfo field_infos[] = {
[MMC_F_SYSTEM_PLUGIN] = { "modem.generic.plugin", "plugin", MMC_S_MODEM_SYSTEM, },
[MMC_F_SYSTEM_PRIMARY_PORT] = { "modem.generic.primary-port", "primary port", MMC_S_MODEM_SYSTEM, },
[MMC_F_SYSTEM_PORTS] = { "modem.generic.ports", "ports", MMC_S_MODEM_SYSTEM, },
[MMC_F_SYSTEM_IGNORED_PORTS] = { "modem.generic.ignored-ports", "ignored ports", MMC_S_MODEM_SYSTEM, },
[MMC_F_NUMBERS_OWN] = { "modem.generic.own-numbers", "own", MMC_S_MODEM_NUMBERS, },
[MMC_F_STATUS_LOCK] = { "modem.generic.unlock-required", "lock", MMC_S_MODEM_STATUS, },
[MMC_F_STATUS_UNLOCK_RETRIES] = { "modem.generic.unlock-retries", "unlock retries", MMC_S_MODEM_STATUS, },
@@ -242,7 +241,6 @@ static FieldInfo field_infos[] = {
[MMC_F_BEARER_STATUS_CONNECTED] = { "bearer.status.connected", "connected", MMC_S_BEARER_STATUS, },
[MMC_F_BEARER_STATUS_CONNECTION_ERROR_NAME] = { "bearer.status.connection-error.name", "connection error name", MMC_S_BEARER_STATUS, },
[MMC_F_BEARER_STATUS_CONNECTION_ERROR_MESSAGE] = { "bearer.status.connection-error.message", "connection error message", MMC_S_BEARER_STATUS, },
[MMC_F_BEARER_STATUS_DISCONNECT_REQUEST] = { "bearer.status.disconnect-request", "disconnect request", MMC_S_BEARER_STATUS, },
[MMC_F_BEARER_STATUS_SUSPENDED] = { "bearer.status.suspended", "suspended", MMC_S_BEARER_STATUS, },
[MMC_F_BEARER_STATUS_MULTIPLEXED] = { "bearer.status.multiplexed", "multiplexed", MMC_S_BEARER_STATUS, },
[MMC_F_BEARER_STATUS_INTERFACE] = { "bearer.status.interface", "interface", MMC_S_BEARER_STATUS, },
@@ -298,7 +296,6 @@ static FieldInfo field_infos[] = {
[MMC_F_CBM_PROPERTIES_CHANNEL] = { "cbm.properties.channel", "channel", MMC_S_CBM_PROPERTIES, },
[MMC_F_CBM_PROPERTIES_UPDATE] = { "cbm.properties.update", "update", MMC_S_CBM_PROPERTIES, },
[MMC_F_CBM_PROPERTIES_MESSAGE_CODE] = { "cbm.properties.message-code", "message code", MMC_S_CBM_PROPERTIES, },
[MMC_F_CBM_PROPERTIES_LANG ] = { "cbm.properties.lang", "lang", MMC_S_CBM_PROPERTIES, },
[MMC_F_SMS_GENERAL_DBUS_PATH] = { "sms.dbus-path", "path", MMC_S_SMS_GENERAL, },
[MMC_F_SMS_CONTENT_NUMBER] = { "sms.content.number", "number", MMC_S_SMS_CONTENT, },
[MMC_F_SMS_CONTENT_TEXT] = { "sms.content.text", "text", MMC_S_SMS_CONTENT, },
-3
View File
@@ -114,7 +114,6 @@ typedef enum {
MMC_F_SYSTEM_PLUGIN,
MMC_F_SYSTEM_PRIMARY_PORT,
MMC_F_SYSTEM_PORTS,
MMC_F_SYSTEM_IGNORED_PORTS,
/* Numbers section */
MMC_F_NUMBERS_OWN,
/* Status section */
@@ -260,7 +259,6 @@ typedef enum {
MMC_F_BEARER_STATUS_CONNECTED,
MMC_F_BEARER_STATUS_CONNECTION_ERROR_NAME,
MMC_F_BEARER_STATUS_CONNECTION_ERROR_MESSAGE,
MMC_F_BEARER_STATUS_DISCONNECT_REQUEST,
MMC_F_BEARER_STATUS_SUSPENDED,
MMC_F_BEARER_STATUS_MULTIPLEXED,
MMC_F_BEARER_STATUS_INTERFACE,
@@ -317,7 +315,6 @@ typedef enum {
MMC_F_CBM_PROPERTIES_CHANNEL,
MMC_F_CBM_PROPERTIES_UPDATE,
MMC_F_CBM_PROPERTIES_MESSAGE_CODE,
MMC_F_CBM_PROPERTIES_LANG,
MMC_F_SMS_GENERAL_DBUS_PATH,
MMC_F_SMS_CONTENT_NUMBER,
MMC_F_SMS_CONTENT_TEXT,
-1
View File
@@ -10,7 +10,6 @@ BusName=org.freedesktop.ModemManager1
ExecStart=@sbindir@/ModemManager
StandardError=null
Restart=on-abort
KillMode=mixed
CapabilityBoundingSet=CAP_SYS_ADMIN CAP_NET_ADMIN
ProtectSystem=true
ProtectHome=true
+1 -3
View File
@@ -4,7 +4,6 @@
# 2021 Aleksander Morgado <aleksander@aleksander.es>
# 2022 Thilo-Alexander Ginkel <thilo@ginkel.com>
# 2022 Bjørn Mork <bjorn@mork.no>
# 2025 Kajetan Krykwiński <gitlab@kitor.pl>
#
# Foxconn SDX55 (Lenovo T99W175) FCC unlock operation
#
@@ -23,8 +22,7 @@ for PORT in "$@"; do
# match port type in Linux 5.14 and newer
grep -q MBIM "/sys/class/wwan/$PORT/type" 2>/dev/null ||
# match port name in Linux 5.13
echo "$PORT" | grep -qi MBIM ||
echo "$PORT" | grep -q cdc-wdm && {
echo "$PORT" | grep -qi MBIM && {
MBIM_PORT="$PORT"
break
}
-131
View File
@@ -1,131 +0,0 @@
#!/bin/bash
# SPDX-License-Identifier: CC0-1.0
# 2024 Thomas Vogt
#
# RPC-powered Intel XMM7360 (8086:7360) FCC unlock
if [[ "$FCC_UNLOCK_DEBUG_LOG" == '1' ]]; then
exec 3>&1 4>&2
trap 'exec 2>&4 1>&3' 0 1 2 3
exec 1>>/var/log/mm-xmm7360-fcc.log 2>&1
fi
# require program name and at least 2 arguments
[ $# -lt 2 ] && exit 1
# first argument is DBus path, not needed here
shift
# second and next arguments are control port names
for PORT in "$@"; do
# support for XMM7360 has been added in 5.18
# match port type, assuming Linux 5.14 and newer
grep -q XMMRPC "/sys/class/wwan/$PORT/type" 2>/dev/null && {
XMMRPC_PORT=$PORT
break
}
done
# fail if no XMMRPC port exposed
[ -n "$XMMRPC_PORT" ] || exit 2
DEVICE=/dev/${XMMRPC_PORT}
log() {
echo "$1"
}
error() {
echo "$1" >&2
}
reverseHexEndianness() {
num="$1"
printf "%s" "${num:6:2}${num:4:2}${num:2:2}${num:0:2}"
}
littleEndianToDec() {
printf "%d" "0x$1"
}
bigEndianToDec() {
littleEndianToDec "$(reverseHexEndianness "$1")"
}
readNBytesAsHex() {
data=$(head "-c$1" <&99 | xxd -p -c0 | tr -d '\n')
printf "%s" "$data"
}
writeHexAsBinary() {
printf "%s" "$1" | xxd -r -p >&99
}
readResponseAsHex() {
length_hex=$(readNBytesAsHex 4)
length=$(bigEndianToDec "$length_hex")
content=$(readNBytesAsHex $length)
printf "%s" "$length_hex$content"
}
rpc_command() {
exec 99<>"$DEVICE"
writeHexAsBinary $1
answer=$(readResponseAsHex) # ignore "async-ack" response
answer=$(readResponseAsHex)
printf "%s" "$answer"
exec 99>&-
}
VENDOR_ID_HASH="3df8c719"
for i in {1..3}; do
log "Attempt #${i} to unlock WWAN modem"
log "Requesting FCC lock state from modem"
# --> (async) csi-fcc-lock-query-req
RESP=$(rpc_command "1c00000002040000001c02040000018e11000101020411000101020400000000")
MODE=$(littleEndianToDec "${RESP: -8}")
STATE=$(littleEndianToDec "${RESP: -20:8}")
log "Got response from modem: state=$STATE, mode=$MODE"
if [ "$MODE" = "0" ]; then
log "FCC lock is deactivated, nothing to do."
exit 0
fi
if [ "$STATE" != "0" ]; then
log "FCC already unlocked, nothing to do."
exit 0
fi
log "Requesting challenge from modem"
# --> (async) csi-fcc-lock-gen-challenge-req
RESP=$(rpc_command "1c00000002040000001c02040000019011000101020411000101020400000000")
HEX_CHALLENGE=$(printf "%s" "${RESP: -8}")
log "Got challenge from modem: $HEX_CHALLENGE"
REVERSE_HEX_CHALLENGE=$(reverseHexEndianness "${HEX_CHALLENGE}")
COMBINED_CHALLENGE="${REVERSE_HEX_CHALLENGE}${VENDOR_ID_HASH}"
RESPONSE_HASH=$(printf "%s" "$COMBINED_CHALLENGE" | xxd -r -p | sha256sum | cut -d ' ' -f 1)
REVERSED_RESPONSE=$(reverseHexEndianness "${RESPONSE_HASH:0:8}")
log "Sending hash to modem: $REVERSED_RESPONSE"
# --> (async) csi-fcc-lock-ver-challenge-req
RESP=$(rpc_command "1c00000002040000001c020400000192110001010204110001010204${REVERSED_RESPONSE}")
UNLOCK_RESPONSE=$(littleEndianToDec "${RESP: -8}")
if [ "$UNLOCK_RESPONSE" = "0" ]; then
error "Unlock failed."
else
log "FCC unlock successful (response $UNLOCK_RESPONSE)"
exit 0
fi
sleep 0.5
done
exit 2
-2
View File
@@ -15,7 +15,6 @@ examples = files(
'1199',
'14c3',
'2c7c',
'8086:7360',
)
install_data(
@@ -27,7 +26,6 @@ install_data(
vidpids = {
'105b:e0ab': '105b',
'105b:e0c3': '105b',
'05c6:90d5': '105b',
'03f0:4e1d': '1199',
'1199:9079': '1199',
'413c:81a3': '1199',
@@ -71,10 +71,6 @@
send_interface="org.freedesktop.ModemManager1.Modem"
send_member="SetCurrentModes"/>
<allow send_destination="org.freedesktop.ModemManager1"
send_interface="org.freedesktop.ModemManager1.Modem"
send_member="SetPrimarySimSlot"/>
<allow send_destination="org.freedesktop.ModemManager1"
send_interface="org.freedesktop.ModemManager1.Modem"
send_member="SetCurrentBands"/>
@@ -355,10 +351,6 @@
send_interface="org.freedesktop.ModemManager1.Modem.Signal"
send_member="Setup"/>
<allow send_destination="org.freedesktop.ModemManager1"
send_interface="org.freedesktop.ModemManager1.Modem.Signal"
send_member="SetupThresholds"/>
<!-- org.freedesktop.ModemManager1.Modem.Time.xml -->
<!-- Protected by the Time policy rule -->
@@ -366,22 +358,6 @@
send_interface="org.freedesktop.ModemManager1.Modem.Time"
send_member="GetNetworkTime"/>
<!-- org.freedesktop.ModemManager1.Modem.CellBroadcast.xml -->
<!-- Allowed for everyone -->
<allow send_destination="org.freedesktop.ModemManager1"
send_interface="org.freedesktop.ModemManager1.Modem.CellBroadcast"
send_member="List"/>
<!-- Protected by the CellBroadcast policy rule -->
<allow send_destination="org.freedesktop.ModemManager1"
send_interface="org.freedesktop.ModemManager1.Modem.CellBroadcast"
send_member="Delete"/>
<!-- Protected by the Device.Control policy rule -->
<allow send_destination="org.freedesktop.ModemManager1"
send_interface="org.freedesktop.ModemManager1.Modem.CellBroadcast"
send_member="SetChannels"/>
</policy>
<policy user="root">
@@ -11,7 +11,7 @@
<action id="org.freedesktop.ModemManager1.CellBroadcast">
<description>Enable and view Cell Broadcast messages</description>
<message>System policy prevents enabling or viewing this device's cell broadcast messages.</message>
<message>System policy prevents enabling or viewing this device's text messages.</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>@MM_DEFAULT_USER_POLICY@</allow_active>
@@ -27,15 +27,6 @@
</defaults>
</action>
<action id="org.freedesktop.ModemManager1.Modem.SetPrimarySimSlot">
<description>Set the primary sim slot of a modem</description>
<message>System policy prevents configuring modem properties.</message>
<defaults>
<allow_inactive>no</allow_inactive>
<allow_active>@MM_DEFAULT_USER_POLICY@</allow_active>
</defaults>
</action>
<action id="org.freedesktop.ModemManager1.Device.Control">
<description>Unlock and control a mobile broadband device</description>
<message>System policy prevents unlocking or controlling the mobile broadband device.</message>
+26 -59
View File
@@ -176,10 +176,8 @@ in use, like \fIBearer\fR. For example:
.RE
.TP
.B \-m, \-\-modem=[PATH|INDEX|any]
Specify a modem via full D-Bus object path, modem index, or 'any'. 'any' selects
the first available modem regardless of index or path, which can simplify
operation for single-modem systems.
.B \-m, \-\-modem=[PATH|INDEX]
Specify a modem.
.TP
.B \-b, \-\-bearer=[PATH|INDEX]
Specify a bearer.
@@ -498,10 +496,6 @@ This DBus property signal updates are by default disabled.
.B \-\-location\-set\-disable\-signal
Disable reporting location updates via DBus property signals.
.TP
.B \-\-location\-monitor
Continuously monitor all available location information.
.SH MESSAGING OPTIONS
All messaging options must be used with \fB\-\-modem\fR or \fB\-m\fR.
@@ -770,7 +764,7 @@ Set the list of channels on which cell broadcasts are received (e.g. \fB5370,537
You'll need first to know which the proper path/index is for the SIM in your
modem:
.Bd -literal -compact
$ mmcli -m any -K | grep "modem.generic.sim" | awk -F ": " '{ print $2 }'
$ mmcli -m 0 -K | grep "modem.generic.sim" | awk -F ": " '{ print $2 }'
/org/freedesktop/ModemManager1/SIM/0
.Ed
@@ -784,13 +778,13 @@ And after that, you can just use the SIM index:
You can launch the simple connection process like:
.Bd -literal -compact
$ sudo mmcli -m any --simple-connect="pin=1234,apn=internet"
$ sudo mmcli -m 0 --simple-connect="pin=1234,apn=internet"
successfully connected the modem
.Ed
Then, you can disconnect it like:
.Bd -literal -compact
$ sudo mmcli -m any --simple-disconnect
$ sudo mmcli -m 0 --simple-disconnect
successfully disconnected all bearers in the modem
.Ed
@@ -799,7 +793,7 @@ Then, you can disconnect it like:
Scanning for 3GPP networks may really take a long time, so a specific timeout
must be given:
.Bd -literal -compact
$ sudo mmcli -m any --3gpp-scan --timeout=300
$ sudo mmcli -m 0 --3gpp-scan --timeout=300
---------------------
3GPP scan | networks: 21403 - Orange SP (gprs, unknown)
| 21407 - Movistar (gprs, unknown)
@@ -812,7 +806,7 @@ must be given:
Using the “sm” (SIM), you can do this using:
.Bd -literal -compact
$ sudo mmcli -m any --messaging-create-sms="text='Hello world',number='+1234567890'"
$ sudo mmcli -m 0 --messaging-create-sms="text='Hello world',number='+1234567890'"
Successfully created new SMS:
/org/freedesktop/ModemManager1/SMS/21 (unknown)
@@ -835,7 +829,7 @@ Using the “sm” (SIM), you can do this using:
| delivery report: not requested
| message reference: 0
$ sudo mmcli -m any --messaging-status
$ sudo mmcli -m 0 --messaging-status
----------------------------
Messaging | supported storages: sm, me
| default storage: me
@@ -847,7 +841,7 @@ As you can see below, the important part is the
\fB\-\-messaging\-create\-sms\-with\-data\fR and the \fBPATH\fR provided.
.Bd -literal -compact
$ sudo mmcli -m any \\
$ sudo mmcli -m 0 \\
--messaging-create-sms="number='+1234567890'" \\
--messaging-create-sms-with-data=/path/to/your/file
Successfully created new SMS:
@@ -864,7 +858,7 @@ recover the sent file with another \fBmmcli\fR command in their
ModemManager setup:
.Bd -literal -compact
$> sudo mmcli -m any --messaging-list-sms
$> sudo mmcli -m 0 --messaging-list-sms
/org/freedesktop/ModemManager1/SMS/0 (received)
$> sudo mmcli -s 0 --create-file-with-data=/path/to/the/output/file
@@ -878,7 +872,7 @@ if you have more than one modem, just use --list-modems to check the
proper modem index:
.Bd -literal -compact
$ mmcli -m any --location-status
$ mmcli -m 0 --location-status
----------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea
| enabled: none
@@ -890,10 +884,10 @@ ID, GPS raw and GPS-NMEA location sources. None is enabled yet, as we
didn’t enable the modem, which we can do issuing:
.Bd -literal -compact
$ sudo mmcli -m any --enable
$ sudo mmcli -m 0 --enable
successfully enabled the modem
$ mmcli -m any --location-status
$ mmcli -m 0 --location-status
----------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea
| enabled: 3gpp-lac-ci
@@ -905,7 +899,7 @@ didn’t enable the modem, which we can do issuing:
We can start the GPS engine by enabling the RAW or NMEA GPS location sources:
.Bd -literal -compact
$ sudo mmcli -m any \\
$ sudo mmcli -m 0 \\
--location-enable-gps-raw \\
--location-enable-gps-nmea
successfully setup location gathering
@@ -914,7 +908,7 @@ We can start the GPS engine by enabling the RAW or NMEA GPS location sources:
If we do check again the status, we’ll see the GPS-specific locations are enabled:
.Bd -literal -compact
$ mmcli -m any --location-status
$ mmcli -m 0 --location-status
--------------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea
| enabled: 3gpp-lac-ci, gps-raw, gps-nmea
@@ -928,7 +922,7 @@ If any of the specific outputs is not available, the corresponding section will
be omitted from the output.
.Bd -literal -compact
$ sudo mmcli -m any --location-get
$ sudo mmcli -m 0 --location-get
-------------------------
3GPP location | Mobile country code: 214
| Mobile network code: 3
@@ -945,33 +939,6 @@ be omitted from the output.
| $GPVTG,,T,,M,,N,,K,N*2C
.Ed
Location information may be continuously monitored using
\fB\-\-location\-monitor\fR, which watches 'Location' property updates. Note
that these updates must first be enabled with
\fB\-\-location\-set\-enable\-signal\fR.
.Bd -literal -compact
$ sudo mmcli -m 0 --location-set-gps-refresh-rate=10
successfully set GPS refresh rate
$ sudo mmcli -m 0 --location-enable-gps-nmea --location-set-enable-signal
successfully setup location gathering
$ sudo mmcli -m 0 --location-monitor
-----------
GPS | nmea: $GPGSA,A,2,03,04,06,07,09,,,,,,,,1.7,1.4,1.0*3E
| $GPGSV,3,1,11,03,38,123,37,04,56,037,18,06,41,277,21,07,52,209,32*75
| $GPGSV,3,2,11,09,61,320,23,11,17,313,19,30,12,217,24,01,02,168,*77
| $GPGSV,3,3,11,16,21,077,,26,13,047,,40,,,36*79
| $GPGGA,152454.00,3651.420706,N,03101.297031,E,1,05,1.4,128.4,M,32.0,M,,*6A
-----------
GPS | nmea: $GPGSA,A,2,03,04,06,07,09,,,,,,,,1.7,1.4,1.0*3E
| $GPGSV,3,1,11,03,38,123,37,04,56,037,24,06,41,277,20,07,52,209,33*7A
| $GPGSV,3,2,11,09,61,320,23,11,17,313,18,30,12,217,23,01,02,168,*71
| $GPGSV,3,3,11,16,21,077,,26,13,047,,40,,,36*79
| $GPGGA,152504.00,3651.420036,N,03101.297176,E,1,05,1.4,60.7,M,32.0,M,,*56
.Ed
.SS A-GPS support
If A-GPS is enabled before starting the GPS engine, and if a data connection
@@ -983,7 +950,7 @@ enabled. An explicit output (RAW or NMEA) is required to be enabled in order
to start the GPS engine.
.Bd -literal -compact
$ mmcli -m any --location-status
$ mmcli -m 0 --location-status
--------------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
| enabled: 3gpp-lac-ci
@@ -992,13 +959,13 @@ to start the GPS engine.
GPS | refresh rate: 30 seconds
| a-gps supl server: supl.google.com:7276
$ sudo mmcli -m any --location-enable-agps-msa
$ sudo mmcli -m 0 --location-enable-agps-msa
successfully setup location gathering
$ sudo mmcli -m any --location-enable-gps-nmea
$ sudo mmcli -m 0 --location-enable-gps-nmea
successfully setup location gathering
$ sudo mmcli -m any --location-enable-gps-raw
$ sudo mmcli -m 0 --location-enable-gps-raw
successfully setup location gathering
.Ed
@@ -1014,7 +981,7 @@ one of the servers listed by ModemManager and manually inject it afterwards. The
XTRA assistance data is usually valid for several days.
.Bd -literal -compact
$ mmcli -m any --location-status
$ mmcli -m 0 --location-status
--------------------------------
Location | capabilities: 3gpp-lac-ci, gps-raw, gps-nmea, agps-msa, agps-msb
| enabled: 3gpp-lac-ci
@@ -1029,13 +996,13 @@ XTRA assistance data is usually valid for several days.
$ wget -q https://xtrapath3.izatcloud.net/xtra3grcej.bin
$ sudo mmcli -m any --location-inject-assistance-data=./xtra3grcej.bin
$ sudo mmcli -m 0 --location-inject-assistance-data=./xtra3grcej.bin
successfully injected assistance data
$ sudo mmcli -m any --location-enable-gps-nmea
$ sudo mmcli -m 0 --location-enable-gps-nmea
successfully setup location gathering
$ sudo mmcli -m any --location-enable-gps-raw
$ sudo mmcli -m 0 --location-enable-gps-raw
successfully setup location gathering
.Ed
@@ -1044,7 +1011,7 @@ XTRA assistance data is usually valid for several days.
The channel list can be set as a comma separated list of channels or channel intervals:
.Bd -literal -compact
$ sudo mmcli -m any \\
$ sudo mmcli -m 0 \\
--cell-broadcast-set-channels=5370,5371,5373-5000
successfully set channels in the modem
.Ed
@@ -1057,7 +1024,7 @@ example, you could gather all the main status information of the modem
with a single call and then parse it to read single fields:
.Bd -literal -compact
$ STATUS=$(mmcli -m any --output-keyvalue)
$ STATUS=$(mmcli -m 0 --output-keyvalue)
$ echo "${STATUS}" | grep "modem.generic.state " | awk -F ": " '{ print $2 }'
failed
$ echo "${STATUS}" | grep "modem.generic.state-failed-reason " | awk -F ": " '{ print $2 }'
@@ -229,7 +229,6 @@ ID_MM_TTY_BAUDRATE
ID_MM_TTY_FLOW_CONTROL
ID_MM_REQUIRED
ID_MM_MAX_MULTIPLEXED_LINKS
ID_MM_INITIAL_QMAP_MUX_ID
<SUBSECTION Deprecated>
ID_MM_TTY_BLACKLIST
ID_MM_TTY_MANUAL_SCAN_ONLY
@@ -1448,7 +1448,6 @@ mm_bearer_dup_path
mm_bearer_get_interface
mm_bearer_dup_interface
mm_bearer_get_connected
mm_bearer_get_disconnect_request
mm_bearer_get_suspended
mm_bearer_get_multiplexed
mm_bearer_get_ip_timeout
@@ -2346,7 +2345,6 @@ mm_gdbus_bearer_dup_properties
mm_gdbus_bearer_get_connected
mm_gdbus_bearer_get_connection_error
mm_gdbus_bearer_dup_connection_error
mm_gdbus_bearer_get_disconnect_request
mm_gdbus_bearer_get_suspended
mm_gdbus_bearer_get_multiplexed
mm_gdbus_bearer_get_bearer_type
@@ -2365,7 +2363,6 @@ mm_gdbus_bearer_call_disconnect_sync
mm_gdbus_bearer_interface_info
mm_gdbus_bearer_set_connected
mm_gdbus_bearer_set_connection_error
mm_gdbus_bearer_set_disconnect_request
mm_gdbus_bearer_set_interface
mm_gdbus_bearer_set_ip4_config
mm_gdbus_bearer_set_ip6_config
@@ -2825,8 +2822,6 @@ mm_gdbus_modem_get_primary_port
mm_gdbus_modem_dup_primary_port
mm_gdbus_modem_get_ports
mm_gdbus_modem_dup_ports
mm_gdbus_modem_get_ignored_ports
mm_gdbus_modem_dup_ignored_ports
mm_gdbus_modem_get_revision
mm_gdbus_modem_dup_revision
mm_gdbus_modem_get_carrier_configuration
@@ -2913,7 +2908,6 @@ mm_gdbus_modem_set_own_numbers
mm_gdbus_modem_set_plugin
mm_gdbus_modem_set_primary_port
mm_gdbus_modem_set_ports
mm_gdbus_modem_set_ignored_ports
mm_gdbus_modem_set_revision
mm_gdbus_modem_set_carrier_configuration
mm_gdbus_modem_set_carrier_configuration_revision
+1 -4
View File
@@ -386,7 +386,6 @@ typedef enum { /*< underscore_name=mm_modem_mode >*/
* @MM_MODEM_BAND_EUTRAN_70: E-UTRAN band 70. Since 1.8.
* @MM_MODEM_BAND_EUTRAN_71: E-UTRAN band 71. Since 1.8.
* @MM_MODEM_BAND_EUTRAN_85: E-UTRAN band 85. Since 1.20.
* @MM_MODEM_BAND_EUTRAN_106: E-UTRAN band 106. Since 1.26.
* @MM_MODEM_BAND_CDMA_BC0: CDMA Band Class 0 (US Cellular 850MHz). Since 1.8.
* @MM_MODEM_BAND_CDMA_BC1: CDMA Band Class 1 (US PCS 1900MHz). Since 1.8.
* @MM_MODEM_BAND_CDMA_BC2: CDMA Band Class 2 (UK TACS 900MHz). Since 1.8.
@@ -653,9 +652,7 @@ typedef enum { /*< underscore_name=mm_modem_band >*/
MM_MODEM_BAND_NGRAN_257 = 557,
MM_MODEM_BAND_NGRAN_258 = 558,
MM_MODEM_BAND_NGRAN_260 = 560,
MM_MODEM_BAND_NGRAN_261 = 561,
/* LTE bands > 97 follow EUTRAN numbering + 1000 as offset */
MM_MODEM_BAND_EUTRAN_106 = 1136
MM_MODEM_BAND_NGRAN_261 = 561
} MMModemBand;
/**
-2
View File
@@ -521,7 +521,6 @@ typedef enum { /*< underscore_name=mm_connection_error >*/
* @MM_SERIAL_ERROR_NOT_OPEN: The serial port is not open.
* @MM_SERIAL_ERROR_PARSE_FAILED: The serial port specific parsing failed.
* @MM_SERIAL_ERROR_FRAME_NOT_FOUND: The serial port reported that the frame marker wasn't found (e.g. for QCDM). Since 1.6.
* @MM_SERIAL_ERROR_SEND_TIMEOUT: Could not write once again to the serial device.
*
* Serial errors that may be reported by ModemManager.
*
@@ -537,7 +536,6 @@ typedef enum { /*< underscore_name=mm_serial_error >*/
MM_SERIAL_ERROR_NOT_OPEN = 6, /*< nick=NotOpen >*/
MM_SERIAL_ERROR_PARSE_FAILED = 7, /*< nick=ParseFailed >*/
MM_SERIAL_ERROR_FRAME_NOT_FOUND = 8, /*< nick=FrameNotFound >*/
MM_SERIAL_ERROR_SEND_TIMEOUT = 9, /*< nick=SendTimeout >*/
} MMSerialError;
/**
-43
View File
@@ -323,49 +323,6 @@
*/
#define ID_MM_TTY_AT_PROBE_TRIES "ID_MM_TTY_AT_PROBE_TRIES"
/**
* ID_MM_INITIAL_QMAP_MUX_ID:
*
* This is a device-specific tag that allows users to specify the initial value
* of the QMAP multiplexed id to be used.
*
* An integer value greater or equal than 1 and smaller than 255.
*
* This setting does nothing if the modem doesn't support multiplexing.
*
* Since: 1.26
*/
#define ID_MM_INITIAL_QMAP_MUX_ID "ID_MM_INITIAL_QMAP_MUX_ID"
/**
* ID_MM_AT_NETWORK_TIME_BROKEN:
*
* This is a device-specific tag that allows users to prevent ModemManager from
* attempting to read network time using AT commands, even if the device
* supports them.
*
* An integer value of 1 prevents reading network time with AT commands.
*
* Since: 1.26
*/
#define ID_MM_AT_NETWORK_TIME_BROKEN "ID_MM_AT_NETWORK_TIME_BROKEN"
/**
* ID_MM_MAX_TIMEOUTS:
*
* This is a device-specific tag that allows users to specify the maximum number
* of consecutive command timeouts allowed before the modem is marked as invalid
* and re-probed.
*
* An integer value greater or equal than 0 must be given. The value 0 in this
* tag completely disables the timeout monitoring feature.
*
* If not given, the default value of 10 consecutive timeouts is used.
*
* Since: 1.26
*/
#define ID_MM_MAX_TIMEOUTS "ID_MM_MAX_TIMEOUTS"
/*
* The following symbols are deprecated. We don't add them to -compat
* because this -tags file is not really part of the installed API.
@@ -115,16 +115,6 @@
-->
<property name="ConnectionError" type="(ss)" access="read" />
<!--
DisconnectRequest:
Indicates that the bearer is no longer useable and the connection
manager should terminate it as soon as possible.
Since: 1.26
-->
<property name="DisconnectRequest" type="b" access="read" />
<!--
Suspended:
@@ -103,15 +103,9 @@
<!--
SendDtmf:
@dtmf: A string of DTMF tone identifiers [0-9A-D*#] and/or pause characters [,].
@dtmf: DTMF tone identifier [0-9A-D*#].
Send one or more DTMF tones (Dual Tone Multi-Frequency) (only on supported modems).
Before 1.26 only the first character in @dtmf was sent to the modem;
all others were discarded.
Since 1.26 up to 50 tone identifiers are accepted and each will be
sent to the modem in the order given. The comma [,] character pauses
DTMF tones for two-seconds then continues with the remaining characters.
Send a DTMF tone (Dual Tone Multi-Frequency) (only on supported modem).
Applicable only if state is <link linkend="MM-CALL-STATE-ACTIVE:CAPS"><constant>MM_CALL_STATE_ACTIVE</constant></link>.
@@ -125,7 +119,7 @@
DtmfReceived:
@dtmf: DTMF tone identifier [0-9A-D*#].
Emitted when a DTMF tone is received (only on supported modems)
Emitted when a DTMF tone is received (only on supported modem)
Since: 1.6
-->
@@ -238,18 +232,5 @@
Since: 1.10
-->
<property name="AudioFormat" type="a{sv}" access="read" />
<!--
DtmfToneDuration:
The length of DTMF tones, in milliseconds. Valid range is 100ms to
1000ms and is rounded up to the next 100ms if not evenly divisble
by 100. Set the duration by passing this property to
<link linkend="gdbus-method-org-freedesktop-ModemManager1-Voice.CreateCall">CreateCall()</link>
at call creation time.
Since: 1.26
-->
<property name="DtmfToneDuration" type="u" access="read" />
</interface>
</node>
@@ -65,14 +65,5 @@
-->
<property name="Update" type="u" access="read" />
<!--
Language:
The language of the CBM as ISO639 two letter code
Since: 1.26
-->
<property name="Language" type="s" access="read" />
</interface>
</node>
@@ -922,7 +922,7 @@
In Linux for example, this points to a sysfs path of the usb_device
object.
This value may also be set by the user using the ID_MM_PHYSDEV_UID udev
This value may also be set by the user using the MM_ID_PHYSDEV_UID udev
tag (e.g. binding the tag to a specific sysfs path).
Since: 1.0
@@ -973,27 +973,15 @@
<!--
Ports:
The list of used ports in the modem, given as an array of string and
unsigned integer pairs. The string is the port name or path, and the
integer is the port type given as a
The list of ports in the modem, given as an array of string and unsigned
integer pairs. The string is the port name or path, and the integer is
the port type given as a
<link linkend="MMModemPortType">MMModemPortType</link> value.
Since: 1.0
-->
<property name="Ports" type="a(su)" access="read" />
<!--
IgnoredPorts:
The list of ignored ports in the modem, given as an array of string and
unsigned integer pairs. The string is the port name or path, and the
integer is the port type given as a
<link linkend="MMModemPortType">MMModemPortType</link> value.
Since: 1.26
-->
<property name="IgnoredPorts" type="a(su)" access="read" />
<!--
EquipmentIdentifier:
-21
View File
@@ -517,27 +517,6 @@ PROPERTY_ERROR_DEFINE_FAILABLE (connection_error,
/*****************************************************************************/
/**
* mm_bearer_get_disconnect_request:
* @self: A #MMBearer.
*
* Gets whether a disconnect request is pending for this bearer
*
* Returns: %TRUE if the #MMBearer is waiting for disconnection,
* #FALSE otherwise.
*
* Since: 1.26
*/
gboolean
mm_bearer_get_disconnect_request (MMBearer *self)
{
g_return_val_if_fail (MM_IS_BEARER (self), FALSE);
return mm_gdbus_bearer_get_disconnect_request (MM_GDBUS_BEARER (self));
}
/*****************************************************************************/
/**
* mm_bearer_connect_finish:
* @self: A #MMBearer.
-2
View File
@@ -76,8 +76,6 @@ gchar *mm_bearer_dup_interface (MMBearer *self);
gboolean mm_bearer_get_connected (MMBearer *self);
gboolean mm_bearer_get_disconnect_request (MMBearer *self);
gboolean mm_bearer_get_reload_stats_supported (MMBearer *self);
gboolean mm_bearer_get_suspended (MMBearer *self);
+3 -78
View File
@@ -44,12 +44,10 @@
G_DEFINE_TYPE (MMCallProperties, mm_call_properties, G_TYPE_OBJECT)
#define PROPERTY_NUMBER "number"
#define PROPERTY_DTMF_TONE_DURATION "dtmf-tone-duration"
#define PROPERTY_NUMBER "number"
struct _MMCallPropertiesPrivate {
gchar *number;
guint dtmf_tone_duration;
};
/*****************************************************************************/
@@ -94,43 +92,6 @@ mm_call_properties_get_number (MMCallProperties *self)
/*****************************************************************************/
/**
* mm_call_properties_set_dtmf_tone_duration:
* @self: A #MMCallProperties.
* @duration_ms: The desired duration of DTMF tones in milliseconds.
*
* Sets the DTMF tone duration if supported by the modem.
*
* Since: 1.26
*/
void
mm_call_properties_set_dtmf_tone_duration (MMCallProperties *self,
const guint duration_ms)
{
g_return_if_fail (MM_IS_CALL_PROPERTIES (self));
self->priv->dtmf_tone_duration = duration_ms;
}
/**
* mm_call_properties_get_dtmf_tone_duration:
* @self: A #MMCallProperties.
*
* Gets the desired DTMF tone duration in milliseconds.
*
* Returns: the DTMF tone duration in milliseconds.
*
* Since: 1.26
*/
guint
mm_call_properties_get_dtmf_tone_duration (MMCallProperties *self)
{
g_return_val_if_fail (MM_IS_CALL_PROPERTIES (self), 0);
return self->priv->dtmf_tone_duration;
}
/*****************************************************************************/
/*
* mm_call_properties_get_dictionary: (skip)
*/
@@ -153,12 +114,6 @@ mm_call_properties_get_dictionary (MMCallProperties *self)
PROPERTY_NUMBER,
g_variant_new_string (self->priv->number));
if (self->priv->dtmf_tone_duration)
g_variant_builder_add (&builder,
"{sv}",
PROPERTY_DTMF_TONE_DURATION,
g_variant_new_uint32 (self->priv->dtmf_tone_duration));
return g_variant_ref_sink (g_variant_builder_end (&builder));
}
@@ -171,18 +126,6 @@ consume_string (MMCallProperties *self,
{
if (g_str_equal (key, PROPERTY_NUMBER)) {
mm_call_properties_set_number (self, value);
} else if (g_str_equal (key, PROPERTY_DTMF_TONE_DURATION)) {
guint num;
if (!mm_get_uint_from_str (value, &num)) {
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
"Failed to parse DTMF tone duration from value '%s'",
value);
return FALSE;
}
mm_call_properties_set_dtmf_tone_duration (self, num);
} else {
g_set_error (error,
MM_CORE_ERROR,
@@ -246,29 +189,11 @@ consume_variant (MMCallProperties *properties,
GVariant *value,
GError **error)
{
if (g_str_equal (key, PROPERTY_NUMBER)) {
if (!g_variant_is_of_type (value, G_VARIANT_TYPE_STRING)) {
g_set_error_literal (error,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
"Invalid properties dictionary; number not a string");
return FALSE;
}
if (g_str_equal (key, PROPERTY_NUMBER))
mm_call_properties_set_number (
properties,
g_variant_get_string (value, NULL));
} else if (g_str_equal (key, PROPERTY_DTMF_TONE_DURATION)) {
if (!g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32)) {
g_set_error_literal (error,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
"Invalid properties dictionary; dtmf-tone-duration not a uint32");
return FALSE;
}
mm_call_properties_set_dtmf_tone_duration (
properties,
g_variant_get_uint32 (value));
} else {
else {
/* Set error */
g_set_error (error,
MM_CORE_ERROR,
-4
View File
@@ -68,10 +68,6 @@ void mm_call_properties_set_number (MMCallProperties *self,
const gchar *text);
const gchar *mm_call_properties_get_number (MMCallProperties *self);
void mm_call_properties_set_dtmf_tone_duration (MMCallProperties *self,
const guint duration_ms);
guint mm_call_properties_get_dtmf_tone_duration (MMCallProperties *self);
/*****************************************************************************/
/* ModemManager/libmm-glib/mmcli specific methods */
-46
View File
@@ -215,52 +215,6 @@ mm_cbm_get_update (MMCbm *self)
/*****************************************************************************/
/**
* mm_cbm_get_language:
* @self: A #MMCbm.
*
* Gets the language the message is in as ISO639 two letter code
*
* <warning>The returned value is only valid until the property changes so it is
* only safe to use this function on the thread where @self was constructed. Use
* mm_cbm_dup_language() if on another thread.</warning>
*
* Returns: (transfer none): The message's language, or %NULL if unknown
*
* Since: 1.26
*/
const gchar *
mm_cbm_get_language (MMCbm *self)
{
g_return_val_if_fail (MM_IS_CBM (self), NULL);
RETURN_NON_EMPTY_CONSTANT_STRING (
mm_gdbus_cbm_get_language (MM_GDBUS_CBM (self)));
}
/**
* mm_cbm_dup_language:
* @self: A #MMCbm.
*
* Gets the language the message is in as ISO639 two letter code
*
* Returns: (transfer full): The message lang, or %NULL if it doesn't contain
* any (e.g. contains data instead). The returned value should be freed with
* g_free().
*
* Since: 1.26
*/
gchar *
mm_cbm_dup_language (MMCbm *self)
{
g_return_val_if_fail (MM_IS_CBM (self), NULL);
RETURN_NON_EMPTY_STRING (
mm_gdbus_cbm_dup_language (MM_GDBUS_CBM (self)));
}
/*****************************************************************************/
static void
mm_cbm_init (MMCbm *self)
{
-3
View File
@@ -75,9 +75,6 @@ guint mm_cbm_get_channel (MMCbm *self);
guint mm_cbm_get_message_code (MMCbm *self);
guint mm_cbm_get_update (MMCbm *self);
const gchar *mm_cbm_get_language (MMCbm *self);
gchar *mm_cbm_dup_language (MMCbm *self);
G_END_DECLS
#endif /* _MM_CBM_H_ */
+2 -2
View File
@@ -94,7 +94,7 @@ mm_cell_info_gsm_set_operator_id (MMCellInfoGsm *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Location Area Code, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
@@ -126,7 +126,7 @@ mm_cell_info_gsm_set_lac (MMCellInfoGsm *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Cell Identifier, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
+3 -3
View File
@@ -101,7 +101,7 @@ mm_cell_info_lte_set_operator_id (MMCellInfoLte *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Tracking Area Code, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
@@ -133,7 +133,7 @@ mm_cell_info_lte_set_tac (MMCellInfoLte *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Cell Identifier, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
@@ -165,7 +165,7 @@ mm_cell_info_lte_set_ci (MMCellInfoLte *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the physical cell identifier, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
+3 -3
View File
@@ -103,7 +103,7 @@ mm_cell_info_nr5g_set_operator_id (MMCellInfoNr5g *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Tracking Area Code, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
@@ -135,7 +135,7 @@ mm_cell_info_nr5g_set_tac (MMCellInfoNr5g *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Cell Identifier, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
@@ -167,7 +167,7 @@ mm_cell_info_nr5g_set_ci (MMCellInfoNr5g *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the physical cell identifier, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
+2 -2
View File
@@ -96,7 +96,7 @@ mm_cell_info_tdscdma_set_operator_id (MMCellInfoTdscdma *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Location Area Code, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
@@ -128,7 +128,7 @@ mm_cell_info_tdscdma_set_lac (MMCellInfoTdscdma *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Cell Identifier, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
+2 -2
View File
@@ -102,7 +102,7 @@ mm_cell_info_umts_set_operator_id (MMCellInfoUmts *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Location Area Code, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
@@ -134,7 +134,7 @@ mm_cell_info_umts_set_lac (MMCellInfoUmts *self,
* Encoded in upper-case hexadecimal format without leading zeros,
* as specified in 3GPP TS 27.007.
*
* Returns: (transfer none): the Cell Identifier, or %NULL if not available.
* Returns: (transfer none): the MCCMNC, or %NULL if not available.
*
* Since: 1.20
*/
+1 -3
View File
@@ -1314,9 +1314,7 @@ mm_common_band_is_utran (MMModemBand band)
gboolean
mm_common_band_is_eutran (MMModemBand band)
{
return ((band >= MM_MODEM_BAND_EUTRAN_1 && band <= MM_MODEM_BAND_EUTRAN_71) ||
(band == MM_MODEM_BAND_EUTRAN_85) ||
(band == MM_MODEM_BAND_EUTRAN_106));
return (band >= MM_MODEM_BAND_EUTRAN_1 && band <= MM_MODEM_BAND_EUTRAN_71);
}
gboolean
+29 -61
View File
@@ -45,20 +45,16 @@ G_DEFINE_TYPE (MMLocationGpsNmea, mm_location_gps_nmea, G_TYPE_OBJECT)
struct _MMLocationGpsNmeaPrivate {
GHashTable *traces;
gchar *sequence_last_trace;
gchar *sequence_last_trace_type;
GRegex *sequence_regex;
GRegex *sequence_regex;
};
/*****************************************************************************/
static gboolean
is_sequence_trace_type (MMLocationGpsNmea *self,
const gchar *trace,
gboolean *first)
check_append_or_replace (MMLocationGpsNmea *self,
const gchar *trace)
{
g_autoptr(GMatchInfo) match_info = NULL;
guint index;
if (G_UNLIKELY (!self->priv->sequence_regex))
self->priv->sequence_regex = g_regex_new ("\\$..(?:ALM|GSV|RTE|SFI),(\\d),(\\d).*",
@@ -66,31 +62,30 @@ is_sequence_trace_type (MMLocationGpsNmea *self,
0,
NULL);
*first = FALSE;
if (g_regex_match (self->priv->sequence_regex, trace, 0, &match_info)) {
if (mm_get_uint_from_match_info (match_info, 2, &index)) {
*first = (index == 1);
guint index;
/* If we don't have the first element of a sequence, append */
if (mm_get_uint_from_match_info (match_info, 2, &index) && index != 1)
return TRUE;
}
}
/* By default, replace */
return FALSE;
}
static gboolean
location_gps_nmea_take_trace (MMLocationGpsNmea *self,
gchar *_trace)
gchar *trace)
{
gchar *i;
g_autofree gchar *trace_type = NULL;
g_autofree gchar *trace = _trace;
g_autofree gchar *sequence = NULL;
gboolean first;
gboolean sequence_trace;
gchar *i;
gchar *trace_type;
i = strchr (trace, ',');
if (!i || i == trace)
if (!i || i == trace) {
g_free (trace);
return FALSE;
}
trace_type = g_malloc (i - trace + 1);
memcpy (trace_type, trace, i - trace);
@@ -99,58 +94,33 @@ location_gps_nmea_take_trace (MMLocationGpsNmea *self,
/* Some traces are part of a SEQUENCE; so we need to decide whether we
* completely replace the previous trace, or we append the new one to
* the already existing list */
sequence_trace = is_sequence_trace_type (self, trace, &first);
/* Save previous sequence trace, if
* new trace type is different or this is the first sequence trace */
if (self->priv->sequence_last_trace_type &&
self->priv->sequence_last_trace &&
(g_strcmp0 (self->priv->sequence_last_trace_type, trace_type) ||
(sequence_trace && first))) {
g_hash_table_replace (self->priv->traces,
g_steal_pointer (&self->priv->sequence_last_trace_type),
g_steal_pointer (&self->priv->sequence_last_trace));
}
if (!sequence_trace) {
g_hash_table_replace (self->priv->traces,
g_steal_pointer (&trace_type),
g_steal_pointer (&trace));
return TRUE;
}
/* Process the trace as part of a sequence. */
if (first) {
/* Record first record in the sequence */
sequence = g_steal_pointer (&trace);
} else {
if (check_append_or_replace (self, trace)) {
/* Append */
const gchar *previous = self->priv->sequence_last_trace;
if (!previous)
previous = g_hash_table_lookup (self->priv->traces, trace_type);
const gchar *previous;
previous = g_hash_table_lookup (self->priv->traces, trace_type);
if (previous) {
gchar *sequence;
/* Skip the trace if we already have it there */
if (strstr (previous, trace))
if (strstr (previous, trace)) {
g_free (trace_type);
g_free (trace);
return TRUE;
}
sequence = g_strdup_printf ("%s%s%s",
previous,
g_str_has_suffix (previous, "\r\n") ? "" : "\r\n",
trace);
} else {
/* No previous records, record first record in the sequence */
sequence = g_steal_pointer (&trace);
g_free (trace);
trace = sequence;
}
}
g_clear_pointer (&self->priv->sequence_last_trace, g_free);
self->priv->sequence_last_trace = g_steal_pointer (&sequence);
g_clear_pointer (&self->priv->sequence_last_trace_type, g_free);
self->priv->sequence_last_trace_type = g_steal_pointer (&trace_type);
g_hash_table_replace (self->priv->traces,
trace_type,
trace);
return TRUE;
}
@@ -321,8 +291,6 @@ finalize (GObject *object)
g_hash_table_destroy (self->priv->traces);
if (self->priv->sequence_regex)
g_regex_unref (self->priv->sequence_regex);
g_free (self->priv->sequence_last_trace);
g_free (self->priv->sequence_last_trace_type);
G_OBJECT_CLASS (mm_location_gps_nmea_parent_class)->finalize (object);
}
+1 -42
View File
@@ -47,7 +47,6 @@ struct _MMModemPrivate {
GMutex mutex;
PROPERTY_ARRAY_DECLARE (ports)
PROPERTY_ARRAY_DECLARE (ignored_ports)
PROPERTY_ARRAY_DECLARE (supported_modes)
PROPERTY_ARRAY_DECLARE (supported_capabilities)
PROPERTY_ARRAY_DECLARE (supported_bands)
@@ -985,7 +984,7 @@ mm_modem_dup_primary_port (MMModem *self)
* mm_modem_port_info_array_free() when no longer needed.
* @n_ports: (out): Return location for the number of values in @ports.
*
* Gets the list of used ports in the modem.
* Gets the list of ports in the modem.
*
* Returns: %TRUE if @ports and @n_ports are set, %FALSE otherwise.
*
@@ -1000,44 +999,6 @@ PROPERTY_ARRAY_DEFINE_DEEP (ports,
/*****************************************************************************/
/**
* mm_modem_peek_ignored_ports:
* @self: A #MMModem.
* @ports: (out) (array length=n_ports) (transfer none): Return location for the
* array of #MMModemPortInfo values. Do not free the returned value, it is
* owned by @self.
* @n_ports: (out): Return location for the number of values in @ports.
*
* Gets the list of ignored ports in the modem.
*
* Returns: %TRUE if @ports and @n_ports are set, %FALSE otherwise.
*
* Since: 1.26
*/
/**
* mm_modem_get_ignored_ports:
* @self: A #MMModem.
* @ports: (out) (array length=n_ports): Return location for the array of
* #MMModemPortInfo values. The returned array should be freed with
* mm_modem_port_info_array_free() when no longer needed.
* @n_ports: (out): Return location for the number of values in @ports.
*
* Gets the list of ignored ports in the modem.
*
* Returns: %TRUE if @ports and @n_ports are set, %FALSE otherwise.
*
* Since: 1.26
*/
PROPERTY_ARRAY_DEFINE_DEEP (ignored_ports,
Modem, modem, MODEM,
MMModemPortInfo,
mm_common_ports_variant_to_garray,
mm_common_ports_garray_to_array)
/*****************************************************************************/
/**
* mm_modem_get_equipment_identifier:
* @self: A #MMModem.
@@ -3469,7 +3430,6 @@ mm_modem_init (MMModem *self)
g_mutex_init (&self->priv->mutex);
PROPERTY_INITIALIZE (ports, "ports")
PROPERTY_INITIALIZE (ignored_ports, "ignored-ports")
PROPERTY_INITIALIZE (supported_modes, "supported-modes")
PROPERTY_INITIALIZE (supported_capabilities, "supported-capabilities")
PROPERTY_INITIALIZE (supported_bands, "supported-bands")
@@ -3485,7 +3445,6 @@ finalize (GObject *object)
g_mutex_clear (&self->priv->mutex);
PROPERTY_ARRAY_FINALIZE (ports)
PROPERTY_ARRAY_FINALIZE (ignored_ports)
PROPERTY_ARRAY_FINALIZE (supported_modes)
PROPERTY_ARRAY_FINALIZE (supported_capabilities)
PROPERTY_ARRAY_FINALIZE (supported_bands)
-8
View File
@@ -138,14 +138,6 @@ gboolean mm_modem_get_ports (MMModem *self,
MMModemPortInfo **ports,
guint *n_ports);
gboolean mm_modem_peek_ignored_ports (MMModem *self,
const MMModemPortInfo **ports,
guint *n_ports);
gboolean mm_modem_get_ignored_ports (MMModem *self,
MMModemPortInfo **ports,
guint *n_ports);
const gchar *mm_modem_get_equipment_identifier (MMModem *self);
gchar *mm_modem_dup_equipment_identifier (MMModem *self);
-1
View File
@@ -4,7 +4,6 @@
test_units = [
'common-helpers',
'pco',
'location-gps-nmea',
]
foreach test_unit: test_units
-376
View File
@@ -1,376 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2026 Dan Williams <dan@ioncontrol.co>
* Copyright (C) 2026 Andrey Skvortsov <andrej.skvortzov@gmail.com>
*/
#include <glib.h>
#include <libmm-glib.h>
#include <string.h>
static gchar *
combine_traces (const gchar *traces[],
const guint num_traces,
gboolean trailing_crlf)
{
guint i;
GString *all = g_string_new ("");
for (i = 0; i < num_traces; i++) {
g_string_append (all, traces[i]);
if (i != num_traces - 1) {
g_string_append_c (all, '\r');
g_string_append_c (all, '\n');
}
}
return g_string_free (all, FALSE);
}
static gchar *
get_trace_type (const gchar *trace)
{
gchar *trace_type = g_strdup (trace);
gchar *p;
p = strchr (trace_type, ',');
g_assert (p);
*p = '\0';
return trace_type;
}
/**************************************************************/
static void
test_round_trip (void)
{
MMLocationGpsNmea *nmea;
g_autofree gchar *combined_traces;
g_autofree gchar **all_traces;
GError *error = NULL;
guint traces_len;
guint i, j;
#define TRACE0 "$GNGGA,001626.000,,,,,0,00,25.5,,,,,,*79"
#define TRACE1 "$GPGSV,2,1,08,04,41,189,,07,49,311,28,08,67,149,25,09,55,237,18,0*68"
#define TRACE2 "$GPGSV,2,2,08,16,31,057,,21,05,153,,27,56,070,,30,19,303,,0*61"
#define TRACE3 "$BDGSV,1,1,00,0*74"
#define TRACE4 "$GNGGA,001626.000,,,,,0,00,25.5,,,,,,*79"
static const char *traces[] = { TRACE0, TRACE1, TRACE2, TRACE3, TRACE4 };
static const char *expected_traces[] = {
TRACE1 "\r\n" TRACE2,
TRACE3,
TRACE4,
};
combined_traces = combine_traces (traces, G_N_ELEMENTS (traces), TRUE);
nmea = mm_location_gps_nmea_new_from_string_variant (g_variant_new_string (combined_traces), &error);
g_assert_no_error (error);
for (i = 0; i < G_N_ELEMENTS (expected_traces); i++) {
g_autofree gchar *trace_type = get_trace_type (expected_traces[i]);
const gchar * trace;
trace = mm_location_gps_nmea_get_trace (nmea, trace_type);
g_assert_cmpstr (trace, ==, expected_traces[i]);
}
all_traces = mm_location_gps_nmea_get_traces (nmea);
traces_len = g_strv_length (all_traces);
g_assert_cmpint (traces_len, ==, G_N_ELEMENTS (expected_traces));
/* For each expected trace type, assert that trace type exists in the
* found traces, and matches the expected trace.
*/
for (i = 0; i < G_N_ELEMENTS (expected_traces); i++) {
g_autofree gchar *expected_type = get_trace_type (expected_traces[i]);
gboolean found = FALSE;
for (j = 0; j < traces_len; j++) {
g_autofree gchar *found_type = get_trace_type (all_traces[j]);
if (!g_strcmp0 (found_type, expected_type)) {
/* Found the trace type; compare */
g_assert_cmpstr (all_traces[j], ==, expected_traces[i]);
found = TRUE;
}
}
g_assert_true (found);
}
}
#undef TRACE0
#undef TRACE1
#undef TRACE2
#undef TRACE3
#undef TRACE4
/**************************************************************/
static void
test_append_sequence (void)
{
MMLocationGpsNmea *nmea;
GError *error = NULL;
g_autofree gchar *combined = NULL;
#define TRACE0 "$GNGGA,001626.000,,,,,0,00,25.5,,,,,,*79"
#define TRACE1 "$GPGSV,3,1,12,01,35,282,,02,68,264,,03,02,243,,08,35,206,,1*68"
#define TRACE2 "$GPGSV,3,2,12,10,46,074,,14,16,312,,17,,,,22,16,327,,1*53"
#define TRACE3 "$GPGSV,3,3,12,23,07,068,,24,15,030,,27,14,181,,32,51,120,,1*60"
#define TRACE4 "$BDGSV,1,1,00,0*74"
#define TRACE5 "$GNGGA,001626.000,,,,,0,00,25.6,,,,,,*79"
#define GPGSV_TYPE "$GPGSV"
#define BDGSV_TYPE "$BDGSV"
#define GNGGA_TYPE "$GNGGA"
static const gchar *gpgsvs[] = { TRACE1, TRACE2, TRACE3 };
nmea = mm_location_gps_nmea_new_from_string_variant (g_variant_new_string (TRACE0), &error);
g_assert_no_error (error);
/* No part of the GPGSV sequence should be found in traces until a new
* trace type is added.
*/
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE1));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE2));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE3));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
/* Add a new type, but it's also a sequence so it won't be found yet */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE4));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, BDGSV_TYPE), ==, NULL);
/* New type was just added, now we should find the $GPGSV too */
combined = combine_traces (gpgsvs, G_N_ELEMENTS (gpgsvs), FALSE);
g_assert (combined);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined);
/* Add a non-sequence trace */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE5));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GNGGA_TYPE), ==, TRACE5);
/* And now we should find the $BDGSV */
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, BDGSV_TYPE), ==, TRACE4);
}
#undef TRACE0
#undef TRACE1
#undef TRACE2
#undef TRACE3
#undef TRACE4
#undef TRACE5
/**************************************************************/
static void
test_append_sequence_interleaved (void)
{
MMLocationGpsNmea *nmea;
GError *error = NULL;
g_autofree gchar *combined_start = NULL;
g_autofree gchar *combined_full = NULL;
#define TRACE0 "$GNGGA,001626.000,,,,,0,00,25.5,,,,,,*79"
#define TRACE1 "$GPGSV,3,1,12,01,35,282,,02,68,264,,03,02,243,,08,35,206,,1*68"
#define TRACE2 "$GPGSV,3,2,12,10,46,074,,14,16,312,,17,,,,22,16,327,,1*53"
#define TRACE3 "$BDGSV,1,1,00,0*74"
#define TRACE4 "$GPGSV,3,3,12,23,07,068,,24,15,030,,27,14,181,,32,51,120,,1*60"
#define TRACE5 "$GNGGA,001626.000,,,,,0,00,25.6,,,,,,*79"
#define GPGSV_TYPE "$GPGSV"
#define BDGSV_TYPE "$BDGSV"
#define GNGGA_TYPE "$GNGGA"
static const gchar *gpgsvs_start[] = { TRACE1, TRACE2 };
static const gchar *gpgsvs_full[] = { TRACE1, TRACE2, TRACE4 };
nmea = mm_location_gps_nmea_new_from_string_variant (g_variant_new_string (TRACE0), &error);
g_assert_no_error (error);
/* No part of the GPGSV sequence should be found in traces until a new
* trace type is added.
*/
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE1));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE2));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
/* Add a new type, but it's also a sequence so it won't be found yet */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE3));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, BDGSV_TYPE), ==, NULL);
/* New type was just added, now first part of $GPGSV should be available */
combined_start = combine_traces (gpgsvs_start, G_N_ELEMENTS (gpgsvs_start), FALSE);
g_assert (combined_start);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined_start);
/* Add third GPGSV, but it won't be found yet, only previous GPGSV records
* But $BDGSV should be found now.
*/
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE4));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined_start);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, BDGSV_TYPE), ==, TRACE3);
/* Add a non-sequence trace */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE5));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GNGGA_TYPE), ==, TRACE5);
/* New type was just added, now we should find full $GPGSV sequence */
combined_full = combine_traces (gpgsvs_full, G_N_ELEMENTS (gpgsvs_full), FALSE);
g_assert (combined_full);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined_full);
}
#undef TRACE0
#undef TRACE1
#undef TRACE2
#undef TRACE3
#undef TRACE4
#undef TRACE5
/**************************************************************/
static void
test_append_multiple_sequences (void)
{
MMLocationGpsNmea *nmea;
GError *error = NULL;
g_autofree gchar *combined1 = NULL;
g_autofree gchar *combined2 = NULL;
#define TRACE0 "$GPGSV,3,1,12,01,35,282,,02,68,264,,03,02,243,,08,35,206,,1*68"
#define TRACE1 "$GPGSV,3,2,12,10,46,074,,14,16,312,,17,,,,22,16,327,,1*53"
#define TRACE2 "$GPGSV,3,3,12,23,07,068,,24,15,030,,27,14,181,,32,51,120,,1*60"
#define TRACE3 "$GPGSV,3,1,12,01,35,282,23,02,68,264,,03,02,243,,08,35,206,,1*69"
#define TRACE4 "$GPGSV,3,2,12,10,46,074,28,14,16,312,,17,,,,22,16,327,,1*59"
#define TRACE5 "$GPGSV,3,3,12,23,07,068,18,24,15,030,,27,14,181,,32,51,120,,1*69"
#define TRACE6 "$GPGSV,3,1,12,01,35,282,25,02,68,264,,03,02,243,,08,35,206,,1*6F"
#define GPGSV_TYPE "$GPGSV"
static const gchar *gpgsvs1[] = { TRACE0, TRACE1, TRACE2 };
static const gchar *gpgsvs2[] = { TRACE3, TRACE4, TRACE5 };
/* No part of the GPGSV sequence should be found in traces until a new
* trace sequence is added.
*/
nmea = mm_location_gps_nmea_new_from_string_variant (g_variant_new_string (TRACE0), &error);
g_assert_no_error (error);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE1));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE2));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
/* Add first record for next sequence, old sequence should be available */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE3));
combined1 = combine_traces (gpgsvs1, G_N_ELEMENTS (gpgsvs1), FALSE);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined1);
/* No part of new the GPGSV sequence should be found in traces until a new
* trace sequence is added.
*/
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE4));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined1);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE5));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined1);
/* Add first record for next sequence, updated sequence should be available */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE6));
combined2 = combine_traces (gpgsvs2, G_N_ELEMENTS (gpgsvs2), FALSE);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined2);
}
#undef TRACE0
#undef TRACE1
#undef TRACE2
#undef TRACE3
#undef TRACE4
#undef TRACE5
#undef TRACE6
/**************************************************************/
static void
test_start_from_incomplete_sequence (void)
{
MMLocationGpsNmea *nmea;
GError *error = NULL;
g_autofree gchar *combined = NULL;
#define TRACE0 "$GPGSV,3,3,12,23,07,068,,24,15,030,,27,14,181,,32,51,120,,1*60"
#define TRACE1 "$GNGGA,001626.000,,,,,0,00,25.5,,,,,,*79"
#define TRACE2 "$GPGSV,3,1,12,01,35,282,,02,68,264,,03,02,243,,08,35,206,,1*68"
#define TRACE3 "$GPGSV,3,2,12,10,46,074,,14,16,312,,17,,,,22,16,327,,1*53"
#define TRACE4 "$GPGSV,3,3,12,23,07,068,,24,15,030,,27,14,181,,32,51,120,,1*60"
#define TRACE5 "$GNGGA,001626.000,,,,,0,00,25.6,,,,,,*7A"
#define GPGSV_TYPE "$GPGSV"
#define GNGGA_TYPE "$GNGGA"
static const gchar *gpgsvs[] = { TRACE2, TRACE3, TRACE4 };
/* Start sequence not from the first record */
nmea = mm_location_gps_nmea_new_from_string_variant (g_variant_new_string (TRACE0), &error);
g_assert_no_error (error);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, NULL);
/* New type was just added, now we should find $GPGSV sequence */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE1));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GNGGA_TYPE), ==, TRACE1);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, TRACE0);
/* Add first record for next sequence, old sequence should be available */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE2));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, TRACE0);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE3));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, TRACE0);
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE4));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, TRACE0);
/* New type was just added, now we should find new full $GPGSV sequence */
g_assert (mm_location_gps_nmea_add_trace (nmea, TRACE5));
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GNGGA_TYPE), ==, TRACE5);
combined = combine_traces (gpgsvs, G_N_ELEMENTS (gpgsvs), FALSE);
g_assert_cmpstr (mm_location_gps_nmea_get_trace (nmea, GPGSV_TYPE), ==, combined);
}
#undef TRACE0
#undef TRACE1
#undef TRACE2
#undef TRACE3
#undef TRACE4
#undef TRACE5
/**************************************************************/
int main (int argc, char **argv)
{
g_test_init (&argc, &argv, NULL);
g_test_add_func ("/MM/Location/GPS/NMEA/round-trip", test_round_trip);
g_test_add_func ("/MM/Location/GPS/NMEA/append-sequence", test_append_sequence);
g_test_add_func ("/MM/Location/GPS/NMEA/append-sequence-interleaved", test_append_sequence_interleaved);
g_test_add_func ("/MM/Location/GPS/NMEA/append-multiple-sequences", test_append_multiple_sequences);
g_test_add_func ("/MM/Location/GPS/NMEA/start-from-incomplete-sequence", test_start_from_incomplete_sequence);
return g_test_run ();
}
-12
View File
@@ -672,24 +672,12 @@ qcdm_cmd_pilot_sets_result (const char *buf, size_t len, int *out_error)
QcdmResult *result = NULL;
DMCmdPilotSetsRsp *rsp = (DMCmdPilotSetsRsp *) buf;
size_t sets_len;
size_t total_count;
qcdm_return_val_if_fail (buf != NULL, NULL);
if (!check_command (buf, len, DIAG_CMD_PILOT_SETS, sizeof (DMCmdPilotSetsRsp), out_error))
return NULL;
/* Validate that the modem-supplied counts fit in the fixed sets[] array
* and in the actually-received response. */
total_count = (size_t) rsp->active_count + rsp->candidate_count + rsp->neighbor_count;
if (total_count > (sizeof (rsp->sets) / sizeof (rsp->sets[0])) ||
((sizeof (*rsp) - sizeof (rsp->sets)) + total_count * sizeof (DMCmdPilotSetsSet)) > len) {
qcdm_err (0, "DM Pilot Sets response counts out of range");
if (out_error)
*out_error = -QCDM_ERROR_RESPONSE_BAD_LENGTH;
return NULL;
}
result = qcdm_result_new ();
sets_len = rsp->active_count * sizeof (DMCmdPilotSetsSet);
-16
View File
@@ -88,7 +88,6 @@ qcdm_log_item_evdo_pilot_sets_v2_new (const char *buf, size_t len, int *out_erro
QcdmResult *result = NULL;
DMLogItemEvdoPilotSetsV2 *pilot_sets;
DMCmdLog *log_cmd = (DMCmdLog *) buf;
size_t avail;
size_t sets_len;
qcdm_return_val_if_fail (buf != NULL, NULL);
@@ -98,21 +97,6 @@ qcdm_log_item_evdo_pilot_sets_v2_new (const char *buf, size_t len, int *out_erro
pilot_sets = (DMLogItemEvdoPilotSetsV2 *) log_cmd->data;
/* Ensure the flexible sets[] array actually contains as many entries as
* the header claims; the modem fully controls these counts. check_log_item()
* guarantees len >= sizeof (DMCmdLog) + sizeof (DMLogItemEvdoPilotSetsV2),
* so 'avail' cannot underflow.*/
avail = len - sizeof (DMCmdLog) - sizeof (DMLogItemEvdoPilotSetsV2);
sets_len = ((size_t) pilot_sets->active_count
+ (size_t) pilot_sets->candidate_count
+ (size_t) pilot_sets->remaining_count)
* sizeof (DMLogItemEvdoPilotSetsV2Pilot);
if (sets_len > avail) {
if (out_error)
*out_error = -QCDM_ERROR_RESPONSE_BAD_LENGTH;
return NULL;
}
result = qcdm_result_new ();
sets_len = pilot_sets->active_count * sizeof (DMLogItemEvdoPilotSetsV2Pilot);
+4 -4
View File
@@ -95,16 +95,16 @@ qcdm_send (int fd, char *buf, size_t len)
while (i < len) {
errno = 0;
status = write (fd, &buf[i], len - i);
if (status <= 0) {
if (errno == EAGAIN || status == 0) {
status = write (fd, &buf[i], 1);
if (status < 0) {
if (errno == EAGAIN) {
eagain_count--;
if (eagain_count <= 0)
return FALSE;
} else
assert (errno == 0);
} else
i += status;
i++;
usleep (1000);
}
+4 -4
View File
@@ -95,16 +95,16 @@ qcdm_send (int fd, char *buf, size_t len)
while (i < len) {
errno = 0;
status = write (fd, &buf[i], len - i);
if (status <= 0) {
if (errno == EAGAIN || status == 0) {
status = write (fd, &buf[i], 1);
if (status < 0) {
if (errno == EAGAIN) {
eagain_count--;
if (eagain_count <= 0)
return FALSE;
} else
assert (errno == 0);
} else
i += status;
i++;
usleep (1000);
}
+4 -4
View File
@@ -96,16 +96,16 @@ qcdm_send (int fd, char *buf, size_t len)
while (i < len) {
errno = 0;
status = write (fd, &buf[i], len - i);
if (status <= 0) {
if (errno == EAGAIN || status == 0) {
status = write (fd, &buf[i], 1);
if (status < 0) {
if (errno == EAGAIN) {
eagain_count--;
if (eagain_count <= 0)
return FALSE;
} else
assert (errno == 0);
} else
i += status;
i++;
usleep (1000);
}
+16 -68
View File
@@ -3,14 +3,14 @@
project(
'ModemManager', 'c',
version: '1.25.95',
version: '1.24.2',
license: 'GPL2',
default_options: [
'buildtype=debugoptimized',
'c_std=gnu89',
'warning_level=2',
],
meson_version: '>= 0.60.0',
meson_version: '>= 0.53.0',
)
meson_version = meson.version()
@@ -31,13 +31,11 @@ mm_includedir = get_option('includedir')
mm_libdir = get_option('libdir')
mm_sbindir = get_option('sbindir')
mm_sysconfdir = get_option('sysconfdir')
mm_sharedstatedir = get_option('sharedstatedir')
mm_pkgdatadir = mm_datadir / mm_name
mm_pkgincludedir = mm_includedir / mm_name
mm_pkglibdir = mm_libdir / mm_name
mm_pkgsysconfdir = mm_sysconfdir / mm_name
mm_pkgsharedstatedir = mm_sharedstatedir / mm_name
mm_glib_name = 'libmm-glib'
mm_glib_pkgincludedir = mm_includedir / mm_glib_name
@@ -144,24 +142,7 @@ if get_option('buildtype').contains('debug')
])
endif
# Look for existing -DMM_DISABLE_DEPRECATED in CFLAGS
pymodule = import('python3')
python3 = pymodule.find_python()
res = run_command(python3, '-c', 'import os; print(os.environ["CFLAGS"])')
cflags_disable_deprecated = false
if res.returncode() == 0 and res.stdout().contains('-DMM_DISABLE_DEPRECATED')
cflags_disable_deprecated = true
endif
# Handle deprecation enable/disable
if get_option('deprecated')
cc_args += cc.get_supported_arguments('-Wno-deprecated-declarations')
else
if cflags_disable_deprecated == false
cc_args += '-DMM_DISABLE_DEPRECATED'
endif
cc_args += cc.get_supported_arguments('-Wdeprecated-declarations')
endif
add_project_arguments(common_args + cc_args, language: 'c')
glib_version = '2.56'
@@ -187,21 +168,21 @@ glib_deps = declare_dependency(
# DBus system directory
dbus_dep = dependency('dbus-1')
dbus_interfaces_dir = dbus_dep.get_variable(pkgconfig: 'interfaces_dir', pkgconfig_define: ['datadir', mm_datadir])
dbus_system_bus_services_dir = dbus_dep.get_variable(pkgconfig: 'system_bus_services_dir', pkgconfig_define: ['datadir', mm_datadir])
dbus_interfaces_dir = dbus_dep.get_pkgconfig_variable('interfaces_dir', define_variable: ['datadir', mm_datadir])
dbus_system_bus_services_dir = dbus_dep.get_pkgconfig_variable('system_bus_services_dir', define_variable: ['datadir', mm_datadir])
dbus_policy_dir = get_option('dbus_policy_dir')
if dbus_policy_dir == ''
dbus_policy_dir = dbus_dep.get_variable(pkgconfig: 'sysconfdir', pkgconfig_define: ['sysconfdir', mm_sysconfdir]) / 'dbus-1/system.d'
dbus_policy_dir = dbus_dep.get_pkgconfig_variable('sysconfdir', define_variable: ['sysconfdir', mm_sysconfdir]) / 'dbus-1/system.d'
endif
enable_bash_completion = get_option('bash_completion')
if enable_bash_completion
bash_completion_dep = dependency('bash-completion')
bash_completion_completionsdir = bash_completion_dep.get_variable(
pkgconfig: 'completionsdir',
bash_completion_completionsdir = bash_completion_dep.get_pkgconfig_variable(
'completionsdir',
# bash-completion 2.10 changed the substitutions
pkgconfig_define: bash_completion_dep.version().version_compare('>= 2.10') ? ['datadir', mm_datadir] : ['prefix', mm_prefix],
define_variable: bash_completion_dep.version().version_compare('>= 2.10') ? ['datadir', mm_datadir] : ['prefix', mm_prefix],
)
endif
@@ -216,7 +197,7 @@ config_h.set('WITH_UDEV', enable_udev)
udev_udevdir = get_option('udevdir')
if udev_udevdir == ''
assert(enable_udev, 'udevdir must be explicitly given if udev support is disabled')
udev_udevdir = dependency('udev').get_variable(pkgconfig: 'udevdir')
udev_udevdir = dependency('udev').get_pkgconfig_variable('udevdir')
endif
udev_rulesdir = udev_udevdir / 'rules.d'
@@ -226,7 +207,7 @@ install_systemdunitdir = (systemd_systemdsystemunitdir != 'no')
if install_systemdunitdir and systemd_systemdsystemunitdir == ''
systemd_dep = dependency('systemd', not_found_message: 'systemd required but not found, please provide a valid systemd user unit dir or disable it')
systemd_systemdsystemunitdir = systemd_dep.get_variable(pkgconfig: 'systemdsystemunitdir', pkgconfig_define: ['root_prefix', mm_prefix])
systemd_systemdsystemunitdir = systemd_dep.get_pkgconfig_variable('systemdsystemunitdir', define_variable: ['root_prefix', mm_prefix])
endif
# Suspend/resume support
@@ -259,7 +240,7 @@ enable_polkit = (polkit_opt != 'no')
if enable_polkit
polkit_gobject_dep = dependency('polkit-gobject-1', version: '>= 0.97', not_found_message: 'PolicyKit development headers are required')
polkit_gobject_policydir = polkit_gobject_dep.get_variable(pkgconfig: 'policydir', pkgconfig_define: ['prefix', mm_prefix])
polkit_gobject_policydir = polkit_gobject_dep.get_pkgconfig_variable('policydir', define_variable: ['prefix', mm_prefix])
policy_conf = {'MM_DEFAULT_USER_POLICY': (polkit_opt == 'permissive' ? 'yes' : 'auth_self_keep')}
endif
@@ -278,40 +259,14 @@ config_h.set('WITH_BUILTIN_PLUGINS', enable_builtin_plugins)
# MBIM support (enabled by default)
enable_mbim = get_option('mbim')
if enable_mbim
mbim_glib_dep = dependency('mbim-glib', version: '>= 1.32.0',
required: not get_option('subproject-fallback'))
if not mbim_glib_dep.found() and get_option('subproject-fallback')
mbim_glib_proj = subproject('libmbim',
default_options: ['man=false',
'introspection=false',
'bash_completion=false',
])
mbim_glib_dep = mbim_glib_proj.get_variable('libmbim_glib_dep')
endif
# MM should never use deprecated symbols from the libmibm
cc_args += '-DMBIM_DISABLE_DEPRECATED'
mbim_glib_dep = dependency('mbim-glib', version: '>= 1.32.0')
endif
config_h.set('WITH_MBIM', enable_mbim)
# QMI support (enabled by default)
enable_qmi = get_option('qmi')
if enable_qmi
qmi_glib_dep = dependency('qmi-glib', version: '>= 1.37.95',
required: not get_option('subproject-fallback'))
if not qmi_glib_dep.found() and get_option('subproject-fallback')
qmi_glib_proj = subproject('libqmi',
default_options: ['man=false',
'mbim_qmux=false',
'introspection=false',
'bash_completion=false',
])
qmi_glib_dep = qmi_glib_proj.get_variable('libqmi_glib_dep')
endif
# MM should never use deprecated symbols from libqmi
cc_args += '-DQMI_DISABLE_DEPRECATED'
qmi_glib_dep = dependency('qmi-glib', version: '>= 1.36.0')
endif
config_h.set('WITH_QMI', enable_qmi)
@@ -319,18 +274,11 @@ config_h.set('WITH_QMI', enable_qmi)
enable_qrtr = get_option('qrtr')
if enable_qrtr
assert(enable_qmi, 'QRTR support requires QMI enabled')
if qmi_glib_dep.type_name() == 'internal'
qmi_qrtr_supported = qmi_glib_proj.get_variable('enable_qrtr')
else
qmi_qrtr_supported = qmi_glib_dep.get_variable(pkgconfig: 'qmi_qrtr_supported')
endif
assert(qmi_qrtr_supported.to_int().is_odd(), 'Couldn\'t find QRTR support in qmi-glib.')
assert(qmi_glib_dep.get_pkgconfig_variable('qmi_qrtr_supported').to_int().is_odd(), 'Couldn\'t find QRTR support in qmi-glib.')
qrtr_glib_dep = dependency('qrtr-glib', version: '>= 1.0.0')
endif
config_h.set('WITH_QRTR', enable_qrtr)
add_project_arguments(common_args + cc_args, language: 'c')
# Distribution version string
dist_version = get_option('dist_version')
if dist_version != ''
@@ -408,7 +356,7 @@ plugins_options_reqs = {
'pantech': {'available': true, 'shared': []},
'qcom-soc': {'available': enable_qmi, 'shared': []},
'quectel': {'available': true, 'shared': ['quectel']},
'rolling': {'available': true, 'shared': ['fibocom', 'mtk']},
'rolling': {'available': true, 'shared': ['fibocom']},
'samsung': {'available': true, 'shared': ['icera']},
'sierra-legacy': {'available': true, 'shared': ['icera', 'sierra']},
'sierra': {'available': true, 'shared': ['xmm']},
-3
View File
@@ -6,7 +6,6 @@ option('udevdir', type: 'string', value: '', description: 'udev base directory')
option('examples', type: 'boolean', value: true, description: 'install examples')
option('tests', type: 'boolean', value: true, description: 'enable tests')
option('subproject-fallback', type: 'boolean', value: false, description: 'allow to use subprojects')
option('dbus_policy_dir', type: 'string', value: '', description: 'd-bus system policy directory')
@@ -17,8 +16,6 @@ option('systemd_journal', type: 'boolean', value: true, description: 'enable sys
option('polkit', type: 'combo', choices: ['strict', 'permissive', 'no'], value: 'strict', description: 'User auth-polkit configuration option.')
option('deprecated', type: 'boolean', value: true, description: 'build with deprecated symbols')
option('at_command_via_dbus', type: 'boolean', value: false, description: 'enable at commands via d-bus')
option('builtin_plugins', type: 'boolean', value: false, description: 'integrate all built plugins within the daemon binary')
+1 -6
View File
@@ -1,6 +1,5 @@
bg
ca
cs
ca
da
de
fi
@@ -12,16 +11,12 @@ hu
id
it
ka
kk
lt
nl
pl
pt_BR
ru
sk
sl
sr
sr@latin
sv
tr
uk
-141
View File
@@ -1,141 +0,0 @@
# Bulgarian translation for ModemManager.
# Copyright (C) 2025 ModemManager's COPYRIGHT HOLDER
# This file is distributed under the same license as the ModemManager package.
# twlvnn kraftwerk <kraft_werk@tutanota.com>, 2025, 2026.
#
msgid ""
msgstr ""
"Project-Id-Version: ModemManager main\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-06 03:33+0000\n"
"PO-Revision-Date: 2026-02-07 11:28+0100\n"
"Last-Translator: \n"
"Language-Team: Bulgarian <Bulgarian>\n"
"Language: bg\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.8\n"
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Включвайте и преглеждайте съобщения по мрежата"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgstr ""
"Системната не позволява включването или преглеждането на съобщенията по "
"мрежата на това устройство."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
msgstr "Контролирайте демона на мениджъра на модеми"
#: data/org.freedesktop.ModemManager1.policy.in.in:23
msgid "System policy prevents controlling the Modem Manager."
msgstr "Системата не позволява да се контролира мениджъра на модеми."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Настройте основния слот за SIM карта на модема"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "Системата не позволява да се настройват свойствата на модеми."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Unlock and control a mobile broadband device"
msgstr "Отключвайте и контролирайте устройства за достъп до мобилни мрежи"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"Системата не позволява да отключвате и контролирате устройства за достъп до "
"мобилни мрежи."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Add, modify, and delete mobile broadband contacts"
msgstr "Добавяйте, променяйте и изтривайте контакти за достъп до мобилни мрежи"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid ""
"System policy prevents adding, modifying, or deleting this device's contacts."
msgstr ""
"Системата не позволява добавянето, променянето или изтриването на контактите "
"на това устройство."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Send, save, modify, and delete text messages"
msgstr "Изпращайте, запазвайте, променяйте и изтривайте текстови съобщения"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"Системата не позволява изпращането или манипулирането на текстовите "
"съобщения на това устройство."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr ""
"Приемайте входящи гласови повиквания или стартирайте изходящи гласови "
"повиквания."
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid "System policy prevents voice calls."
msgstr "Системата не позволява гласови повиквания."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Query network time and timezone information"
msgstr "Правете заявки за времето по мрежата и за информация за часовия пояс"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid "System policy prevents querying network time information."
msgstr ""
"Системната политика не позволява заявки за информация за времето по мрежата."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Enable and view geographic location and positioning information"
msgstr ""
"Включвайте и преглеждайте информацията за географското местоположение и "
"позициониране"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"Системата не позволява включването или преглеждането информация за "
"географското местоположение."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
msgid "Query and utilize network information and services"
msgstr "Правете заявки и използвайте информация и услуги за мрежата"
#: data/org.freedesktop.ModemManager1.policy.in.in:95
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
msgstr ""
"Системата не позволява да се правят заявки или да се използват информация и "
"услуги за мрежата."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
msgid "Query and manage firmware on a mobile broadband device"
msgstr ""
"Правете заявки и управлявайте фърмуер за устройства за достъп до мобилни "
"мрежи"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
msgid "System policy prevents querying or managing this device's firmware."
msgstr ""
"Системата не позволява да се правят заявки или да се управлява фърмуерът на "
"това устройство."
#: src/mm-sleep-monitor-systemd.c:133
msgid "ModemManager needs to reset devices"
msgstr "ModemManager трябва да занулира устройства"
-137
View File
@@ -1,137 +0,0 @@
# Kazakh translation for ModemManager.
# Copyright (C) 2026 ModemManager's COPYRIGHT HOLDER
# This file is distributed under the same license as the ModemManager package.
# Baurzhan Muftakhidinov <baurthefirst@gmail.com>, 2026.
#
msgid ""
msgstr ""
"Project-Id-Version: ModemManager main\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-05 16:31+0000\n"
"PO-Revision-Date: 2026-03-01 12:56+0500\n"
"Last-Translator: Baurzhan Muftakhidinov <baurthefirst@gmail.com>\n"
"Language-Team: Kazakh <kk_KZ@googlegroups.com>\n"
"Language: kk\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.8\n"
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Ұялы хабар тарату хабарламаларын іске қосу және көру"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgstr ""
"Жүйелік саясат бұл құрылғының ұялы хабар тарату хабарламаларын іске қосуға "
"немесе көруге рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
msgstr "Modem Manager қызметін басқару"
#: data/org.freedesktop.ModemManager1.policy.in.in:23
msgid "System policy prevents controlling the Modem Manager."
msgstr "Жүйелік саясат Modem Manager қызметін басқаруға рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Модемнің негізгі SIM-слотын орнату"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "Жүйелік саясат модем қасиеттерін баптауға рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Unlock and control a mobile broadband device"
msgstr "Мобильді кең жолақты құрылғының құлпын ашу және оны басқару"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"Жүйелік саясат мобильді кең жолақты құрылғының құлпын ашуға немесе оны "
"басқаруға рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Add, modify, and delete mobile broadband contacts"
msgstr "Мобильді кең жолақты контактілерді қосу, өзгерту және өшіру"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid ""
"System policy prevents adding, modifying, or deleting this device's "
"contacts."
msgstr ""
"Жүйелік саясат бұл құрылғының контактілерін қосуға, өзгертуге немесе "
"өшіруге рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Send, save, modify, and delete text messages"
msgstr "Мәтіндік хабарламаларды жіберу, сақтау, өзгерту және өшіру"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"Жүйелік саясат бұл құрылғының мәтіндік хабарламаларын жіберуге немесе "
"өңдеуге рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr ""
"Кіріс дауыстық қоңырауларды қабылдау немесе шығыс дауыстық қоңырауларды "
"бастау."
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid "System policy prevents voice calls."
msgstr "Жүйелік саясат дауыстық қоңырауларға рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Query network time and timezone information"
msgstr "Желі уақыты мен уақыт белдеуі туралы ақпаратты сұрау"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid "System policy prevents querying network time information."
msgstr "Жүйелік саясат желі уақыты туралы ақпаратты сұрауға рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Enable and view geographic location and positioning information"
msgstr "Географиялық орналасу мен позициялау ақпаратын іске қосу және көру"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"Жүйелік саясат географиялық орналасу ақпаратын іске қосуға немесе көруге "
"рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
msgid "Query and utilize network information and services"
msgstr "Желі ақпаратын және қызметтерін сұрау және пайдалану"
#: data/org.freedesktop.ModemManager1.policy.in.in:95
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
msgstr ""
"Жүйелік саясат желі ақпаратын және қызметтерін сұрауға немесе пайдалануға "
"рұқсат бермейді."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
msgid "Query and manage firmware on a mobile broadband device"
msgstr "Мобильді кең жолақты құрылғының микробағдарламасын сұрау және басқару"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
msgid "System policy prevents querying or managing this device's firmware."
msgstr ""
"Жүйелік саясат бұл құрылғының микробағдарламасын сұрауға немесе басқаруға "
"рұқсат бермейді."
#: src/mm-sleep-monitor-systemd.c:133
msgid "ModemManager needs to reset devices"
msgstr "ModemManager-ге құрылғыларды қайта іске қосу қажет"
+22 -32
View File
@@ -9,8 +9,8 @@ msgstr ""
"Project-Id-Version: ModemManager\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-13 03:30+0000\n"
"PO-Revision-Date: 2025-09-13 11:42+0200\n"
"POT-Creation-Date: 2024-12-02 03:24+0000\n"
"PO-Revision-Date: 2025-02-09 15:02+0100\n"
"Last-Translator: Piotr Drąg <piotrdrag@gmail.com>\n"
"Language-Team: Polish <community-poland@mozilla.org>\n"
"Language: pl\n"
@@ -22,15 +22,13 @@ msgstr ""
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Włączenie i wyświetlanie wiadomości nadawania komórkowego"
msgstr "Włączenie i wyświetlanie wiadomości SMS"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgid "System policy prevents enabling or viewing this device's text messages."
msgstr ""
"Ustawienia systemu uniemożliwiają włączanie lub wyświetlanie wiadomości "
"nadawania komórkowego tego urządzenia."
"Ustawienia systemu uniemożliwiają włączanie lub wyświetlanie wiadomości SMS "
"tego urządzenia."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
@@ -41,81 +39,73 @@ msgid "System policy prevents controlling the Modem Manager."
msgstr "Ustawienia systemu uniemożliwiają sterowanie usługą ModemManager."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Ustawienie głównego gniazda SIM modemu"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "Ustawienia systemu uniemożliwiają konfigurowanie właściwości modemu."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Unlock and control a mobile broadband device"
msgstr "Odblokowanie i sterowanie urządzeniem komórkowym"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"Ustawienia systemu uniemożliwiają odblokowanie lub sterowanie urządzeniem "
"komórkowym."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Add, modify, and delete mobile broadband contacts"
msgstr "Dodawanie, modyfikowanie i usuwanie kontaktów urządzenia komórkowego"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents adding, modifying, or deleting this device's contacts."
msgstr ""
"Ustawienia systemu uniemożliwiają dodawanie, modyfikowanie lub usuwanie "
"kontaktów tego urządzenia."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Send, save, modify, and delete text messages"
msgstr "Wysyłanie, zapisywanie, modyfikowanie i usuwanie wiadomości SMS"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"Ustawienia systemu uniemożliwiają wysyłanie lub manipulowanie wiadomościami "
"SMS tego urządzenia."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr "Przyjmowanie połączeń przychodzących lub dzwonienie"
#: data/org.freedesktop.ModemManager1.policy.in.in:68
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid "System policy prevents voice calls."
msgstr "Ustawienia systemu uniemożliwiają dzwonienie."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Query network time and timezone information"
msgstr "Odpytywanie informacji o czasie sieciowym i strefie czasowej"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid "System policy prevents querying network time information."
msgstr ""
"Ustawienia systemu uniemożliwiają odpytywanie informacji o czasie sieciowym."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Enable and view geographic location and positioning information"
msgstr ""
"Włączanie i wyświetlanie informacji o położeniu geograficznym "
"i pozycjonowaniu"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"Ustawienia systemu uniemożliwiają włączanie lub wyświetlanie informacji "
"o położeniu geograficznym."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Query and utilize network information and services"
msgstr "Odpytywanie i używanie informacji i usług sieciowych"
#: data/org.freedesktop.ModemManager1.policy.in.in:95
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
@@ -123,17 +113,17 @@ msgstr ""
"Ustawienia systemu uniemożliwiają odpytywanie lub używanie informacji "
"i usług sieciowych."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
#: data/org.freedesktop.ModemManager1.policy.in.in:94
msgid "Query and manage firmware on a mobile broadband device"
msgstr ""
"Odpytywanie i zarządzanie oprogramowaniem sprzętowym urządzenia komórkowego"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
#: data/org.freedesktop.ModemManager1.policy.in.in:95
msgid "System policy prevents querying or managing this device's firmware."
msgstr ""
"Ustawienia systemu uniemożliwiają odpytywanie lub zarządzanie "
"oprogramowaniem sprzętowym tego urządzenia."
#: src/mm-sleep-monitor-systemd.c:133
#: src/mm-sleep-monitor-systemd.c:125
msgid "ModemManager needs to reset devices"
msgstr "Usługa ModemManager musi ponownie uruchomić urządzenia"
+26 -36
View File
@@ -1,35 +1,33 @@
# Brazilian Portuguese translation for ModemManager.
# Copyright (C) 2026 ModemManager's COPYRIGHT HOLDER
# Copyright (C) 2025 ModemManager's COPYRIGHT HOLDER
# This file is distributed under the same license as the ModemManager package.
# Rafael Fontenelle <rafaelff@gnome.org>, 2017-2026.
# Rafael Fontenelle <rafaelff@gnome.org>, 2017-2025.
#
msgid ""
msgstr ""
"Project-Id-Version: ModemManager main\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-05 16:31+0000\n"
"PO-Revision-Date: 2026-06-26 22:30-0300\n"
"POT-Creation-Date: 2024-12-02 03:24+0000\n"
"PO-Revision-Date: 2025-01-13 22:01-0300\n"
"Last-Translator: Rafael Fontenelle <rafaelff@gnome.org>\n"
"Language-Team: Brazilian Portuguese <https://br.gnome.org/traducao>\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Generator: Gtranslator 50.0\n"
"Plural-Forms: nplurals=2; plural=(n > 1)\n"
"X-Generator: Gtranslator 47.1\n"
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Habilitar e visualizar mensagens de transmissão celular"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgid "System policy prevents enabling or viewing this device's text messages."
msgstr ""
"A política de sistema impede de habilitar ou visualizar as mensagens de "
"transmissão celular deste dispositivo."
"texto deste dispositivo."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
@@ -40,79 +38,71 @@ msgid "System policy prevents controlling the Modem Manager."
msgstr "A política de sistema impede de controlar o ModemManager."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Configurar o slot principal do cartão SIM de um modem"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "A política de sistema impede a configuração das propriedades do modem."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Unlock and control a mobile broadband device"
msgstr "Desbloquear e controlar um dispositivo de banda larga móvel"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"A política de sistema impede de desbloquear ou controlar o dispositivo de "
"banda larga móvel."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Add, modify, and delete mobile broadband contacts"
msgstr "Adicionar, modificar e excluir contatos de banda larga móvel"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents adding, modifying, or deleting this device's contacts."
msgstr ""
"A política de sistema impede de adicionar, modificar ou excluir os contatos "
"deste dispositivo."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Send, save, modify, and delete text messages"
msgstr "Enviar, salvar, modificar e excluir mensagens de texto"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"A política de sistema impede de enviar ou manipular as mensagens de texto "
"deste dispositivo."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr "Aceitar chamadas de voz recebidas ou iniciar chamadas de voz de saída."
#: data/org.freedesktop.ModemManager1.policy.in.in:68
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid "System policy prevents voice calls."
msgstr "A política de sistema impede chamadas de voz."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Query network time and timezone information"
msgstr "Consultar informações de hora e fuso horário da rede"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid "System policy prevents querying network time information."
msgstr ""
"A política de sistema impede de consultar informações de horário da rede."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Enable and view geographic location and positioning information"
msgstr "Habilitar e ver informações de posicionamento e localização geográfica"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"A política de sistema impede de habilitar ou ver informações de localização "
"geográfica."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Query and utilize network information and services"
msgstr "Consultar ou utilizar serviços e informações de rede"
msgstr "Consultar ou utilizar serviços e informações de rede."
#: data/org.freedesktop.ModemManager1.policy.in.in:95
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
@@ -120,16 +110,16 @@ msgstr ""
"A política de sistema impede de consultar ou utilizar serviços e informações "
"de rede."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
#: data/org.freedesktop.ModemManager1.policy.in.in:94
msgid "Query and manage firmware on a mobile broadband device"
msgstr "Consultar e gerenciar firmware em um dispositivo de banda larga móvel"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
#: data/org.freedesktop.ModemManager1.policy.in.in:95
msgid "System policy prevents querying or managing this device's firmware."
msgstr ""
"A política de sistema impede de consultar ou gerenciar o firmware do "
"dispositivo."
#: src/mm-sleep-monitor-systemd.c:133
#: src/mm-sleep-monitor-systemd.c:125
msgid "ModemManager needs to reset devices"
msgstr "O ModemManager precisa reiniciar os dispositivos"
msgstr "O ModemManager precisa reiniciar os dispositivos"
-140
View File
@@ -1,140 +0,0 @@
# Slovenian translation for ModemManager.
# Copyright (C) 2024 ModemManager's COPYRIGHT HOLDER
# This file is distributed under the same license as the ModemManager package.
#
# Martin Srebotnjak <miles@filmsi.net>, 2024, 2025.
#
msgid ""
msgstr ""
"Project-Id-Version: ModemManager main\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-11 03:31+0000\n"
"PO-Revision-Date: 2025-09-11 11:33+0200\n"
"Last-Translator: Martin Srebotnjak <miles@filmsi.net>\n"
"Language-Team: Slovenian GNOME Translation Team <gnome-si@googlegroups.com>\n"
"Language: sl\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=(n%100==1 ? 1 : n%100==2 ? 2 : n%100==3 || "
"n%100==4 ? 3 : 0);\n"
"X-Generator: Poedit 2.2.1\n"
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Omogoči in pokaži oddajna sporočila telefona"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgstr ""
"Sistemska pravila preprečujejo omogočanje ali ogledovanje oddajnih "
"telefonskih sporočil te naprave."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
msgstr "Upravljajte prikriti proces upravitelja modema"
#: data/org.freedesktop.ModemManager1.policy.in.in:23
msgid "System policy prevents controlling the Modem Manager."
msgstr "Sistemska pravila preprečujejo nadzor upravitelja modemov."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Nastavite primarno režo za kartico SIM modema"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "Sistemska pravila preprečujejo nastavljanje lastnosti modema."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Unlock and control a mobile broadband device"
msgstr "Odklenite in nadzorujte naprave za mobilno širokopasovno povezavo"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"Sistemska pravila preprečujejo odklepanje ali nadzor mobilne širokopasovne "
"naprave."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Add, modify, and delete mobile broadband contacts"
msgstr ""
"Dodajte, spreminjajte in brišite stike za mobilno širokopasovno povezavo"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid ""
"System policy prevents adding, modifying, or deleting this device's contacts."
msgstr ""
"Sistemska pravila preprečujejo dodajanje, spreminjanje ali brisanje stikov v "
"tej napravi."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Send, save, modify, and delete text messages"
msgstr "Pošiljajte, shranjujte, spreminjajte in brišite besedilna sporočila"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"Sistemska pravila preprečujejo pošiljanje besedilnih sporočil te naprave ali "
"manipulacijo z njimi."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr "Sprejmite dohodne glasovne klice ali začnite odhodne glasovne klice."
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid "System policy prevents voice calls."
msgstr "Sistemska pravila preprečujejo glasovne klice."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Query network time and timezone information"
msgstr "Poizvedujte po omrežnem času in časovnem pasu"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid "System policy prevents querying network time information."
msgstr ""
"Sistemska pravilna preprečujejo poizvedovanje po podatkih o omrežnem času."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Enable and view geographic location and positioning information"
msgstr "Omogočite in oglejte si informacije o zemljepisni lokaciji in položaju"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"Sistemska pravila preprečujejo omogočanje ali ogled informacij o zemljepisni "
"lokaciji."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
msgid "Query and utilize network information and services"
msgstr "Poizvedujte in uporabljajte omrežne informacije in storitve"
#: data/org.freedesktop.ModemManager1.policy.in.in:95
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
msgstr ""
"Sistemska pravila preprečujejo poizvedovanje ali uporabo omrežnih informacij "
"in storitev."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
msgid "Query and manage firmware on a mobile broadband device"
msgstr ""
"Poizvedujte in upravljajte vdelano programsko opremo v mobilni širokopasovni "
"napravi"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
msgid "System policy prevents querying or managing this device's firmware."
msgstr ""
"Sistemska pravila preprečujejo poizvedovanje ali upravljanje vdelane "
"programske opreme te naprave."
#: src/mm-sleep-monitor-systemd.c:133
msgid "ModemManager needs to reset devices"
msgstr "ModemManager mora ponastaviti naprave"
-134
View File
@@ -1,134 +0,0 @@
# Serbian translation for ModemManager.
# Copyright (C) 2026 ModemManager's COPYRIGHT HOLDER
# This file is distributed under the same license as the ModemManager package.
# Марко Костић <marko.m.kostic@gmail.com>, 2026.
#
msgid ""
msgstr ""
"Project-Id-Version: ModemManager main\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-05 16:31+0000\n"
"PO-Revision-Date: 2026-04-11 14:54+0200\n"
"Last-Translator: Марко Костић <marko.m.kostic@gmail.com>\n"
"Language-Team: Serbian <Serbian>\n"
"Language: sr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=n==1? 3 : n%10==1 && n%100!=11 ? 0 : "
"n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Poedit 3.9\n"
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Омогућите и прегледајте поруке емитовања ћелије"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgstr ""
"Системска правила спречавају омогућавање или преглед порука емитовања у "
"ћелији овог уређаја."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
msgstr "Управљајте демоном управника модема"
#: data/org.freedesktop.ModemManager1.policy.in.in:23
msgid "System policy prevents controlling the Modem Manager."
msgstr "Системска правила спречавају управљање управником модема."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Поставите примарни СИМ слот модема"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "Системска правила спречавају подешавање својстава модема."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Unlock and control a mobile broadband device"
msgstr "Откључајте и управљајте мобилним широкопојасним уређајем"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"Системска правила спречавају откључавање или управљање мобилним "
"широкопојасним уређајем."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Add, modify, and delete mobile broadband contacts"
msgstr "Додајте, мењајте и бришите контакте мобилне широкопојасне мреже"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid ""
"System policy prevents adding, modifying, or deleting this device's contacts."
msgstr ""
"Системска правила спречавају додавање, мењање или брисање контаката овог "
"уређаја."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Send, save, modify, and delete text messages"
msgstr "Шаљите, чувајте, мењајте и бришите текстуалне поруке"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"Системска правила спречавају слање или управљање текстуалним порукама овог "
"уређаја."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr ""
"Прихватите долазне говорне позиве или започните одлазне говорне позиве."
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid "System policy prevents voice calls."
msgstr "Системска правила спречавају говорне позиве."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Query network time and timezone information"
msgstr "Упитајте време мреже и податке о временској зони"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid "System policy prevents querying network time information."
msgstr "Системска правила спречавају упитивање података о времену мреже."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Enable and view geographic location and positioning information"
msgstr "Омогућите и прегледајте податке о географском положају и позиционирању"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"Системска правила спречавају омогућавање или преглед података о географском "
"положају."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
msgid "Query and utilize network information and services"
msgstr "Упитајте и користите мрежне податке и услуге"
#: data/org.freedesktop.ModemManager1.policy.in.in:95
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
msgstr ""
"Системска правила спречавају упитивање или коришћење мрежних података и "
"услуга."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
msgid "Query and manage firmware on a mobile broadband device"
msgstr "Упит и управљање фирмвером на мобилном широкопојасном уређају"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
msgid "System policy prevents querying or managing this device's firmware."
msgstr "Системска политика спречава упит или управљање фирмвером овог уређаја."
#: src/mm-sleep-monitor-systemd.c:133
msgid "ModemManager needs to reset devices"
msgstr "Управник модема мора да поново покрене уређаје"
-136
View File
@@ -1,136 +0,0 @@
# Serbian translation for ModemManager.
# Copyright (C) 2026 ModemManager's COPYRIGHT HOLDER
# This file is distributed under the same license as the ModemManager package.
# Marko Kostić <marko.m.kostic@gmail.com>, 2026.
#
msgid ""
msgstr ""
"Project-Id-Version: ModemManager main\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-05 16:31+0000\n"
"PO-Revision-Date: 2026-04-11 14:54+0200\n"
"Last-Translator: Marko Kostić <marko.m.kostic@gmail.com>\n"
"Language-Team: Serbian <Serbian>\n"
"Language: sr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=4; plural=n==1? 3 : n%10==1 && n%100!=11 ? 0 : "
"n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
"X-Generator: Poedit 3.9\n"
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Omogućite i pregledajte poruke emitovanja ćelije"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgstr ""
"Sistemska pravila sprečavaju omogućavanje ili pregled poruka emitovanja u "
"ćeliji ovog uređaja."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
msgstr "Upravljajte demonom upravnika modema"
#: data/org.freedesktop.ModemManager1.policy.in.in:23
msgid "System policy prevents controlling the Modem Manager."
msgstr "Sistemska pravila sprečavaju upravljanje upravnikom modema."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Postavite primarni SIM slot modema"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "Sistemska pravila sprečavaju podešavanje svojstava modema."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Unlock and control a mobile broadband device"
msgstr "Otključajte i upravljajte mobilnim širokopojasnim uređajem"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"Sistemska pravila sprečavaju otključavanje ili upravljanje mobilnim "
"širokopojasnim uređajem."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Add, modify, and delete mobile broadband contacts"
msgstr "Dodajte, menjajte i brišite kontakte mobilne širokopojasne mreže"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid ""
"System policy prevents adding, modifying, or deleting this device's contacts."
msgstr ""
"Sistemska pravila sprečavaju dodavanje, menjanje ili brisanje kontakata ovog "
"uređaja."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Send, save, modify, and delete text messages"
msgstr "Šaljite, čuvajte, menjajte i brišite tekstualne poruke"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"Sistemska pravila sprečavaju slanje ili upravljanje tekstualnim porukama "
"ovog uređaja."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr ""
"Prihvatite dolazne govorne pozive ili započnite odlazne govorne pozive."
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid "System policy prevents voice calls."
msgstr "Sistemska pravila sprečavaju govorne pozive."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Query network time and timezone information"
msgstr "Upitajte vreme mreže i podatke o vremenskoj zoni"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid "System policy prevents querying network time information."
msgstr "Sistemska pravila sprečavaju upitivanje podataka o vremenu mreže."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Enable and view geographic location and positioning information"
msgstr ""
"Omogućite i pregledajte podatke o geografskom položaju i pozicioniranju"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"Sistemska pravila sprečavaju omogućavanje ili pregled podataka o geografskom "
"položaju."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
msgid "Query and utilize network information and services"
msgstr "Upitajte i koristite mrežne podatke i usluge"
#: data/org.freedesktop.ModemManager1.policy.in.in:95
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
msgstr ""
"Sistemska pravila sprečavaju upitivanje ili korišćenje mrežnih podataka i "
"usluga."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
msgid "Query and manage firmware on a mobile broadband device"
msgstr "Upit i upravljanje firmverom na mobilnom širokopojasnom uređaju"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
msgid "System policy prevents querying or managing this device's firmware."
msgstr ""
"Sistemska politika sprečava upit ili upravljanje firmverom ovog uređaja."
#: src/mm-sleep-monitor-systemd.c:133
msgid "ModemManager needs to reset devices"
msgstr "Upravnik modema mora da ponovo pokrene uređaje"
+23 -44
View File
@@ -1,16 +1,16 @@
# Swedish translation for ModemManager.
# Copyright © 2017, 2020, 2024, 2025 ModemManager's COPYRIGHT HOLDER
# Copyright (C) 2017, 2020 ModemManager's COPYRIGHT HOLDER
# This file is distributed under the same license as the ModemManager package.
# Josef Andersson <l10nl18nsweja@gmail.com>, 2017.
# Anders Jonsson <anders.jonsson@norsjovallen.se>, 2020, 2024, 2025.
# Anders Jonsson <anders.jonsson@norsjovallen.se>, 2020.
#
msgid ""
msgstr ""
"Project-Id-Version: ModemManager main\n"
"Report-Msgid-Bugs-To: https://gitlab.freedesktop.org/mobile-broadband/"
"ModemManager/issues\n"
"POT-Creation-Date: 2025-09-07 15:30+0000\n"
"PO-Revision-Date: 2025-09-07 22:14+0200\n"
"POT-Creation-Date: 2022-07-16 14:32+0200\n"
"PO-Revision-Date: 2020-09-18 23:56+0200\n"
"Last-Translator: Anders Jonsson <anders.jonsson@norsjovallen.se>\n"
"Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n"
"Language: sv\n"
@@ -18,102 +18,81 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.7\n"
"X-Generator: Poedit 2.4.1\n"
# https://it-ord.computersweden.se/ord/cell-broadcast/
#: data/org.freedesktop.ModemManager1.policy.in.in:13
msgid "Enable and view Cell Broadcast messages"
msgstr "Aktivera och visa Cell Broadcast-meddelanden"
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid ""
"System policy prevents enabling or viewing this device's cell broadcast "
"messages."
msgstr ""
"En systempolicy förhindrar att aktivera eller visa denna enhets Cell "
"Broadcast-meddelanden."
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Control the Modem Manager daemon"
msgstr "Kontrollera demonen för Modem Manager"
#: data/org.freedesktop.ModemManager1.policy.in.in:23
#: data/org.freedesktop.ModemManager1.policy.in.in:14
msgid "System policy prevents controlling the Modem Manager."
msgstr "En systempolicy förhindrar kontroll av Modem Manager."
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Set the primary sim slot of a modem"
msgstr "Ställ in primärt SIM-fack för ett modem"
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid "System policy prevents configuring modem properties."
msgstr "En systempolicy förhindrar konfiguration av modemegenskaper."
#: data/org.freedesktop.ModemManager1.policy.in.in:40
#: data/org.freedesktop.ModemManager1.policy.in.in:22
msgid "Unlock and control a mobile broadband device"
msgstr "Lås upp och kontrollera en mobil bredbandsenhet"
#: data/org.freedesktop.ModemManager1.policy.in.in:41
#: data/org.freedesktop.ModemManager1.policy.in.in:23
msgid ""
"System policy prevents unlocking or controlling the mobile broadband device."
msgstr ""
"En systempolicy hindrar upplåsning eller kontroll över den mobila "
"bredbandsenheten."
#: data/org.freedesktop.ModemManager1.policy.in.in:49
#: data/org.freedesktop.ModemManager1.policy.in.in:31
msgid "Add, modify, and delete mobile broadband contacts"
msgstr "Lägg till, ändra och ta bort mobila bredbandskontakter"
#: data/org.freedesktop.ModemManager1.policy.in.in:50
#: data/org.freedesktop.ModemManager1.policy.in.in:32
msgid ""
"System policy prevents adding, modifying, or deleting this device's contacts."
msgstr ""
"En systempolicy förhindrar att lägga till, ändra och ta bort denna enhets "
"kontakter."
#: data/org.freedesktop.ModemManager1.policy.in.in:58
#: data/org.freedesktop.ModemManager1.policy.in.in:40
msgid "Send, save, modify, and delete text messages"
msgstr "Skicka, spara, ändra och ta bort meddelanden"
#: data/org.freedesktop.ModemManager1.policy.in.in:59
#: data/org.freedesktop.ModemManager1.policy.in.in:41
msgid ""
"System policy prevents sending or manipulating this device's text messages."
msgstr ""
"En systempolicy förhindrar att skicka eller ändra denna enhets "
"textmeddelanden."
#: data/org.freedesktop.ModemManager1.policy.in.in:67
#: data/org.freedesktop.ModemManager1.policy.in.in:49
msgid "Accept incoming voice calls or start outgoing voice calls."
msgstr "Acceptera inkommande röstsamtal eller påbörja utgående röstsamtal."
#: data/org.freedesktop.ModemManager1.policy.in.in:68
#: data/org.freedesktop.ModemManager1.policy.in.in:50
msgid "System policy prevents voice calls."
msgstr "En systempolicy förhindrar röstsamtal."
#: data/org.freedesktop.ModemManager1.policy.in.in:76
#: data/org.freedesktop.ModemManager1.policy.in.in:58
msgid "Query network time and timezone information"
msgstr "Fråga efter nätverkstid och tidzonsinformation"
#: data/org.freedesktop.ModemManager1.policy.in.in:77
#: data/org.freedesktop.ModemManager1.policy.in.in:59
msgid "System policy prevents querying network time information."
msgstr "En systempolicy förhindrar frågande av nätverkstidsinformation."
#: data/org.freedesktop.ModemManager1.policy.in.in:85
#: data/org.freedesktop.ModemManager1.policy.in.in:67
msgid "Enable and view geographic location and positioning information"
msgstr "Aktivera och visa geografisk plats samt positioneringsinformation"
#: data/org.freedesktop.ModemManager1.policy.in.in:86
#: data/org.freedesktop.ModemManager1.policy.in.in:68
msgid ""
"System policy prevents enabling or viewing geographic location information."
msgstr ""
"En systempolicy förhindrar aktivering eller visning av geografisk "
"platsinformation."
#: data/org.freedesktop.ModemManager1.policy.in.in:94
#: data/org.freedesktop.ModemManager1.policy.in.in:76
msgid "Query and utilize network information and services"
msgstr "Fråga efter och nyttja nätverksinformation och tjänster"
#: data/org.freedesktop.ModemManager1.policy.in.in:95
#: data/org.freedesktop.ModemManager1.policy.in.in:77
msgid ""
"System policy prevents querying or utilizing network information and "
"services."
@@ -121,16 +100,16 @@ msgstr ""
"En systempolicy förhindrar frågande och nyttjande av nätverksinformation och "
"tjänster."
#: data/org.freedesktop.ModemManager1.policy.in.in:103
#: data/org.freedesktop.ModemManager1.policy.in.in:85
msgid "Query and manage firmware on a mobile broadband device"
msgstr "Fråga efter och hantera fast programvara för en mobil bredbandsenhet"
#: data/org.freedesktop.ModemManager1.policy.in.in:104
#: data/org.freedesktop.ModemManager1.policy.in.in:86
msgid "System policy prevents querying or managing this device's firmware."
msgstr ""
"En systempolicy förhindrar att fråga och hantera denna enhets fasta "
"programvara."
#: src/mm-sleep-monitor-systemd.c:133
#: src/mm-sleep-monitor-systemd.c:125
msgid "ModemManager needs to reset devices"
msgstr "ModemManager behöver starta om enheter"
+53 -1
View File
@@ -24,6 +24,58 @@
/******************************************************************************/
static gboolean
read_sysfs_int (const gchar *path,
gint *value)
{
g_autofree gchar *contents = NULL;
gchar *end = NULL;
gint64 parsed;
if (!g_file_get_contents (path, &contents, NULL, NULL))
return FALSE;
parsed = g_ascii_strtoll (contents, &end, 10);
if (end == contents)
return FALSE;
*value = (gint) parsed;
return TRUE;
}
/* Net devices stacked by drivers that create no lower_* adjacency links (e.g. rmnet on Android vendor
* kernels) still report the parent's interface index in 'iflink'. */
static gchar *
get_lower_device_name_by_iflink (const gchar *sysfs_path)
{
g_autofree gchar *ifindex_path = NULL;
g_autofree gchar *iflink_path = NULL;
g_autoptr(GDir) dir = NULL;
const gchar *name;
gint ifindex;
gint iflink;
ifindex_path = g_build_filename (sysfs_path, "ifindex", NULL);
iflink_path = g_build_filename (sysfs_path, "iflink", NULL);
if (!read_sysfs_int (ifindex_path, &ifindex) ||
!read_sysfs_int (iflink_path, &iflink) ||
iflink == ifindex || iflink <= 0)
return NULL;
dir = g_dir_open ("/sys/class/net", 0, NULL);
if (!dir)
return NULL;
while ((name = g_dir_read_name (dir)) != NULL) {
g_autofree gchar *path = NULL;
gint index;
path = g_build_filename ("/sys/class/net", name, "ifindex", NULL);
if (read_sysfs_int (path, &index) && index == iflink)
return g_strdup (name);
}
return NULL;
}
gchar *
mm_kernel_device_get_lower_device_name (const gchar *sysfs_path)
{
@@ -60,7 +112,7 @@ mm_kernel_device_get_lower_device_name (const gchar *sysfs_path)
return g_path_get_basename (real_path);
}
return NULL;
return get_lower_device_name_by_iflink (sysfs_path);
}
/******************************************************************************/
+13 -2
View File
@@ -338,10 +338,21 @@ kernel_device_get_name (MMKernelDevice *_self)
return mm_kernel_event_properties_get_name (self->priv->properties);
}
/* Driver name for devices without one in sysfs, e.g. the virtual rmnet_ipa0 of
* Qualcomm vendor kernels, which is handled like the mainline 'ipa' driver */
#define ID_MM_KERNEL_DRIVER "ID_MM_KERNEL_DRIVER"
static const gchar *
kernel_device_get_driver (MMKernelDevice *self)
kernel_device_get_driver (MMKernelDevice *_self)
{
return MM_KERNEL_DEVICE_UDEV (self)->priv->driver;
MMKernelDeviceUdev *self;
const gchar *driver;
self = MM_KERNEL_DEVICE_UDEV (_self);
if (self->priv->device &&
(driver = g_udev_device_get_property (self->priv->device, ID_MM_KERNEL_DRIVER)) != NULL)
return driver;
return self->priv->driver;
}
static const gchar *
+16 -138
View File
@@ -46,7 +46,6 @@ sources = files(
'mm-cbm-part.c',
'mm-charsets.c',
'mm-error-helpers.c',
'mm-location-cache.c',
'mm-log.c',
'mm-log-object.c',
'mm-modem-helpers.c',
@@ -81,16 +80,11 @@ if enable_systemd_journal
private_deps += libsystemd_dep
endif
c_args = [
'-DPKGSTATEDIR="@0@"'.format(mm_pkgsharedstatedir),
]
libhelpers = static_library(
'helpers',
sources: sources + enums_sources,
include_directories: incs,
dependencies: deps + private_deps,
c_args: c_args,
)
libhelpers_dep = declare_dependency(
@@ -140,8 +134,6 @@ headers = files(
'mm-iface-port-at.h',
'mm-port.h',
'mm-port-serial-at.h',
'mm-port-scheduler.h',
'mm-port-scheduler-rr.h',
)
sources = files(
@@ -154,8 +146,6 @@ sources = files(
'mm-port-serial-gps.c',
'mm-port-serial-qcdm.c',
'mm-serial-parsers.c',
'mm-port-scheduler.c',
'mm-port-scheduler-rr.c',
)
deps = [libkerneldevice_dep]
@@ -216,71 +206,10 @@ libport_dep = declare_dependency(
link_with: libport,
)
# auth provider library
sources = files(
'mm-auth-provider.c',
'mm-context.c',
'mm-bind.c',
)
incs = [
top_inc,
kerneldevice_inc,
]
deps = [libmm_glib_dep, libhelpers_dep]
if enable_polkit
deps += polkit_gobject_dep
endif
private_deps = []
libauth = static_library(
'auth',
sources: sources,
include_directories: incs,
dependencies: deps,
c_args: '-DPLUGINDIR="@0@"'.format(mm_prefix / mm_pkglibdir),
)
libauth_dep = declare_dependency(
include_directories: ['.', kerneldevice_inc],
dependencies: deps,
link_with: libauth,
)
# SMS library
sources = files(
'mm-sms-list.c',
'mm-base-sms.c',
)
incs = [
top_inc,
]
deps = [libmm_glib_dep, libhelpers_dep, libauth_dep]
private_deps = []
libsms = static_library(
'sms',
sources: sources,
include_directories: incs,
dependencies: deps,
)
libsms_dep = declare_dependency(
include_directories: ['.'],
dependencies: deps,
link_with: libsms,
)
# Daemon enums, required by plugins
headers = files(
'mm-base-bearer.h',
'mm-iface-op-lock.h',
'mm-base-modem.h',
'mm-filter.h',
'mm-port-probe.h',
)
@@ -321,25 +250,33 @@ daemon_enums_types_dep = declare_dependency(
include_directories: '.',
)
base_sources = files(
# Additional vendor plugins
subdir('plugins')
# ModemManager daemon
sources = files(
'main.c',
'mm-auth-provider.c',
'mm-base-bearer.c',
'mm-base-call.c',
'mm-call-at.c',
'mm-base-cbm.c',
'mm-base-manager.c',
'mm-base-modem-at.c',
'mm-base-modem.c',
'mm-base-sim.c',
'mm-sms-at.c',
'mm-base-sms.c',
'mm-bearer-list.c',
'mm-broadband-bearer.c',
'mm-broadband-modem.c',
'mm-call-list.c',
'mm-cbm-list.c',
'mm-context.c',
'mm-device.c',
'mm-dispatcher.c',
'mm-dispatcher-connection.c',
'mm-dispatcher-fcc-unlock.c',
'mm-dispatcher-modem-setup.c',
'mm-filter.c',
'mm-iface-modem-3gpp.c',
'mm-iface-modem-3gpp-profile-manager.c',
'mm-iface-modem-3gpp-ussd.c',
@@ -355,77 +292,22 @@ base_sources = files(
'mm-iface-modem-simple.c',
'mm-iface-modem-time.c',
'mm-iface-modem-voice.c',
'mm-iface-op-lock.c',
'mm-log-helpers.c',
'mm-private-boxed-types.c',
'mm-sleep-context.c',
)
# MM base library (used by MM and tests)
incs = [
top_inc,
kerneldevice_inc,
]
deps = [
libmm_glib_dep,
libhelpers_dep,
libauth_dep,
libport_dep,
libqcdm_dep,
daemon_enums_types_dep,
]
private_deps = []
c_args = [
'-DMM_COMPILATION',
'-DPLUGINDIR="@0@"'.format(mm_prefix / mm_pkglibdir),
'-DMODEMSETUPDIRPACKAGE="@0@"'.format(mm_prefix / mm_pkglibdir / 'modem-setup.d'),
'-DMODEMSETUPDIRUSER="@0@"'.format(mm_prefix / mm_pkgsysconfdir / 'modem-setup.d'),
'-DFCCUNLOCKDIRPACKAGE="@0@"'.format(mm_prefix / mm_pkglibdir / 'fcc-unlock.d'),
'-DFCCUNLOCKDIRUSER="@0@"'.format(mm_prefix / mm_pkgsysconfdir / 'fcc-unlock.d'),
'-DCONNECTIONDIRPACKAGE="@0@"'.format(mm_prefix / mm_pkglibdir / 'connection.d'),
'-DCONNECTIONDIRUSER="@0@"'.format(mm_prefix / mm_pkgsysconfdir / 'connection.d'),
]
libmmbase = static_library(
'mmbase',
sources: base_sources + daemon_enums_sources,
include_directories: incs,
dependencies: deps,
c_args: c_args,
)
libmmbase_dep = declare_dependency(
include_directories: ['.', kerneldevice_inc],
dependencies: deps,
link_with: libmmbase,
)
# Additional vendor plugins
subdir('plugins')
# ModemManager daemon
sources = files(
'main.c',
'mm-base-manager.c',
'mm-filter.c',
'mm-plugin.c',
'mm-plugin-manager.c',
'mm-port-probe.c',
'mm-port-probe-at.c',
'mm-private-boxed-types.c',
'mm-sms-list.c',
'mm-sleep-context.c',
)
sources += daemon_enums_sources
sources += base_sources
deps = [
gmodule_dep,
libport_dep,
libqcdm_dep,
libsms_dep,
libauth_dep,
]
if enable_tests
@@ -434,6 +316,7 @@ endif
c_args = [
'-DMM_COMPILATION',
'-DPLUGINDIR="@0@"'.format(mm_prefix / mm_pkglibdir),
'-DMODEMSETUPDIRPACKAGE="@0@"'.format(mm_prefix / mm_pkglibdir / 'modem-setup.d'),
'-DMODEMSETUPDIRUSER="@0@"'.format(mm_prefix / mm_pkgsysconfdir / 'modem-setup.d'),
'-DFCCUNLOCKDIRPACKAGE="@0@"'.format(mm_prefix / mm_pkglibdir / 'fcc-unlock.d'),
@@ -512,11 +395,6 @@ install_data(
install_dir: udev_rulesdir,
)
# empty directory for cached position
install_emptydir(
mm_pkgsharedstatedir,
)
if enable_tests
subdir('tests')
endif
-45
View File
@@ -22,7 +22,6 @@
#include "mm-log-object.h"
#include "mm-utils.h"
#include "mm-auth-provider.h"
#include "mm-context.h"
#if defined WITH_POLKIT
# include <polkit/polkit.h>
@@ -129,13 +128,6 @@ mm_auth_provider_authorize (MMAuthProvider *self,
task = g_task_new (self, cancellable, callback, user_data);
/* When running in the session bus for tests, default to always allow */
if (mm_context_get_test_session ()) {
g_task_return_boolean (task, TRUE);
g_object_unref (task);
return;
}
#if defined WITH_POLKIT
{
AuthorizeContext *ctx;
@@ -226,40 +218,3 @@ mm_auth_provider_class_init (MMAuthProviderClass *class)
}
MM_DEFINE_SINGLETON_GETTER (MMAuthProvider, mm_auth_provider_get, MM_TYPE_AUTH_PROVIDER)
/*****************************************************************************/
/* Auth interface */
G_DEFINE_INTERFACE (MMIfaceAuth, mm_iface_auth, G_TYPE_OBJECT)
void
mm_iface_auth_authorize (MMIfaceAuth *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
GAsyncReadyCallback callback,
gpointer user_data)
{
g_assert (MM_IFACE_AUTH_GET_IFACE (self)->authorize != NULL);
MM_IFACE_AUTH_GET_IFACE (self)->authorize (self,
invocation,
authorization,
callback,
user_data);
}
gboolean
mm_iface_auth_authorize_finish (MMIfaceAuth *self,
GAsyncResult *res,
GError **error)
{
g_assert (MM_IFACE_AUTH_GET_IFACE (self)->authorize_finish != NULL);
return MM_IFACE_AUTH_GET_IFACE (self)->authorize_finish (self, res, error);
}
static void
mm_iface_auth_default_init (MMIfaceAuthInterface *iface)
{
}
-35
View File
@@ -56,39 +56,4 @@ gboolean mm_auth_provider_authorize_finish (MMAuthProvider *self,
GAsyncResult *res,
GError **error);
/*****************************************************************************/
/* Auth interface
*
* Implemented by objects (mainly MMBaseModem) that provide authorization
* capability to other interfaces (MMIfaceModem) since GLib interfaces don't
* have private data to store the singletone.
*/
#define MM_TYPE_IFACE_AUTH mm_iface_auth_get_type ()
G_DECLARE_INTERFACE (MMIfaceAuth, mm_iface_auth, MM, IFACE_AUTH, GObject)
struct _MMIfaceAuthInterface {
GTypeInterface g_iface;
void (* authorize) (MMIfaceAuth *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* authorize_finish) (MMIfaceAuth *self,
GAsyncResult *res,
GError **error);
};
void mm_iface_auth_authorize (MMIfaceAuth *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_iface_auth_authorize_finish (MMIfaceAuth *self,
GAsyncResult *res,
GError **error);
#endif /* MM_AUTH_PROVIDER_H */
+39 -61
View File
@@ -34,14 +34,13 @@
#include "mm-iface-modem-3gpp-profile-manager.h"
#include "mm-iface-modem-cdma.h"
#include "mm-base-bearer.h"
#include "mm-base-modem-at.h"
#include "mm-base-modem.h"
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-error-helpers.h"
#include "mm-bearer-stats.h"
#include "mm-dispatcher-connection.h"
#include "mm-auth-provider.h"
#include "mm-bind.h"
/* We require up to 20s to get a proper IP when using PPP */
#define BEARER_IP_TIMEOUT_DEFAULT 20
@@ -55,11 +54,9 @@
#define BEARER_CONNECTION_MONITOR_TIMEOUT 5
static void log_object_iface_init (MMLogObjectInterface *iface);
static void bind_iface_init (MMBindInterface *iface);
G_DEFINE_TYPE_EXTENDED (MMBaseBearer, mm_base_bearer, MM_GDBUS_TYPE_BEARER_SKELETON, 0,
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_BIND, bind_iface_init))
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
typedef enum {
CONNECTION_FORBIDDEN_REASON_NONE,
@@ -73,7 +70,6 @@ enum {
PROP_0,
PROP_PATH,
PROP_CONNECTION,
PROP_BIND_TO,
PROP_MODEM,
PROP_STATUS,
PROP_CONFIG,
@@ -87,13 +83,6 @@ struct _MMBaseBearerPrivate {
GDBusConnection *connection;
guint dbus_id;
/* The authorization provider */
MMAuthProvider *authp;
GCancellable *authp_cancellable;
/* The object this bearer is bound to */
GObject *bind_to;
/* The modem which owns this BEARER */
MMBaseModem *modem;
/* The path where the BEARER object is exported */
@@ -472,7 +461,7 @@ dispatcher_connection_run_ready (MMDispatcherConnection *dispatcher,
static void
bearer_run_dispatcher_scripts (MMBaseBearer *self,
MMDispatcherConnectionEvent event)
gboolean connected)
{
MMDispatcherConnection *dispatcher;
const gchar *interface;
@@ -486,7 +475,7 @@ bearer_run_dispatcher_scripts (MMBaseBearer *self,
g_dbus_object_get_object_path (G_DBUS_OBJECT (self->priv->modem)),
self->priv->path,
interface,
event,
connected,
NULL, /* cancellable */
(GAsyncReadyCallback)dispatcher_connection_run_ready,
g_object_ref (self));
@@ -500,7 +489,6 @@ bearer_reset_interface_status (MMBaseBearer *self)
mm_gdbus_bearer_set_profile_id (MM_GDBUS_BEARER (self), MM_3GPP_PROFILE_ID_UNKNOWN);
mm_gdbus_bearer_set_multiplexed (MM_GDBUS_BEARER (self), FALSE);
mm_gdbus_bearer_set_connected (MM_GDBUS_BEARER (self), FALSE);
mm_gdbus_bearer_set_disconnect_request (MM_GDBUS_BEARER (self), FALSE);
mm_gdbus_bearer_set_suspended (MM_GDBUS_BEARER (self), FALSE);
mm_gdbus_bearer_set_interface (MM_GDBUS_BEARER (self), NULL);
mm_gdbus_bearer_set_ip4_config (
@@ -532,7 +520,7 @@ bearer_update_status (MMBaseBearer *self,
g_autoptr(GString) report = NULL;
/* Report disconnection via dispatcher scripts, before resetting the interface */
bearer_run_dispatcher_scripts (self, MM_DISPATCHER_CONNECTION_EVENT_DISCONNECTED);
bearer_run_dispatcher_scripts (self, FALSE);
bearer_reset_interface_status (self);
/* Cleanup flag to ignore disconnection reports */
@@ -600,7 +588,7 @@ bearer_update_status_connected (MMBaseBearer *self,
connection_monitor_start (self);
/* Run dispatcher scripts */
bearer_run_dispatcher_scripts (self, MM_DISPATCHER_CONNECTION_EVENT_CONNECTED);
bearer_run_dispatcher_scripts (self, TRUE);
}
/*****************************************************************************/
@@ -1130,6 +1118,7 @@ mm_base_bearer_connect (MMBaseBearer *self,
typedef struct {
MMBaseBearer *self;
MMBaseModem *modem;
GDBusMethodInvocation *invocation;
} HandleConnectContext;
@@ -1137,6 +1126,7 @@ static void
handle_connect_context_free (HandleConnectContext *ctx)
{
g_object_unref (ctx->invocation);
g_object_unref (ctx->modem);
g_object_unref (ctx->self);
g_free (ctx);
}
@@ -1157,13 +1147,13 @@ handle_connect_ready (MMBaseBearer *self,
}
static void
handle_connect_auth_ready (MMAuthProvider *authp,
handle_connect_auth_ready (MMBaseModem *modem,
GAsyncResult *res,
HandleConnectContext *ctx)
{
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_connect_context_free (ctx);
return;
@@ -1184,13 +1174,15 @@ handle_connect (MMBaseBearer *self,
ctx = g_new0 (HandleConnectContext, 1);
ctx->self = g_object_ref (self);
ctx->invocation = g_object_ref (invocation);
g_object_get (self,
MM_BASE_BEARER_MODEM, &ctx->modem,
NULL);
mm_auth_provider_authorize (self->priv->authp,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
self->priv->authp_cancellable,
(GAsyncReadyCallback)handle_connect_auth_ready,
ctx);
mm_base_modem_authorize (ctx->modem,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_connect_auth_ready,
ctx);
return TRUE;
}
@@ -1315,6 +1307,7 @@ mm_base_bearer_disconnect (MMBaseBearer *self,
typedef struct {
MMBaseBearer *self;
MMBaseModem *modem;
GDBusMethodInvocation *invocation;
} HandleDisconnectContext;
@@ -1322,6 +1315,7 @@ static void
handle_disconnect_context_free (HandleDisconnectContext *ctx)
{
g_object_unref (ctx->invocation);
g_object_unref (ctx->modem);
g_object_unref (ctx->self);
g_free (ctx);
}
@@ -1342,13 +1336,13 @@ handle_disconnect_ready (MMBaseBearer *self,
}
static void
handle_disconnect_auth_ready (MMAuthProvider *authp,
handle_disconnect_auth_ready (MMBaseModem *modem,
GAsyncResult *res,
HandleDisconnectContext *ctx)
{
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_disconnect_context_free (ctx);
return;
@@ -1369,13 +1363,15 @@ handle_disconnect (MMBaseBearer *self,
ctx = g_new0 (HandleDisconnectContext, 1);
ctx->self = g_object_ref (self);
ctx->invocation = g_object_ref (invocation);
g_object_get (self,
MM_BASE_BEARER_MODEM, &ctx->modem,
NULL);
mm_auth_provider_authorize (self->priv->authp,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
self->priv->authp_cancellable,
(GAsyncReadyCallback)handle_disconnect_auth_ready,
ctx);
mm_base_modem_authorize (ctx->modem,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_disconnect_auth_ready,
ctx);
return TRUE;
}
@@ -1492,14 +1488,11 @@ mm_base_bearer_disconnect_force (MMBaseBearer *self)
return;
if (self->priv->ignore_disconnection_reports) {
mm_obj_msg (self, "disconnection should be forced, but we can't. Request disconnection instead.");
mm_gdbus_bearer_set_disconnect_request (MM_GDBUS_BEARER(self), TRUE);
bearer_run_dispatcher_scripts (self,
MM_DISPATCHER_CONNECTION_EVENT_DISCONNECT_REQUEST);
mm_obj_dbg (self, "disconnection should be forced but it's explicitly ignored");
return;
}
mm_obj_msg (self, "forcing disconnection");
mm_obj_dbg (self, "forcing disconnection");
/* If currently connecting, try to cancel that operation. */
if (self->priv->status == MM_BEARER_STATUS_CONNECTING) {
@@ -1754,15 +1747,17 @@ set_property (GObject *object,
else if (self->priv->path)
base_bearer_dbus_export (self);
break;
case PROP_BIND_TO:
g_clear_object (&self->priv->bind_to);
self->priv->bind_to = g_value_dup_object (value);
mm_bind_to (MM_BIND (self), MM_BASE_BEARER_CONNECTION, self->priv->bind_to);
break;
case PROP_MODEM:
g_clear_object (&self->priv->modem);
self->priv->modem = g_value_dup_object (value);
if (self->priv->modem) {
/* Set owner ID */
mm_log_object_set_owner_id (MM_LOG_OBJECT (self), mm_log_object_get_id (MM_LOG_OBJECT (self->priv->modem)));
/* Bind the modem's connection (which is set when it is exported,
* and unset when unexported) to the BEARER's connection */
g_object_bind_property (self->priv->modem, MM_BASE_MODEM_CONNECTION,
self, MM_BASE_BEARER_CONNECTION,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
if (self->priv->config) {
/* Listen to 3GPP/CDMA registration state changes. We need both
* 'config' and 'modem' set. */
@@ -1812,9 +1807,6 @@ get_property (GObject *object,
case PROP_CONNECTION:
g_value_set_object (value, self->priv->connection);
break;
case PROP_BIND_TO:
g_value_set_object (value, self->priv->bind_to);
break;
case PROP_MODEM:
g_value_set_object (value, self->priv->modem);
break;
@@ -1843,10 +1835,6 @@ mm_base_bearer_init (MMBaseBearer *self)
/* Each bearer is given a unique id to build its own DBus path */
self->priv->dbus_id = id++;
/* Setup authorization provider */
self->priv->authp = mm_auth_provider_get ();
self->priv->authp_cancellable = g_cancellable_new ();
self->priv->status = MM_BEARER_STATUS_DISCONNECTED;
self->priv->reason_3gpp = CONNECTION_FORBIDDEN_REASON_NONE;
self->priv->reason_cdma = CONNECTION_FORBIDDEN_REASON_NONE;
@@ -1897,10 +1885,7 @@ dispose (GObject *object)
reset_deferred_unregistration (self);
g_clear_object (&self->priv->modem);
g_clear_object (&self->priv->bind_to);
g_clear_object (&self->priv->config);
g_cancellable_cancel (self->priv->authp_cancellable);
g_clear_object (&self->priv->authp_cancellable);
G_OBJECT_CLASS (mm_base_bearer_parent_class)->dispose (object);
}
@@ -1911,11 +1896,6 @@ log_object_iface_init (MMLogObjectInterface *iface)
iface->build_id = log_object_build_id;
}
static void
bind_iface_init (MMBindInterface *iface)
{
}
static void
mm_base_bearer_class_init (MMBaseBearerClass *klass)
{
@@ -1947,8 +1927,6 @@ mm_base_bearer_class_init (MMBaseBearerClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PATH, properties[PROP_PATH]);
g_object_class_override_property (object_class, PROP_BIND_TO, MM_BIND_TO);
properties[PROP_MODEM] =
g_param_spec_object (MM_BASE_BEARER_MODEM,
"Modem",
+461 -451
View File
File diff suppressed because it is too large Load Diff
+18 -28
View File
@@ -23,8 +23,8 @@
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
#include "mm-base-modem.h"
#include "mm-call-audio-format.h"
#include "mm-port.h"
#define MM_TYPE_BASE_CALL (mm_base_call_get_type ())
#define MM_BASE_CALL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BASE_CALL, MMBaseCall))
@@ -37,13 +37,9 @@ typedef struct _MMBaseCall MMBaseCall;
typedef struct _MMBaseCallClass MMBaseCallClass;
typedef struct _MMBaseCallPrivate MMBaseCallPrivate;
#define MM_CALL_DIRECTION "direction"
#define MM_CALL_NUMBER "number"
#define MM_CALL_DTMF_TONE_DURATION "dtmf-tone-duration"
#define MM_BASE_CALL_PATH "call-path"
#define MM_BASE_CALL_CONNECTION "call-connection"
#define MM_BASE_CALL_IFACE_MODEM_VOICE "call-iface-modem-voice"
#define MM_BASE_CALL_MODEM "call-modem"
#define MM_BASE_CALL_SKIP_INCOMING_TIMEOUT "call-skip-incoming-timeout"
#define MM_BASE_CALL_SUPPORTS_DIALING_TO_RINGING "call-supports-dialing-to-ringing"
#define MM_BASE_CALL_SUPPORTS_RINGING_TO_ACTIVE "call-supports-ringing-to-active"
@@ -90,28 +86,27 @@ struct _MMBaseCallClass {
GAsyncResult *res,
GError **error);
/* DTMF tone handling */
void (* send_dtmf) (MMBaseCall *self,
const gchar *dtmf,
GAsyncReadyCallback callback,
gpointer user_data);
/* Returns the number of DTMF characters sent, or < 1 on error */
gssize (* send_dtmf_finish) (MMBaseCall *self,
GAsyncResult *res,
GError **error);
void (* stop_dtmf) (MMBaseCall *self,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* stop_dtmf_finish) (MMBaseCall *self,
GAsyncResult *res,
GError **error);
/* Send a DTMF tone */
void (* send_dtmf) (MMBaseCall *self,
const gchar *dtmf,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean (* send_dtmf_finish) (MMBaseCall *self,
GAsyncResult *res,
GError **error);
};
GType mm_base_call_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMBaseCall, g_object_unref)
/* This one can be overridden by plugins */
MMBaseCall *mm_base_call_new (MMBaseModem *modem,
MMCallDirection direction,
const gchar *number,
gboolean skip_incoming_timeout,
gboolean supports_dialing_to_ringing,
gboolean supports_ringing_to_active);
void mm_base_call_export (MMBaseCall *self);
void mm_base_call_unexport (MMBaseCall *self);
@@ -142,9 +137,4 @@ void mm_base_call_received_dtmf (MMBaseCall *self,
void mm_base_call_incoming_refresh (MMBaseCall *self);
guint mm_base_call_get_dtmf_tone_duration (MMBaseCall *self);
void mm_base_call_set_dtmf_tone_duration (MMBaseCall *self,
guint duration_ms);
#endif /* MM_BASE_CALL_H */
+38 -30
View File
@@ -25,24 +25,26 @@
#include <libmm-glib.h>
#include "mm-base-cbm.h"
#include "mm-broadband-modem.h"
#include "mm-iface-modem.h"
#include "mm-iface-modem-cell-broadcast.h"
#include "mm-cbm-part.h"
#include "mm-base-modem-at.h"
#include "mm-base-modem.h"
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-error-helpers.h"
#include "mm-bind.h"
static void log_object_iface_init (MMLogObjectInterface *iface);
static void bind_iface_init (MMBindInterface *iface);
G_DEFINE_TYPE_EXTENDED (MMBaseCbm, mm_base_cbm, MM_GDBUS_TYPE_CBM_SKELETON, 0,
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_BIND, bind_iface_init))
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
enum {
PROP_0,
PROP_PATH,
PROP_CONNECTION,
PROP_BIND_TO,
PROP_MODEM,
PROP_MAX_PARTS,
PROP_SERIAL,
PROP_LAST
@@ -55,9 +57,8 @@ struct _MMBaseCbmPrivate {
GDBusConnection *connection;
guint dbus_id;
/* The object this CBM is bound to */
GObject *bind_to;
/* The modem which owns this CBM */
MMBaseModem *modem;
/* The path where the CBM object is exported */
gchar *path;
@@ -173,7 +174,6 @@ initialize_cbm (MMBaseCbm *self)
"channel", mm_cbm_part_get_channel (part),
"update", CBM_SERIAL_MESSAGE_CODE_UPDATE (serial),
"message-code", CBM_SERIAL_MESSAGE_CODE (serial),
"language", mm_cbm_part_get_language (part),
NULL);
}
@@ -323,15 +323,15 @@ mm_base_cbm_take_part (MMBaseCbm *self,
}
MMBaseCbm *
mm_base_cbm_new (GObject *bind_to)
mm_base_cbm_new (MMBaseModem *modem)
{
return MM_BASE_CBM (g_object_new (MM_TYPE_BASE_CBM,
MM_BIND_TO, bind_to,
MM_BASE_CBM_MODEM, modem,
NULL));
}
MMBaseCbm *
mm_base_cbm_new_with_part (GObject *bind_to,
mm_base_cbm_new_with_part (MMBaseModem *modem,
MMCbmState state,
guint max_parts,
MMCbmPart *first_part,
@@ -339,11 +339,13 @@ mm_base_cbm_new_with_part (GObject *bind_to,
{
MMBaseCbm *self;
g_assert (MM_IS_IFACE_MODEM_CELL_BROADCAST (modem));
if (state == MM_CBM_STATE_RECEIVED)
state = MM_CBM_STATE_RECEIVING;
/* Create a CBM object as defined by the interface */
self = mm_base_cbm_new (bind_to);
self = mm_iface_modem_cell_broadcast_create_cbm (MM_IFACE_MODEM_CELL_BROADCAST (modem));
g_object_set (self,
MM_BASE_CBM_MAX_PARTS, max_parts,
"state", state,
@@ -403,10 +405,18 @@ set_property (GObject *object,
else if (self->priv->path)
cbm_dbus_export (self);
break;
case PROP_BIND_TO:
g_clear_object (&self->priv->bind_to);
self->priv->bind_to = g_value_dup_object (value);
mm_bind_to (MM_BIND (self), MM_BASE_CBM_CONNECTION, self->priv->bind_to);
case PROP_MODEM:
g_clear_object (&self->priv->modem);
self->priv->modem = g_value_dup_object (value);
if (self->priv->modem) {
/* Set owner ID */
mm_log_object_set_owner_id (MM_LOG_OBJECT (self), mm_log_object_get_id (MM_LOG_OBJECT (self->priv->modem)));
/* Bind the modem's connection (which is set when it is exported,
* and unset when unexported) to the CBM's connection */
g_object_bind_property (self->priv->modem, MM_BASE_MODEM_CONNECTION,
self, MM_BASE_CBM_CONNECTION,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
}
break;
case PROP_MAX_PARTS:
self->priv->max_parts = g_value_get_uint (value);
@@ -435,8 +445,8 @@ get_property (GObject *object,
case PROP_CONNECTION:
g_value_set_object (value, self->priv->connection);
break;
case PROP_BIND_TO:
g_value_set_object (value, self->priv->bind_to);
case PROP_MODEM:
g_value_set_object (value, self->priv->modem);
break;
case PROP_MAX_PARTS:
g_value_set_uint (value, self->priv->max_parts);
@@ -486,7 +496,7 @@ dispose (GObject *object)
g_clear_object (&self->priv->connection);
}
g_clear_object (&self->priv->bind_to);
g_clear_object (&self->priv->modem);
G_OBJECT_CLASS (mm_base_cbm_parent_class)->dispose (object);
}
@@ -497,11 +507,6 @@ log_object_iface_init (MMLogObjectInterface *iface)
iface->build_id = log_object_build_id;
}
static void
bind_iface_init (MMBindInterface *iface)
{
}
static void
mm_base_cbm_class_init (MMBaseCbmClass *klass)
{
@@ -521,7 +526,6 @@ mm_base_cbm_class_init (MMBaseCbmClass *klass)
"GDBus connection to the system bus.",
G_TYPE_DBUS_CONNECTION,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_CONNECTION, properties[PROP_CONNECTION]);
properties[PROP_PATH] =
g_param_spec_string (MM_BASE_CBM_PATH,
@@ -529,9 +533,13 @@ mm_base_cbm_class_init (MMBaseCbmClass *klass)
"DBus path of the CBM",
NULL,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_PATH, properties[PROP_PATH]);
g_object_class_override_property (object_class, PROP_BIND_TO, MM_BIND_TO);
properties[PROP_MODEM] =
g_param_spec_object (MM_BASE_CBM_MODEM,
"Modem",
"The Modem which owns this CBM",
MM_TYPE_BASE_MODEM,
G_PARAM_READWRITE);
properties[PROP_MAX_PARTS] =
g_param_spec_uint (MM_BASE_CBM_MAX_PARTS,
@@ -539,7 +547,6 @@ mm_base_cbm_class_init (MMBaseCbmClass *klass)
"Maximum number of parts composing this CBM",
1, 255, 1,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_MAX_PARTS, properties[PROP_MAX_PARTS]);
properties[PROP_SERIAL] =
g_param_spec_uint (MM_BASE_CBM_SERIAL,
@@ -547,7 +554,8 @@ mm_base_cbm_class_init (MMBaseCbmClass *klass)
"The serial of this CBM",
0, G_MAXUINT16, 0,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_SERIAL, properties[PROP_SERIAL]);
g_object_class_install_properties (object_class, PROP_LAST, properties);
}
guint16
+4 -2
View File
@@ -23,6 +23,7 @@
#include <libmm-glib.h>
#include "mm-cbm-part.h"
#include "mm-base-modem.h"
/*****************************************************************************/
@@ -39,6 +40,7 @@ typedef struct _MMBaseCbmPrivate MMBaseCbmPrivate;
#define MM_BASE_CBM_PATH "cbm-path"
#define MM_BASE_CBM_CONNECTION "cbm-connection"
#define MM_BASE_CBM_MODEM "cbm-modem"
#define MM_BASE_CBM_MAX_PARTS "cbm-max-parts"
#define MM_BASE_CBM_SERIAL "cbm-serial"
@@ -54,11 +56,11 @@ struct _MMBaseCbmClass {
GType mm_base_cbm_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMBaseCbm, g_object_unref)
MMBaseCbm *mm_base_cbm_new (GObject *bind_to);
MMBaseCbm *mm_base_cbm_new (MMBaseModem *modem);
gboolean mm_base_cbm_take_part (MMBaseCbm *self,
MMCbmPart *part,
GError **error);
MMBaseCbm *mm_base_cbm_new_with_part (GObject *bind_to,
MMBaseCbm *mm_base_cbm_new_with_part (MMBaseModem *modem,
MMCbmState state,
guint max_parts,
MMCbmPart *first_part,
+4 -4
View File
@@ -1014,8 +1014,8 @@ device_cleanup_step (GTask *task)
"disabling modem%d",
mm_base_modem_get_dbus_id (ctx->modem));
mm_base_modem_disable (ctx->modem,
MM_OPERATION_LOCK_REQUIRED,
MM_OPERATION_PRIORITY_OVERRIDE,
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
(GAsyncReadyCallback)cleanup_disable_ready,
task);
return;
@@ -1058,7 +1058,7 @@ device_cleanup_step (GTask *task)
"settting terse on modem%d",
mm_base_modem_get_dbus_id (ctx->modem));
mm_base_modem_terse (ctx->modem,
MM_OPERATION_LOCK_REQUIRED,
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
(GAsyncReadyCallback)cleanup_terse_ready,
task);
return;
@@ -1289,7 +1289,7 @@ mm_base_manager_sync (MMBaseManager *self)
/* We just want to start the synchronization, we don't need the result */
if (modem) {
mm_base_modem_sync (modem,
MM_OPERATION_LOCK_REQUIRED,
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
(GAsyncReadyCallback)base_modem_sync_ready,
NULL);
}
+109 -175
View File
@@ -39,16 +39,11 @@
#include "mm-daemon-enums-types.h"
#include "mm-serial-parsers.h"
#include "mm-modem-helpers.h"
#include "mm-bind.h"
static void log_object_iface_init (MMLogObjectInterface *iface);
static void auth_iface_init (MMIfaceAuthInterface *iface);
static void op_lock_iface_init (MMIfaceOpLockInterface *iface);
G_DEFINE_ABSTRACT_TYPE_WITH_CODE (MMBaseModem, mm_base_modem, MM_GDBUS_TYPE_OBJECT_SKELETON,
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_AUTH, auth_iface_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_IFACE_OP_LOCK, op_lock_iface_init))
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
/* If we get 10 consecutive timeouts in a serial port, we consider the modem
* invalid and we request re-probing. */
@@ -155,16 +150,6 @@ struct _MMBaseModemPrivate {
gboolean scheduled_operations_forbidden_forever;
};
static void mm_base_modem_operation_lock (MMBaseModem *self,
MMOperationPriority priority,
const gchar *description,
GAsyncReadyCallback callback,
gpointer user_data);
static gssize mm_base_modem_operation_lock_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
guint
mm_base_modem_get_dbus_id (MMBaseModem *self)
{
@@ -207,13 +192,11 @@ port_timed_out_cb (MMPort *port,
static MMPort *
base_modem_create_ignored_port (MMBaseModem *self,
MMPortType ptype,
const gchar *name)
{
return MM_PORT (g_object_new (MM_TYPE_PORT,
MM_PORT_DEVICE, name,
MM_PORT_GROUP, MM_PORT_GROUP_IGNORED,
MM_PORT_TYPE, ptype,
MM_PORT_TYPE, MM_PORT_TYPE_IGNORED,
NULL));
}
@@ -345,7 +328,6 @@ base_modem_create_wwan_port (MMBaseModem *self,
return MM_PORT (g_object_new (MM_TYPE_PORT,
MM_PORT_DEVICE, name,
MM_PORT_SUBSYS, MM_PORT_SUBSYS_WWAN,
MM_PORT_GROUP, MM_PORT_GROUP_USED,
MM_PORT_TYPE, MM_PORT_TYPE_XMMRPC,
NULL));
@@ -363,7 +345,6 @@ static MMPort *
base_modem_internal_grab_port (MMBaseModem *self,
MMKernelDevice *kernel_device,
gboolean link_port,
MMPortGroup pgroup,
MMPortType ptype,
MMPortSerialAtFlag at_pflags,
GError **error)
@@ -398,8 +379,8 @@ base_modem_internal_grab_port (MMBaseModem *self,
/* Explicitly ignored ports, grab them but explicitly flag them as ignored
* right away, all the same way (i.e. regardless of subsystem). */
if (pgroup == MM_PORT_GROUP_IGNORED)
port = base_modem_create_ignored_port (self, ptype, name);
if (ptype == MM_PORT_TYPE_IGNORED)
port = base_modem_create_ignored_port (self, name);
else if (g_str_equal (subsys, "net"))
port = base_modem_create_net_port (self, name);
else if (g_str_equal (subsys, "tty"))
@@ -424,38 +405,25 @@ base_modem_internal_grab_port (MMBaseModem *self,
}
/* Setup consecutive ports and removal watchers in all control ports */
if (pgroup == MM_PORT_GROUP_USED) {
if (MM_IS_PORT_SERIAL_AT (port)) {
mm_obj_dbg (port, "port monitoring enabled in AT port");
port_monitoring = TRUE;
} else if (MM_IS_PORT_SERIAL_QCDM (port)) {
mm_obj_dbg (port, "port monitoring enabled in QCDM port");
port_monitoring = TRUE;
}
if (MM_IS_PORT_SERIAL_AT (port)) {
mm_obj_dbg (port, "port monitoring enabled in AT port");
port_monitoring = TRUE;
} else if (MM_IS_PORT_SERIAL_QCDM (port)) {
mm_obj_dbg (port, "port monitoring enabled in QCDM port");
port_monitoring = TRUE;
}
#if defined WITH_QMI
else if (MM_IS_PORT_QMI (port)) {
mm_obj_dbg (port, "port monitoring enabled in QMI port");
port_monitoring = TRUE;
}
else if (MM_IS_PORT_QMI (port)) {
mm_obj_dbg (port, "port monitoring enabled in QMI port");
port_monitoring = TRUE;
}
#endif
#if defined WITH_MBIM
else if (MM_IS_PORT_MBIM (port)) {
mm_obj_dbg (port, "port monitoring enabled in MBIM port");
port_monitoring = TRUE;
}
else if (MM_IS_PORT_MBIM (port)) {
mm_obj_dbg (port, "port monitoring enabled in MBIM port");
port_monitoring = TRUE;
}
#endif
}
/* Check if a custom max timeouts value is set via udev */
if (mm_kernel_device_has_global_property (kernel_device, ID_MM_MAX_TIMEOUTS)) {
guint max_timeouts;
max_timeouts = mm_kernel_device_get_global_property_as_int (kernel_device, ID_MM_MAX_TIMEOUTS);
if (max_timeouts != self->priv->max_timeouts) {
mm_obj_dbg (self, "max timeouts overridden via udev: %u", max_timeouts);
self->priv->max_timeouts = max_timeouts;
}
}
if (port_monitoring) {
if (self->priv->max_timeouts > 0)
@@ -479,7 +447,6 @@ base_modem_internal_grab_port (MMBaseModem *self,
if (MM_IS_PORT_SERIAL_AT (port)) {
mm_port_serial_at_set_response_parser (MM_PORT_SERIAL_AT (port),
mm_serial_parser_v1_parse,
mm_serial_parser_v1_remove_echo,
mm_serial_parser_v1_new (),
mm_serial_parser_v1_destroy);
/* Prefer plugin-provided flags to the generic ones */
@@ -522,14 +489,13 @@ base_modem_internal_grab_port (MMBaseModem *self,
gboolean
mm_base_modem_grab_port (MMBaseModem *self,
MMKernelDevice *kernel_device,
MMPortGroup pgroup,
MMPortType ptype,
MMPortSerialAtFlag at_pflags,
GError **error)
{
g_autoptr(GError) inner_error = NULL;
if (!base_modem_internal_grab_port (self, kernel_device, FALSE, pgroup, ptype, at_pflags, &inner_error)) {
if (!base_modem_internal_grab_port (self, kernel_device, FALSE, ptype, at_pflags, &inner_error)) {
/* If the port was REQUIRED via udev tags and we failed to grab it, we will report
* a fatal error. */
if (mm_kernel_device_get_property_as_boolean (kernel_device, ID_MM_REQUIRED)) {
@@ -576,7 +542,6 @@ mm_base_modem_grab_link_port (MMBaseModem *self,
port = base_modem_internal_grab_port (self,
kernel_device,
TRUE,
MM_PORT_GROUP_USED,
MM_PORT_TYPE_NET,
MM_PORT_SERIAL_AT_FLAG_NONE,
error);
@@ -802,7 +767,7 @@ state_operation_ready (MMBaseModem *self,
ctx = g_task_get_task_data (task);
if (ctx->operation_id >= 0) {
mm_iface_op_lock_unlock (MM_IFACE_OP_LOCK (self), ctx->operation_id);
mm_base_modem_operation_unlock (self, ctx->operation_id);
ctx->operation_id = (gssize) -1;
}
@@ -849,12 +814,12 @@ lock_before_state_operation_ready (MMBaseModem *self,
}
static void
state_operation (MMBaseModem *self,
StateOperationType operation_type,
MMOperationLock operation_lock,
MMOperationPriority operation_priority,
GAsyncReadyCallback callback,
gpointer user_data)
state_operation (MMBaseModem *self,
StateOperationType operation_type,
MMBaseModemOperationLock operation_lock,
MMBaseModemOperationPriority operation_priority,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
StateOperationContext *ctx;
@@ -912,12 +877,12 @@ state_operation (MMBaseModem *self,
}
g_assert (ctx->operation && ctx->operation_finish);
if (operation_lock == MM_OPERATION_LOCK_ALREADY_ACQUIRED) {
if (operation_lock == MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED) {
state_operation_run (task);
return;
}
g_assert (operation_lock == MM_OPERATION_LOCK_REQUIRED);
g_assert (operation_lock == MM_BASE_MODEM_OPERATION_LOCK_REQUIRED);
mm_base_modem_operation_lock (self,
operation_priority,
operation_description,
@@ -939,14 +904,14 @@ mm_base_modem_sync_finish (MMBaseModem *self,
void
mm_base_modem_sync (MMBaseModem *self,
MMOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data)
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data)
{
state_operation (self,
STATE_OPERATION_TYPE_SYNC,
operation_lock,
MM_OPERATION_PRIORITY_DEFAULT,
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -961,14 +926,14 @@ mm_base_modem_terse_finish (MMBaseModem *self,
void
mm_base_modem_terse (MMBaseModem *self,
MMOperationLock operation_lock,
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data)
{
state_operation (self,
STATE_OPERATION_TYPE_TERSE,
operation_lock,
MM_OPERATION_PRIORITY_DEFAULT,
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -986,11 +951,11 @@ mm_base_modem_disable_finish (MMBaseModem *self,
}
void
mm_base_modem_disable (MMBaseModem *self,
MMOperationLock operation_lock,
MMOperationPriority operation_priority,
GAsyncReadyCallback callback,
gpointer user_data)
mm_base_modem_disable (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
MMBaseModemOperationPriority operation_priority,
GAsyncReadyCallback callback,
gpointer user_data)
{
state_operation (self,
STATE_OPERATION_TYPE_DISABLE,
@@ -1011,15 +976,15 @@ mm_base_modem_enable_finish (MMBaseModem *self,
}
void
mm_base_modem_enable (MMBaseModem *self,
MMOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data)
mm_base_modem_enable (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data)
{
state_operation (self,
STATE_OPERATION_TYPE_ENABLE,
operation_lock,
MM_OPERATION_PRIORITY_DEFAULT,
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -1035,15 +1000,15 @@ mm_base_modem_initialize_finish (MMBaseModem *self,
}
void
mm_base_modem_initialize (MMBaseModem *self,
MMOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data)
mm_base_modem_initialize (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data)
{
state_operation (self,
STATE_OPERATION_TYPE_INITIALIZE,
operation_lock,
MM_OPERATION_PRIORITY_DEFAULT,
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
callback,
user_data);
}
@@ -1330,28 +1295,25 @@ port_info_cmp (const MMModemPortInfo *a,
return g_strcmp0 (a->name, b->name);
}
static MMModemPortInfo *
parse_port_infos (GHashTable *ports,
guint *n_port_infos,
MMPortGroup pgroup_filter)
MMModemPortInfo *
mm_base_modem_get_port_infos (MMBaseModem *self,
guint *n_port_infos)
{
GHashTableIter iter;
GArray *port_infos;
MMPort *port;
if (!ports) {
if (!self->priv->ports) {
*n_port_infos = 0;
return NULL;
}
port_infos = g_array_new (FALSE, FALSE, sizeof (MMModemPortInfo));
g_hash_table_iter_init (&iter, ports);
*n_port_infos = g_hash_table_size (self->priv->ports);
port_infos = g_array_sized_new (FALSE, FALSE, sizeof (MMModemPortInfo), *n_port_infos);
g_hash_table_iter_init (&iter, self->priv->ports);
while (g_hash_table_iter_next (&iter, NULL, (gpointer)&port)) {
MMModemPortInfo port_info;
if (mm_port_get_port_group (port) != pgroup_filter)
continue;
port_info.name = g_strdup (mm_port_get_device (port));
switch (mm_port_get_port_type (port)) {
case MM_PORT_TYPE_NET:
@@ -1390,25 +1352,11 @@ parse_port_infos (GHashTable *ports,
g_array_append_val (port_infos, port_info);
}
*n_port_infos = port_infos->len;
g_assert (*n_port_infos == port_infos->len);
g_array_sort (port_infos, (GCompareFunc) port_info_cmp);
return (MMModemPortInfo *) g_array_free (port_infos, FALSE);
}
MMModemPortInfo *
mm_base_modem_get_port_infos (MMBaseModem *self,
guint *n_port_infos)
{
return parse_port_infos (self->priv->ports, n_port_infos, MM_PORT_GROUP_USED);
}
MMModemPortInfo *
mm_base_modem_get_ignored_port_infos (MMBaseModem *self,
guint *n_port_infos)
{
return parse_port_infos (self->priv->ports, n_port_infos, MM_PORT_GROUP_IGNORED);
}
static gint
port_cmp (MMPort *a,
MMPort *b)
@@ -1550,10 +1498,6 @@ mm_base_modem_organize_ports (MMBaseModem *self,
g_hash_table_iter_init (&iter, self->priv->ports);
while (g_hash_table_iter_next (&iter, NULL, (gpointer *) &candidate)) {
/* Skip ports that should not be used */
if (mm_port_get_port_group (candidate) != MM_PORT_GROUP_USED)
continue;
switch (mm_port_get_port_type (candidate)) {
case MM_PORT_TYPE_AT:
@@ -1831,8 +1775,8 @@ mm_base_modem_organize_ports (MMBaseModem *self,
/*****************************************************************************/
/* Authorization */
static gboolean
mm_base_modem_authorize_finish (MMIfaceAuth *auth,
gboolean
mm_base_modem_authorize_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error)
{
@@ -1854,18 +1798,24 @@ authorize_ready (MMAuthProvider *authp,
g_object_unref (task);
}
static void
mm_base_modem_authorize (MMIfaceAuth *auth,
void
mm_base_modem_authorize (MMBaseModem *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMBaseModem *self = MM_BASE_MODEM (auth);
GTask *task;
GTask *task;
task = g_task_new (self, self->priv->authp_cancellable, callback, user_data);
/* When running in the session bus for tests, default to always allow */
if (mm_context_get_test_session ()) {
g_task_return_boolean (task, TRUE);
g_object_unref (task);
return;
}
mm_auth_provider_authorize (self->priv->authp,
invocation,
authorization,
@@ -1878,10 +1828,10 @@ mm_base_modem_authorize (MMIfaceAuth *auth,
/* Exclusive operation */
typedef struct {
gssize id;
MMOperationPriority priority;
gchar *description;
GTask *wait_task;
gssize id;
MMBaseModemOperationPriority priority;
gchar *description;
GTask *wait_task;
} OperationInfo;
static void
@@ -1894,7 +1844,7 @@ operation_info_free (OperationInfo *info)
/* Exclusive operation lock */
static gssize
gssize
mm_base_modem_operation_lock_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error)
@@ -1919,7 +1869,7 @@ base_modem_operation_run (MMBaseModem *self)
/* Run the operation in head of the list */
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: lock acquired",
info->id,
mm_operation_priority_get_string (info->priority),
mm_base_modem_operation_priority_get_string (info->priority),
info->description);
task = g_steal_pointer (&info->wait_task);
g_task_return_int (task, info->id);
@@ -1962,7 +1912,7 @@ abort_pending_operations (MMBaseModem *self)
g_assert (info->wait_task);
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: aborted early",
info->id,
mm_operation_priority_get_string (info->priority),
mm_base_modem_operation_priority_get_string (info->priority),
info->description);
task = g_steal_pointer (&info->wait_task);
@@ -1975,12 +1925,12 @@ abort_pending_operations (MMBaseModem *self)
self->priv->scheduled_operations = head;
}
static void
mm_base_modem_operation_lock (MMBaseModem *self,
MMOperationPriority priority,
const gchar *description,
GAsyncReadyCallback callback,
gpointer user_data)
void
mm_base_modem_operation_lock (MMBaseModem *self,
MMBaseModemOperationPriority priority,
const gchar *description,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
OperationInfo *info;
@@ -2007,19 +1957,19 @@ mm_base_modem_operation_lock (MMBaseModem *self,
} else
operation_id++;
if (info->priority == MM_OPERATION_PRIORITY_OVERRIDE) {
if (info->priority == MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE) {
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: override requested - no new operations will be allowed",
info->id,
mm_operation_priority_get_string (info->priority),
mm_base_modem_operation_priority_get_string (info->priority),
info->description);
g_assert (!self->priv->scheduled_operations_forbidden_forever);
self->priv->scheduled_operations_forbidden_forever = TRUE;
abort_pending_operations (self);
self->priv->scheduled_operations = g_list_append (self->priv->scheduled_operations, info);
} else if (info->priority == MM_OPERATION_PRIORITY_DEFAULT) {
} else if (info->priority == MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT) {
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: scheduled",
info->id,
mm_operation_priority_get_string (info->priority),
mm_base_modem_operation_priority_get_string (info->priority),
info->description);
self->priv->scheduled_operations = g_list_append (self->priv->scheduled_operations, info);
} else
@@ -2030,11 +1980,10 @@ mm_base_modem_operation_lock (MMBaseModem *self,
/* Exclusive operation unlock */
static void
mm_base_modem_operation_unlock (MMIfaceOpLock *_self,
gssize operation_id)
void
mm_base_modem_operation_unlock (MMBaseModem *self,
gssize operation_id)
{
MMBaseModem *self = MM_BASE_MODEM (_self);
OperationInfo *info;
g_assert (self->priv->scheduled_operations);
@@ -2045,7 +1994,7 @@ mm_base_modem_operation_unlock (MMIfaceOpLock *_self,
mm_obj_dbg (self, "[operation %" G_GSSIZE_FORMAT "] %s - %s: lock released",
info->id,
mm_operation_priority_get_string (info->priority),
mm_base_modem_operation_priority_get_string (info->priority),
info->description);
/* Remove head list item and free its contents */
@@ -2060,9 +2009,9 @@ mm_base_modem_operation_unlock (MMIfaceOpLock *_self,
/*****************************************************************************/
typedef struct {
GDBusMethodInvocation *invocation;
MMOperationPriority operation_priority;
gchar *operation_description;
GDBusMethodInvocation *invocation;
MMBaseModemOperationPriority operation_priority;
gchar *operation_description;
} AuthorizeAndOperationLockContext;
static void
@@ -2073,8 +2022,8 @@ authorize_and_operation_lock_context_free (AuthorizeAndOperationLockContext *ctx
g_slice_free (AuthorizeAndOperationLockContext, ctx);
}
static gssize
mm_base_modem_authorize_and_operation_lock_finish (MMIfaceOpLock *self,
gssize
mm_base_modem_authorize_and_operation_lock_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error)
{
@@ -2098,35 +2047,35 @@ lock_after_authorize_ready (MMBaseModem *self,
}
static void
authorize_before_lock_ready (MMIfaceAuth *auth,
authorize_before_lock_ready (MMBaseModem *self,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
AuthorizeAndOperationLockContext *ctx;
if (!mm_iface_auth_authorize_finish (auth, res, &error)) {
if (!mm_base_modem_authorize_finish (self, res, &error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
ctx = g_task_get_task_data (task);
mm_base_modem_operation_lock (MM_BASE_MODEM (auth),
mm_base_modem_operation_lock (self,
ctx->operation_priority,
ctx->operation_description,
(GAsyncReadyCallback) lock_after_authorize_ready,
task);
}
static void
mm_base_modem_authorize_and_operation_lock (MMIfaceOpLock *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
MMOperationPriority operation_priority,
const gchar *operation_description,
GAsyncReadyCallback callback,
gpointer user_data)
void
mm_base_modem_authorize_and_operation_lock (MMBaseModem *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
MMBaseModemOperationPriority operation_priority,
const gchar *operation_description,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
AuthorizeAndOperationLockContext *ctx;
@@ -2139,7 +2088,7 @@ mm_base_modem_authorize_and_operation_lock (MMIfaceOpLock *self,
ctx->operation_description = g_strdup (operation_description);
g_task_set_task_data (task, ctx, (GDestroyNotify)authorize_and_operation_lock_context_free);
mm_iface_auth_authorize (MM_IFACE_AUTH (self),
mm_base_modem_authorize (self,
invocation,
authorization,
(GAsyncReadyCallback)authorize_before_lock_ready,
@@ -2681,21 +2630,6 @@ log_object_iface_init (MMLogObjectInterface *iface)
iface->build_id = log_object_build_id;
}
static void
auth_iface_init (MMIfaceAuthInterface *iface)
{
iface->authorize = mm_base_modem_authorize;
iface->authorize_finish = mm_base_modem_authorize_finish;
}
static void
op_lock_iface_init (MMIfaceOpLockInterface *iface)
{
iface->authorize_and_lock = mm_base_modem_authorize_and_operation_lock;
iface->authorize_and_lock_finish = mm_base_modem_authorize_and_operation_lock_finish;
iface->unlock = mm_base_modem_operation_unlock;
}
static void
mm_base_modem_class_init (MMBaseModemClass *klass)
{
@@ -2794,7 +2728,7 @@ mm_base_modem_class_init (MMBaseModemClass *klass)
g_object_class_install_property (object_class, PROP_SUBSYSTEM_DEVICE_ID, properties[PROP_SUBSYSTEM_DEVICE_ID]);
properties[PROP_CONNECTION] =
g_param_spec_object (MM_BINDABLE_CONNECTION,
g_param_spec_object (MM_BASE_MODEM_CONNECTION,
"Connection",
"GDBus connection to the system bus.",
G_TYPE_DBUS_CONNECTION,
+89 -39
View File
@@ -36,7 +36,6 @@
#include "mm-port-serial-qcdm.h"
#include "mm-port-serial-gps.h"
#include "mm-iface-port-at.h"
#include "mm-iface-op-lock.h"
#if defined WITH_QMI
#include "mm-port-qmi.h"
@@ -57,6 +56,7 @@ typedef struct _MMBaseModem MMBaseModem;
typedef struct _MMBaseModemClass MMBaseModemClass;
typedef struct _MMBaseModemPrivate MMBaseModemPrivate;
#define MM_BASE_MODEM_CONNECTION "base-modem-connection"
#define MM_BASE_MODEM_MAX_TIMEOUTS "base-modem-max-timeouts"
#define MM_BASE_MODEM_VALID "base-modem-valid"
#define MM_BASE_MODEM_DEVICE "base-modem-device"
@@ -146,7 +146,6 @@ guint mm_base_modem_get_dbus_id (MMBaseModem *self);
gboolean mm_base_modem_grab_port (MMBaseModem *self,
MMKernelDevice *kernel_device,
MMPortGroup pgroup,
MMPortType ptype,
MMPortSerialAtFlag at_pflags,
GError **error);
@@ -193,8 +192,6 @@ GList *mm_base_modem_get_data_ports (MMBaseModem *self);
MMModemPortInfo *mm_base_modem_get_port_infos (MMBaseModem *self,
guint *n_port_infos);
MMModemPortInfo *mm_base_modem_get_ignored_port_infos (MMBaseModem *self,
guint *n_port_infos);
GList *mm_base_modem_find_ports (MMBaseModem *self,
MMPortSubsys subsys,
@@ -228,49 +225,102 @@ guint mm_base_modem_get_subsystem_device_id (MMBaseModem *self);
GCancellable *mm_base_modem_peek_cancellable (MMBaseModem *self);
/******************************************************************************/
/* Polkit */
void mm_base_modem_authorize (MMBaseModem *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_authorize_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
/******************************************************************************/
/* Operation lock support */
typedef enum { /*< underscore_name=mm_base_modem_operation_priority >*/
MM_BASE_MODEM_OPERATION_PRIORITY_UNKNOWN,
/* Default operations are scheduled at the end of the list of pending
* operations */
MM_BASE_MODEM_OPERATION_PRIORITY_DEFAULT,
/* An override operation will make all pending operations be cancelled, and
* it will also disallow adding new operations. This type of operation would
* be the last one expected in a modem object. */
MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
} MMBaseModemOperationPriority;
void mm_base_modem_operation_lock (MMBaseModem *self,
MMBaseModemOperationPriority priority,
const gchar *description,
GAsyncReadyCallback callback,
gpointer user_data);
gssize mm_base_modem_operation_lock_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
void mm_base_modem_operation_unlock (MMBaseModem *self,
gssize operation_id);
void mm_base_modem_authorize_and_operation_lock (MMBaseModem *self,
GDBusMethodInvocation *invocation,
const gchar *authorization,
MMBaseModemOperationPriority operation_priority,
const gchar *operation_description,
GAsyncReadyCallback callback,
gpointer user_data);
gssize mm_base_modem_authorize_and_operation_lock_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
/******************************************************************************/
/* State operations */
void mm_base_modem_initialize (MMBaseModem *self,
MMOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_initialize_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
typedef enum {
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
MM_BASE_MODEM_OPERATION_LOCK_ALREADY_ACQUIRED,
} MMBaseModemOperationLock;
void mm_base_modem_enable (MMBaseModem *self,
MMOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_enable_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
void mm_base_modem_disable (MMBaseModem *self,
MMOperationLock operation_lock,
MMOperationPriority priority,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_disable_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
#if defined WITH_SUSPEND_RESUME
void mm_base_modem_sync (MMBaseModem *self,
MMOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_sync_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
void mm_base_modem_terse (MMBaseModem *self,
MMOperationLock operation_lock,
void mm_base_modem_initialize (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_terse_finish (MMBaseModem *self,
gboolean mm_base_modem_initialize_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
void mm_base_modem_enable (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_enable_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
void mm_base_modem_disable (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
MMBaseModemOperationPriority priority,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_disable_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
#if defined WITH_SUSPEND_RESUME
void mm_base_modem_sync (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_sync_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
void mm_base_modem_terse (MMBaseModem *self,
MMBaseModemOperationLock operation_lock,
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_base_modem_terse_finish (MMBaseModem *self,
GAsyncResult *res,
GError **error);
#endif
void mm_base_modem_teardown_ports (MMBaseModem *self,
+46 -139
View File
@@ -34,22 +34,18 @@
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-error-helpers.h"
#include "mm-bind.h"
static void async_initable_iface_init (GAsyncInitableIface *iface);
static void log_object_iface_init (MMLogObjectInterface *iface);
static void bind_iface_init (MMBindInterface *iface);
G_DEFINE_TYPE_EXTENDED (MMBaseSim, mm_base_sim, MM_GDBUS_TYPE_SIM_SKELETON, 0,
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, async_initable_iface_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_BIND, bind_iface_init))
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
enum {
PROP_0,
PROP_PATH,
PROP_CONNECTION,
PROP_BIND_TO,
PROP_MODEM,
PROP_SLOT_NUMBER,
PROP_LAST
@@ -67,13 +63,6 @@ struct _MMBaseSimPrivate {
GDBusConnection *connection;
guint dbus_id;
/* The authorization provider */
MMAuthProvider *authp;
GCancellable *authp_cancellable;
/* The object this SIM is bound to */
GObject *bind_to;
/* The modem which owns this SIM */
MMBaseModem *modem;
/* The path where the SIM object is exported */
@@ -249,25 +238,18 @@ handle_change_pin_ready (MMBaseSim *self,
}
static void
handle_change_pin_auth_ready (MMAuthProvider *authp,
handle_change_pin_auth_ready (MMBaseModem *modem,
GAsyncResult *res,
HandleChangePinContext *ctx)
{
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_change_pin_context_free (ctx);
return;
}
if (!mm_utils_is_numeric (ctx->old_pin) || !mm_utils_is_numeric (ctx->new_pin)) {
mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"PIN must be numeric");
handle_change_pin_context_free (ctx);
return;
}
/* If changing PIN is not implemented, report an error */
if (!MM_BASE_SIM_GET_CLASS (ctx->self)->change_pin ||
!MM_BASE_SIM_GET_CLASS (ctx->self)->change_pin_finish) {
@@ -314,12 +296,11 @@ handle_change_pin (MMBaseSim *self,
ctx->old_pin = g_strdup (old_pin);
ctx->new_pin = g_strdup (new_pin);
mm_auth_provider_authorize (self->priv->authp,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
self->priv->authp_cancellable,
(GAsyncReadyCallback)handle_change_pin_auth_ready,
ctx);
mm_base_modem_authorize (self->priv->modem,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_change_pin_auth_ready,
ctx);
return TRUE;
}
@@ -440,25 +421,18 @@ handle_enable_pin_ready (MMBaseSim *self,
}
static void
handle_enable_pin_auth_ready (MMAuthProvider *authp,
handle_enable_pin_auth_ready (MMBaseModem *modem,
GAsyncResult *res,
HandleEnablePinContext *ctx)
{
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_enable_pin_context_free (ctx);
return;
}
if (!mm_utils_is_numeric (ctx->pin)) {
mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"PIN must be numeric");
handle_enable_pin_context_free (ctx);
return;
}
/* If changing PIN is not implemented, report an error */
if (!MM_BASE_SIM_GET_CLASS (ctx->self)->enable_pin ||
!MM_BASE_SIM_GET_CLASS (ctx->self)->enable_pin_finish) {
@@ -504,12 +478,11 @@ handle_enable_pin (MMBaseSim *self,
ctx->pin = g_strdup (pin);
ctx->enabled = enabled;
mm_auth_provider_authorize (self->priv->authp,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
self->priv->authp_cancellable,
(GAsyncReadyCallback)handle_enable_pin_auth_ready,
ctx);
mm_base_modem_authorize (self->priv->modem,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_enable_pin_auth_ready,
ctx);
return TRUE;
}
@@ -871,25 +844,18 @@ handle_send_pin_ready (MMBaseSim *self,
}
static void
handle_send_pin_auth_ready (MMAuthProvider *authp,
handle_send_pin_auth_ready (MMBaseModem *modem,
GAsyncResult *res,
HandleSendPinContext *ctx)
{
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_pin_context_free (ctx);
return;
}
if (!mm_utils_is_numeric (ctx->pin)) {
mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"PIN must be numeric");
handle_send_pin_context_free (ctx);
return;
}
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
"Cannot send PIN: SIM not currently active");
@@ -923,12 +889,11 @@ handle_send_pin (MMBaseSim *self,
ctx->invocation = g_object_ref (invocation);
ctx->pin = g_strdup (pin);
mm_auth_provider_authorize (self->priv->authp,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
self->priv->authp_cancellable,
(GAsyncReadyCallback)handle_send_pin_auth_ready,
ctx);
mm_base_modem_authorize (self->priv->modem,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_send_pin_auth_ready,
ctx);
return TRUE;
}
@@ -983,25 +948,18 @@ handle_send_puk_ready (MMBaseSim *self,
}
static void
handle_send_puk_auth_ready (MMAuthProvider *authp,
handle_send_puk_auth_ready (MMBaseModem *modem,
GAsyncResult *res,
HandleSendPukContext *ctx)
{
GError *error = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_send_puk_context_free (ctx);
return;
}
if (!mm_utils_is_numeric (ctx->puk) || !mm_utils_is_numeric (ctx->new_pin)) {
mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"PIN/PUK must be numeric");
handle_send_puk_context_free (ctx);
return;
}
if (!mm_gdbus_sim_get_active (MM_GDBUS_SIM (ctx->self))) {
mm_dbus_method_invocation_return_error_literal (ctx->invocation, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED,
"Cannot send PUK: SIM not currently active");
@@ -1038,12 +996,11 @@ handle_send_puk (MMBaseSim *self,
ctx->puk = g_strdup (puk);
ctx->new_pin = g_strdup (new_pin);
mm_auth_provider_authorize (self->priv->authp,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
self->priv->authp_cancellable,
(GAsyncReadyCallback)handle_send_puk_auth_ready,
ctx);
mm_base_modem_authorize (self->priv->modem,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_send_puk_auth_ready,
ctx);
return TRUE;
}
@@ -1546,36 +1503,14 @@ handle_set_preferred_networks_ready (MMBaseSim *self,
handle_set_preferred_networks_context_free (ctx);
}
static gboolean
validate_networks_list (GList *networks_list,
GError **error)
{
GList *l;
for (l = networks_list; l; l = g_list_next (l)) {
MMSimPreferredNetwork *network = (MMSimPreferredNetwork *)l->data;
const gchar *operator_code;
operator_code = mm_sim_preferred_network_get_operator_code (network);
if (!mm_utils_is_numeric (operator_code)) {
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_INVALID_ARGS,
"Invalid operator code: '%s'", operator_code);
return FALSE;
}
}
return TRUE;
}
static void
handle_set_preferred_networks_auth_ready (MMAuthProvider *authp,
handle_set_preferred_networks_auth_ready (MMBaseModem *modem,
GAsyncResult *res,
HandleSetPreferredNetworksContext *ctx)
{
GError *error = NULL;
GList *networks_list = NULL;
if (!mm_auth_provider_authorize_finish (authp, res, &error)) {
if (!mm_base_modem_authorize_finish (modem, res, &error)) {
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_preferred_networks_context_free (ctx);
return;
@@ -1603,22 +1538,12 @@ handle_set_preferred_networks_auth_ready (MMAuthProvider *authp,
return;
}
networks_list = mm_sim_preferred_network_list_new_from_variant (ctx->networks);
if (!validate_networks_list (networks_list, &error)) {
g_list_free_full (networks_list, g_object_unref);
mm_dbus_method_invocation_take_error (ctx->invocation, error);
handle_set_preferred_networks_context_free (ctx);
return;
}
mm_obj_info (ctx->self, "processing user request to set preferred networks...");
MM_BASE_SIM_GET_CLASS (ctx->self)->set_preferred_networks (
ctx->self,
networks_list,
mm_sim_preferred_network_list_new_from_variant (ctx->networks),
(GAsyncReadyCallback)handle_set_preferred_networks_ready,
ctx);
g_list_free_full (networks_list, g_object_unref);
}
static gboolean
@@ -1633,12 +1558,11 @@ handle_set_preferred_networks (MMBaseSim *self,
ctx->invocation = g_object_ref (invocation);
ctx->networks = g_variant_ref (networks_variant);
mm_auth_provider_authorize (self->priv->authp,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
self->priv->authp_cancellable,
(GAsyncReadyCallback)handle_set_preferred_networks_auth_ready,
ctx);
mm_base_modem_authorize (self->priv->modem,
invocation,
MM_AUTHORIZATION_DEVICE_CONTROL,
(GAsyncReadyCallback)handle_set_preferred_networks_auth_ready,
ctx);
return TRUE;
}
@@ -2362,7 +2286,6 @@ load_gid2 (MMBaseSim *self,
MMBaseSim *
mm_base_sim_new_initialized (MMBaseModem *modem,
GObject *bind_to,
guint slot_number,
gboolean active,
const gchar *sim_identifier,
@@ -2376,7 +2299,6 @@ mm_base_sim_new_initialized (MMBaseModem *modem,
sim = MM_BASE_SIM (g_object_new (MM_TYPE_BASE_SIM,
MM_BASE_SIM_MODEM, modem,
MM_BIND_TO, bind_to,
MM_BASE_SIM_SLOT_NUMBER, slot_number,
"active", active,
"sim-identifier", sim_identifier,
@@ -2966,7 +2888,6 @@ initable_init_async (GAsyncInitable *initable,
void
mm_base_sim_new (MMBaseModem *modem,
GObject *bind_to,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -2977,7 +2898,6 @@ mm_base_sim_new (MMBaseModem *modem,
callback,
user_data,
MM_BASE_SIM_MODEM, modem,
MM_BIND_TO, bind_to,
"active", TRUE, /* by default always active */
NULL);
}
@@ -3043,14 +2963,18 @@ set_property (GObject *object,
else if (self->priv->path)
sim_dbus_export (self);
break;
case PROP_BIND_TO:
g_clear_object (&self->priv->bind_to);
self->priv->bind_to = g_value_dup_object (value);
mm_bind_to (MM_BIND (self), MM_BASE_SIM_CONNECTION, self->priv->bind_to);
break;
case PROP_MODEM:
g_clear_object (&self->priv->modem);
self->priv->modem = g_value_dup_object (value);
if (self->priv->modem) {
/* Set owner ID */
mm_log_object_set_owner_id (MM_LOG_OBJECT (self), mm_log_object_get_id (MM_LOG_OBJECT (self->priv->modem)));
/* Bind the modem's connection (which is set when it is exported,
* and unset when unexported) to the SIM's connection */
g_object_bind_property (self->priv->modem, MM_BASE_MODEM_CONNECTION,
self, MM_BASE_SIM_CONNECTION,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
}
break;
case PROP_SLOT_NUMBER:
self->priv->slot_number = g_value_get_uint (value);
@@ -3076,9 +3000,6 @@ get_property (GObject *object,
case PROP_CONNECTION:
g_value_set_object (value, self->priv->connection);
break;
case PROP_BIND_TO:
g_value_set_object (value, self->priv->bind_to);
break;
case PROP_MODEM:
g_value_set_object (value, self->priv->modem);
break;
@@ -3101,10 +3022,6 @@ mm_base_sim_init (MMBaseSim *self)
/* Each SIM is given a unique id to build its own DBus path */
self->priv->dbus_id = id++;
/* Setup authorization provider */
self->priv->authp = mm_auth_provider_get ();
self->priv->authp_cancellable = g_cancellable_new ();
}
static void
@@ -3130,9 +3047,6 @@ dispose (GObject *object)
}
g_clear_object (&self->priv->modem);
g_clear_object (&self->priv->bind_to);
g_cancellable_cancel (self->priv->authp_cancellable);
g_clear_object (&self->priv->authp_cancellable);
G_OBJECT_CLASS (mm_base_sim_parent_class)->dispose (object);
}
@@ -3150,11 +3064,6 @@ log_object_iface_init (MMLogObjectInterface *iface)
iface->build_id = log_object_build_id;
}
static void
bind_iface_init (MMBindInterface *iface)
{
}
static void
mm_base_sim_class_init (MMBaseSimClass *klass)
{
@@ -3219,8 +3128,6 @@ mm_base_sim_class_init (MMBaseSimClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]);
g_object_class_override_property (object_class, PROP_BIND_TO, MM_BIND_TO);
properties[PROP_SLOT_NUMBER] =
g_param_spec_uint (MM_BASE_SIM_SLOT_NUMBER,
"Slot number",
-2
View File
@@ -213,7 +213,6 @@ GType mm_base_sim_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMBaseSim, g_object_unref)
void mm_base_sim_new (MMBaseModem *modem,
GObject *bind_to,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);
@@ -229,7 +228,6 @@ gboolean mm_base_sim_initialize_finish (MMBaseSim *self,
GError **error);
MMBaseSim *mm_base_sim_new_initialized (MMBaseModem *modem,
GObject *bind_to,
guint slot_number,
gboolean active,
const gchar *sim_identifier,
+899 -237
View File
File diff suppressed because it is too large Load Diff
+19 -30
View File
@@ -25,6 +25,7 @@
#include <libmm-glib.h>
#include "mm-sms-part.h"
#include "mm-base-modem.h"
/*****************************************************************************/
@@ -45,19 +46,12 @@ typedef struct _MMBaseSms MMBaseSms;
typedef struct _MMBaseSmsClass MMBaseSmsClass;
typedef struct _MMBaseSmsPrivate MMBaseSmsPrivate;
/* Properties */
#define MM_BASE_SMS_PATH "sms-path"
#define MM_BASE_SMS_CONNECTION "sms-connection"
#define MM_BASE_SMS_MODEM "sms-modem"
#define MM_BASE_SMS_IS_MULTIPART "sms-is-multipart"
#define MM_BASE_SMS_MAX_PARTS "sms-max-parts"
#define MM_BASE_SMS_MULTIPART_REFERENCE "sms-multipart-reference"
#define MM_BASE_SMS_IS_3GPP "sms-is-3gpp"
#define MM_BASE_SMS_DEFAULT_STORAGE "sms-default-storage"
#define MM_BASE_SMS_SUPPORTED_STORAGES "sms-supported-storages"
#define MM_BASE_SMS_CONNECTION_PARENT_PROPERTY_NAME "sms-connection-parent-property-name"
/* Signals */
#define MM_BASE_SMS_SET_LOCAL_MULTIPART_REFERENCE "sms-set-local-multipart-reference"
struct _MMBaseSms {
MmGdbusSmsSkeleton parent;
@@ -91,31 +85,28 @@ struct _MMBaseSmsClass {
gboolean (* delete_finish) (MMBaseSms *self,
GAsyncResult *res,
GError **error);
/* Signal */
void (*set_local_multipart_reference) (MMBaseSms *self,
const gchar *number);
};
GType mm_base_sms_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMBaseSms, g_object_unref)
gboolean mm_base_sms_init_from_properties (MMBaseSms *self,
MMSmsProperties *properties,
GError **error);
gboolean mm_base_sms_singlepart_init (MMBaseSms *self,
MMSmsState state,
MMSmsStorage storage,
MMSmsPart *part,
GError **error);
gboolean mm_base_sms_multipart_init (MMBaseSms *self,
MMSmsState state,
MMSmsStorage storage,
guint reference,
guint max_parts,
MMSmsPart *first_part,
GError **error);
/* This one can be overridden by plugins */
MMBaseSms *mm_base_sms_new (MMBaseModem *modem);
MMBaseSms *mm_base_sms_new_from_properties (MMBaseModem *modem,
MMSmsProperties *properties,
GError **error);
MMBaseSms *mm_base_sms_singlepart_new (MMBaseModem *modem,
MMSmsState state,
MMSmsStorage storage,
MMSmsPart *part,
GError **error);
MMBaseSms *mm_base_sms_multipart_new (MMBaseModem *modem,
MMSmsState state,
MMSmsStorage storage,
guint reference,
guint max_parts,
MMSmsPart *first_part,
GError **error);
gboolean mm_base_sms_multipart_take_part (MMBaseSms *self,
MMSmsPart *part,
GError **error);
@@ -132,8 +123,6 @@ GList *mm_base_sms_get_parts (MMBaseSms *self);
gboolean mm_base_sms_is_multipart (MMBaseSms *self);
guint mm_base_sms_get_max_parts (MMBaseSms *self);
guint mm_base_sms_get_multipart_reference (MMBaseSms *self);
void mm_base_sms_set_multipart_reference (MMBaseSms *self,
guint reference);
gboolean mm_base_sms_multipart_is_complete (MMBaseSms *self);
gboolean mm_base_sms_multipart_is_assembled (MMBaseSms *self);
+4 -14
View File
@@ -33,7 +33,6 @@
#include "mm-bearer-mbim.h"
#include "mm-log-object.h"
#include "mm-context.h"
#include "mm-bind.h"
G_DEFINE_TYPE (MMBearerMbim, mm_bearer_mbim, MM_TYPE_BASE_BEARER)
@@ -641,10 +640,9 @@ ip_configuration_async_cleanup (GTask *task)
ctx = g_task_get_task_data (task);
if (ctx->async_slaac_cancellation_id) {
g_cancellable_disconnect (g_task_get_cancellable (task), ctx->async_slaac_cancellation_id);
ctx->async_slaac_cancellation_id = 0;
}
g_assert (ctx->async_slaac_cancellation_id);
g_cancellable_disconnect (g_task_get_cancellable (task), ctx->async_slaac_cancellation_id);
ctx->async_slaac_cancellation_id = 0;
g_assert (ctx->async_slaac_notification_id);
if (g_signal_handler_is_connected (ctx->mbim, ctx->async_slaac_notification_id))
@@ -668,15 +666,8 @@ ip_configuration_async_timeout (GTask *task)
}
static void
ip_configuration_async_cancelled (GCancellable *cancellable,
GTask *task)
ip_configuration_async_cancelled (GTask *task)
{
ConnectContext *ctx;
/* Avoid the explicit g_cancellable_disconnect(), which would deadlock */
ctx = g_task_get_task_data (task);
ctx->async_slaac_cancellation_id = 0;
ip_configuration_async_cleanup (task);
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_CANCELLED,
"Cancelled waiting for SLAAC notification");
@@ -2029,7 +2020,6 @@ mm_bearer_mbim_new (MMBroadbandModemMbim *modem,
* g_object_new() here */
bearer = g_object_new (MM_TYPE_BEARER_MBIM,
MM_BASE_BEARER_MODEM, modem,
MM_BIND_TO, G_OBJECT (modem),
MM_BASE_BEARER_CONFIG, config,
NULL);
-2
View File
@@ -37,7 +37,6 @@
#include "mm-log-object.h"
#include "mm-modem-helpers.h"
#include "mm-context.h"
#include "mm-bind.h"
G_DEFINE_TYPE (MMBearerQmi, mm_bearer_qmi, MM_TYPE_BASE_BEARER)
@@ -2961,7 +2960,6 @@ mm_bearer_qmi_new (MMBroadbandModemQmi *modem,
* g_object_new() here */
bearer = g_object_new (MM_TYPE_BEARER_QMI,
MM_BASE_BEARER_MODEM, modem,
MM_BIND_TO, G_OBJECT (modem),
MM_BASE_BEARER_CONFIG, config,
NULL);
-62
View File
@@ -1,62 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2025 Dan Williams <dan@ioncontrol.co>
*/
#include "mm-bind.h"
#include "mm-log-object.h"
G_DEFINE_INTERFACE (MMBind, mm_bind, MM_TYPE_LOG_OBJECT)
gboolean
mm_bind_to (MMBind *self, const gchar *local_propname, GObject *other_object)
{
if (other_object) {
/* Set log owner ID */
mm_log_object_set_owner_id (MM_LOG_OBJECT (self),
mm_log_object_get_id (MM_LOG_OBJECT (other_object)));
if (local_propname) {
/* Bind the other object's connection property (which is set when it is
* exported, and unset when unexported) to this object's connection
* property.
*/
g_object_bind_property (other_object,
MM_BINDABLE_CONNECTION,
self,
local_propname,
G_BINDING_DEFAULT | G_BINDING_SYNC_CREATE);
}
}
return !!other_object;
}
static void
mm_bind_default_init (MMBindInterface *iface)
{
static gsize initialized = 0;
if (!g_once_init_enter (&initialized))
return;
/* Properties */
g_object_interface_install_property (
iface,
g_param_spec_object (MM_BIND_TO,
"Bind to",
"Bind to this object",
G_TYPE_OBJECT,
G_PARAM_READWRITE));
g_once_init_leave (&initialized, 1);
}
-42
View File
@@ -1,42 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2025 Dan Williams <dan@ioncontrol.co>
*/
#ifndef MM_CHILD_H
#define MM_CHILD_H
#include <glib.h>
#include <glib-object.h>
/* Properties */
#define MM_BIND_TO "bind-to"
/* Property name used by an object that wants to allow others
* to bind its connection property.
*/
#define MM_BINDABLE_CONNECTION "bind-connection"
#define MM_TYPE_BIND mm_bind_get_type ()
G_DECLARE_INTERFACE (MMBind, mm_bind, MM, BIND, MMBind)
struct _MMBindInterface
{
GTypeInterface g_iface;
};
gboolean mm_bind_to (MMBind *self,
const gchar *local_propname,
GObject *other_object);
#endif /* MM_LOG_OBJECT_H */
+1 -9
View File
@@ -37,7 +37,6 @@
#include "mm-modem-helpers.h"
#include "mm-port-enums-types.h"
#include "mm-helper-enums-types.h"
#include "mm-bind.h"
static void async_initable_iface_init (GAsyncInitableIface *iface);
@@ -635,13 +634,7 @@ select_profile_3gpp_get_profile_ready (MMIfaceModem3gppProfileManager *modem,
profile = mm_iface_modem_3gpp_profile_manager_get_profile_finish (modem, res, &error);
if (!profile)
g_task_return_error (task, error);
else if (!mm_3gpp_profile_get_enabled (profile)) {
g_task_return_new_error (task,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Profile '%d' is internally disabled",
ctx->profile_id);
} else
else
g_task_return_int (task, ctx->profile_id);
g_object_unref (task);
}
@@ -1967,7 +1960,6 @@ mm_broadband_bearer_new (MMBroadbandModem *modem,
callback,
user_data,
MM_BASE_BEARER_MODEM, modem,
MM_BIND_TO, G_OBJECT (modem),
MM_BASE_BEARER_CONFIG, bearer_properties,
MM_BROADBAND_BEARER_FLOW_CONTROL, flow_control,
NULL);
+42 -76
View File
@@ -153,7 +153,6 @@ struct _MMBroadbandModemMbimPrivate {
gboolean is_ms_sar_supported;
gboolean is_google_carrier_lock_supported;
gboolean is_ms_device_reset_supported;
gboolean is_qdu_supported;
/* Process unsolicited notifications */
gulong notification_id;
@@ -191,6 +190,7 @@ struct _MMBroadbandModemMbimPrivate {
/* Multi-SIM support */
guint32 executor_index;
guint active_slot_index;
gboolean pending_sim_slot_switch_action;
MMUnlockRetries *unlock_retries;
};
@@ -344,7 +344,7 @@ peek_port_mbim_for_data (MMBroadbandModemMbim *self,
g_assert (mm_port_get_subsys (data) == MM_PORT_SUBSYS_NET);
net_port_driver = mm_kernel_device_get_driver (mm_port_peek_kernel_device (data));
if (g_strcmp0 (net_port_driver, "cdc_mbim") && g_strcmp0 (net_port_driver, "mhi-pci-generic")) {
if (g_strcmp0 (net_port_driver, "cdc_mbim") != 0 && g_strcmp0 (net_port_driver, "mhi_net")) {
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
@@ -354,7 +354,7 @@ peek_port_mbim_for_data (MMBroadbandModemMbim *self,
return NULL;
}
if (!g_strcmp0 (net_port_driver, "mhi-pci-generic"))
if (!g_strcmp0 (net_port_driver, "mhi_net"))
return mm_broadband_modem_mbim_peek_port_mbim (self);
net_port_parent_path = mm_kernel_device_get_interface_sysfs_path (mm_port_peek_kernel_device (data));
@@ -519,7 +519,7 @@ device_caps_query_ready (MbimDevice *device,
GError *error = NULL;
LoadCurrentCapabilitiesContext *ctx;
MbimDataClass caps_data_class = MBIM_DATA_CLASS_NONE;
g_autofree gchar *caps_custom_data_class_str = NULL;
g_autofree gchar *caps_custom_data_class_str;
self = g_task_get_source_object (task);
ctx = g_task_get_task_data (task);
@@ -3537,12 +3537,6 @@ query_device_services_ready (MbimDevice *device,
continue;
}
if (service == MBIM_SERVICE_QDU) {
mm_obj_dbg (self, "Qualcomm Device Upgrade method mbim-qdu supported");
self->priv->is_qdu_supported = TRUE;
continue;
}
/* no optional features to check in remaining services */
}
mbim_device_service_element_array_free (device_services);
@@ -5510,7 +5504,7 @@ basic_connect_notification_subscriber_ready_status (MMBroadbandModemMbim *self,
g_autoptr(GError) error = NULL;
gboolean active_sim_event = FALSE;
if (mm_iface_modem_is_primary_sim_slot_switch_ongoing (MM_IFACE_MODEM (self))) {
if (self->priv->pending_sim_slot_switch_action) {
mm_obj_dbg (self, "ignoring slot status change");
return;
}
@@ -6215,7 +6209,7 @@ ms_basic_connect_extensions_notification_slot_info_status (MMBroadbandModemMbim
return;
}
if (mm_iface_modem_is_primary_sim_slot_switch_ongoing (MM_IFACE_MODEM (self))) {
if (self->priv->pending_sim_slot_switch_action) {
mm_obj_dbg (self, "ignoring slot status change in SIM slot %d: %s", slot_index + 1, mbim_uicc_slot_state_get_string (slot_state));
return;
}
@@ -9045,33 +9039,24 @@ add_sms_part (MMBroadbandModemMbim *self,
self,
FALSE,
&error);
if (!part) {
if (part) {
mm_obj_dbg (self, "correctly parsed PDU (%d)", pdu->message_index);
if (expected_index != SMS_PART_INVALID_INDEX && (expected_index != mm_sms_part_get_index (part))) {
/* Some Fibocom L850 modems report an invalid part index (always 1) in the response
* message. Because we know which message part was requested, we can use that value
* instead to workaround this bug. */
mm_obj_dbg (self, "Expected SMS part index '%u' but device reports index '%u': using the expected one",
expected_index, mm_sms_part_get_index (part));
mm_sms_part_set_index (part, expected_index);
}
mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
part,
mm_sms_state_from_mbim_message_status (pdu->message_status),
MM_SMS_STORAGE_MT);
} else {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error parsing PDU (%d): %s",
pdu->message_index, error->message);
return;
}
mm_obj_dbg (self, "correctly parsed PDU (%d)", pdu->message_index);
if (expected_index != SMS_PART_INVALID_INDEX && (expected_index != mm_sms_part_get_index (part))) {
/* Some Fibocom L850 modems report an invalid part index (always 1) in the response
* message. Because we know which message part was requested, we can use that value
* instead to workaround this bug. */
mm_obj_dbg (self, "Expected SMS part index '%u' but device reports index '%u': using the expected one",
expected_index, mm_sms_part_get_index (part));
mm_sms_part_set_index (part, expected_index);
}
if (!mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
mm_broadband_modem_create_sms (MM_BROADBAND_MODEM (self)),
part,
mm_sms_state_from_mbim_message_status (pdu->message_status),
MM_SMS_STORAGE_MT,
&error)) {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error adding SMS (%d): %s",
pdu->message_index, error->message);
return;
}
}
@@ -9267,14 +9252,9 @@ enable_unsolicited_events_messaging (MMIfaceModemMessaging *_self,
/* Create SMS (Messaging interface) */
static MMBaseSms *
messaging_create_sms (MMBroadbandModem *self)
messaging_create_sms (MMIfaceModemMessaging *self)
{
MMSmsStorage default_storage;
default_storage = mm_iface_modem_messaging_get_default_storage (MM_IFACE_MODEM_MESSAGING (self));
return mm_sms_mbim_new (MM_BASE_MODEM (self),
mm_iface_modem_is_3gpp (MM_IFACE_MODEM (self)),
default_storage);
return mm_sms_mbim_new (MM_BASE_MODEM (self));
}
/*****************************************************************************/
@@ -10008,6 +9988,8 @@ set_device_slot_mappings_ready (MbimDevice *device,
self = g_task_get_source_object (task);
g_assert (self->priv->pending_sim_slot_switch_action);
/* the slot index in MM starts at 1 */
slot_number = GPOINTER_TO_UINT (g_task_get_task_data (task)) - 1;
@@ -10018,6 +10000,7 @@ set_device_slot_mappings_ready (MbimDevice *device,
&map_count,
&slot_mappings,
&error)) {
self->priv->pending_sim_slot_switch_action = FALSE;
g_task_return_error (task, error);
g_object_unref (task);
return;
@@ -10026,9 +10009,13 @@ set_device_slot_mappings_ready (MbimDevice *device,
for (i = 0; i < map_count; i++) {
if (i == self->priv->executor_index) {
if (slot_number != slot_mappings[i]->slot) {
self->priv->pending_sim_slot_switch_action = FALSE;
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
"SIM slot switch to '%u' failed", slot_number);
} else {
/* Keep pending_sim_slot_switch_action flag TRUE to cleanly ignore SIM related indications
* during slot switching, We don't want SIM related indications received trigger the update
* of SimSlots property, which may not be what we want as the modem object is being shutdown */
self->priv->active_slot_index = slot_number + 1;
g_task_return_boolean (task, TRUE);
}
@@ -10038,6 +10025,7 @@ set_device_slot_mappings_ready (MbimDevice *device,
}
}
self->priv->pending_sim_slot_switch_action = FALSE;
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_NOT_FOUND,
"Can't find executor index '%u'", self->priv->executor_index);
g_object_unref (task);
@@ -10089,6 +10077,16 @@ before_set_query_device_slot_mappings_ready (MbimDevice *device,
}
}
/* Flag a pending SIM slot switch operation, so that we can ignore slot state updates
* during the process. */
if (self->priv->pending_sim_slot_switch_action) {
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_IN_PROGRESS,
"there is already an ongoing SIM slot switch operation");
g_object_unref (task);
return;
}
self->priv->pending_sim_slot_switch_action = TRUE;
for (i = 0; i < map_count; i++) {
if (i == self->priv->executor_index)
slot_mappings[i]->slot = slot_number;
@@ -10368,43 +10366,11 @@ modem_firmware_load_update_settings_finish (MMIfaceModemFirmware *self,
return mm_iface_modem_firmware_load_update_settings_in_port_finish (self, res, error);
}
static gboolean
modem_is_qdu_supported (MMBaseModem *modem,
MMKernelDevice *kernel_device)
{
return mm_kernel_device_get_global_property_as_boolean (kernel_device, "ID_MM_MBIM_QDU");
}
static void
modem_firmware_load_update_settings (MMIfaceModemFirmware *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
MMPortMbim *mbim_port;
MMKernelDevice *kernel_device;
MMModemFirmwareUpdateMethod update_methods;
g_autoptr(MMFirmwareUpdateSettings) update_settings = NULL;
/* Check first if 'mbim-qdu' is supported and selected via udev. If the
* update method 'mbim-qdu' is not supported and not selected via udev,
* then the generic update method 'firehose/sahara' are checked.
*/
update_methods = MM_MODEM_FIRMWARE_UPDATE_METHOD_NONE;
mbim_port = mm_broadband_modem_mbim_peek_port_mbim (MM_BROADBAND_MODEM_MBIM (self));
if (mbim_port) {
kernel_device = mm_port_peek_kernel_device (MM_PORT (mbim_port));
if ((MM_BROADBAND_MODEM_MBIM (self)->priv->is_qdu_supported) &&
modem_is_qdu_supported (MM_BASE_MODEM (self), kernel_device)) {
task = g_task_new (self, NULL, callback, user_data);
update_settings = mm_firmware_update_settings_new (update_methods);
mm_firmware_update_settings_set_method (update_settings, MM_MODEM_FIRMWARE_UPDATE_METHOD_MBIM_QDU);
g_task_return_pointer (task, g_object_ref (update_settings), (GDestroyNotify) g_object_unref);
g_object_unref (task);
return;
}
}
mm_iface_modem_firmware_load_update_settings_in_port (
self,
MM_PORT (mm_broadband_modem_mbim_peek_port_mbim (MM_BROADBAND_MODEM_MBIM (self))),
@@ -10771,6 +10737,7 @@ iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface)
iface->enable_unsolicited_events_finish = common_enable_disable_unsolicited_events_messaging_finish;
iface->disable_unsolicited_events = disable_unsolicited_events_messaging;
iface->disable_unsolicited_events_finish = common_enable_disable_unsolicited_events_messaging_finish;
iface->create_sms = messaging_create_sms;
}
static void
@@ -10840,7 +10807,6 @@ mm_broadband_modem_mbim_class_init (MMBroadbandModemMbimClass *klass)
/* Do not initialize the MBIM modem through AT commands */
broadband_modem_class->enabling_modem_init = NULL;
broadband_modem_class->enabling_modem_init_finish = NULL;
broadband_modem_class->create_sms = messaging_create_sms;
#if defined WITH_QMI && QMI_MBIM_QMUX_SUPPORTED
g_object_class_install_property (object_class, PROP_QMI_UNSUPPORTED,
File diff suppressed because it is too large Load Diff
+215 -233
View File
@@ -28,7 +28,6 @@
#include <ModemManager.h>
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
#include <ModemManager-tags.h>
#include "mm-base-modem-at.h"
#include "mm-broadband-modem.h"
@@ -51,10 +50,8 @@
#include "mm-bearer-list.h"
#include "mm-cbm-list.h"
#include "mm-cbm-part.h"
#include "mm-call-at.h"
#include "mm-sms-list.h"
#include "mm-sms-part-3gpp.h"
#include "mm-sms-at.h"
#include "mm-call-list.h"
#include "mm-base-sim.h"
#include "mm-log-object.h"
@@ -66,7 +63,6 @@
#include "libqcdm/src/logs.h"
#include "libqcdm/src/log-items.h"
#include "mm-helper-enums-types.h"
#include "mm-bind.h"
static void iface_modem_init (MMIfaceModemInterface *iface);
static void iface_modem_3gpp_init (MMIfaceModem3gppInterface *iface);
@@ -204,8 +200,6 @@ struct _MMBroadbandModemPrivate {
MM3gppCmerMode modem_cmer_disable_mode;
MM3gppCmerInd modem_cmer_ind;
gboolean modem_cgerep_support_checked;
MM3gppCgerepMode modem_cgerep_enable_mode;
MM3gppCgerepMode modem_cgerep_disable_mode;
gboolean modem_cgerep_supported;
MMFlowControl flow_control;
@@ -218,7 +212,7 @@ struct _MMBroadbandModemPrivate {
gboolean modem_3gpp_eps_network_supported;
gboolean modem_3gpp_5gs_network_supported;
/* Implementation helpers */
GRegex *modem_3gpp_registration_regex;
GPtrArray *modem_3gpp_registration_regex;
MMModem3gppFacility modem_3gpp_ignored_facility_locks;
MMBaseBearer *modem_3gpp_initial_eps_bearer;
MMModem3gppPacketServiceState modem_3gpp_packet_service_state;
@@ -510,7 +504,6 @@ modem_create_sim (MMIfaceModem *self,
{
/* New generic SIM */
mm_base_sim_new (MM_BASE_MODEM (self),
G_OBJECT (self),
NULL, /* cancellable */
callback,
user_data);
@@ -1507,6 +1500,32 @@ modem_load_own_numbers (MMIfaceModem *self,
/*****************************************************************************/
/* Check if unlock required (Modem interface) */
typedef struct {
const gchar *result;
MMModemLock code;
} CPinResult;
static CPinResult unlock_results[] = {
/* Longer entries first so we catch the correct one with strcmp() */
{ "READY", MM_MODEM_LOCK_NONE },
{ "SIM PIN2", MM_MODEM_LOCK_SIM_PIN2 },
{ "SIM PUK2", MM_MODEM_LOCK_SIM_PUK2 },
{ "SIM PIN", MM_MODEM_LOCK_SIM_PIN },
{ "SIM PUK", MM_MODEM_LOCK_SIM_PUK },
{ "PH-NETSUB PIN", MM_MODEM_LOCK_PH_NETSUB_PIN },
{ "PH-NETSUB PUK", MM_MODEM_LOCK_PH_NETSUB_PUK },
{ "PH-FSIM PIN", MM_MODEM_LOCK_PH_FSIM_PIN },
{ "PH-FSIM PUK", MM_MODEM_LOCK_PH_FSIM_PUK },
{ "PH-CORP PIN", MM_MODEM_LOCK_PH_CORP_PIN },
{ "PH-CORP PUK", MM_MODEM_LOCK_PH_CORP_PUK },
{ "PH-SIM PIN", MM_MODEM_LOCK_PH_SIM_PIN },
{ "PH-NET PIN", MM_MODEM_LOCK_PH_NET_PIN },
{ "PH-NET PUK", MM_MODEM_LOCK_PH_NET_PUK },
{ "PH-SP PIN", MM_MODEM_LOCK_PH_SP_PIN },
{ "PH-SP PUK", MM_MODEM_LOCK_PH_SP_PUK },
{ NULL }
};
static MMModemLock
modem_load_unlock_required_finish (MMIfaceModem *self,
GAsyncResult *res,
@@ -1529,19 +1548,42 @@ cpin_query_ready (MMIfaceModem *self,
GTask *task)
{
MMModemLock lock = MM_MODEM_LOCK_UNKNOWN;
MMModemLock lock = MM_MODEM_LOCK_UNKNOWN;
const gchar *result;
GError *error = NULL;
GError *error = NULL;
result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
if (error) {
g_task_return_error (task, error);
} else {
if (result)
lock = mm_parse_cpin_response (result, TRUE);
g_task_return_int (task, lock);
g_object_unref (task);
return;
}
if (result &&
strstr (result, "+CPIN:")) {
CPinResult *iter = &unlock_results[0];
const gchar *str;
str = strstr (result, "+CPIN:") + 6;
/* Skip possible whitespaces after '+CPIN:' and before the response */
while (*str == ' ')
str++;
/* Some phones (Motorola EZX models) seem to quote the response */
if (str[0] == '"')
str++;
/* Translate the reply */
while (iter->result) {
if (g_str_has_prefix (str, iter->result)) {
lock = iter->code;
break;
}
iter++;
}
}
g_task_return_int (task, lock);
g_object_unref (task);
}
@@ -3682,33 +3724,20 @@ cgerep_format_check_ready (MMBroadbandModem *self,
GAsyncResult *res,
GTask *task)
{
MM3gppCgerepMode supported_modes = MM_3GPP_CGEREP_MODE_NONE;
GError *error = NULL;
const gchar *result;
gchar *aux;
GError *error = NULL;
const gchar *result;
result = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
if (error || !mm_3gpp_parse_cgerep_test_response (result, self, &supported_modes, &error)) {
if (!result) {
mm_obj_dbg (self, "+CGEREP check failed: %s", error->message);
mm_obj_dbg (self, "packet domain event reporting is unsupported");
g_error_free (error);
goto out;
}
aux = mm_3gpp_cgerep_mode_build_string_from_mask (supported_modes);
mm_obj_dbg (self, "supported +CGEREP modes: %s", aux);
g_free (aux);
mm_obj_dbg (self, "packet domain event reporting is supported");
self->priv->modem_cgerep_supported = TRUE;
if (supported_modes & MM_3GPP_CGEREP_MODE_BUFFER_URCS_IF_LINK_RESERVED)
self->priv->modem_cgerep_enable_mode = MM_3GPP_CGEREP_MODE_BUFFER_URCS_IF_LINK_RESERVED;
else if (supported_modes & MM_3GPP_CGEREP_MODE_DISCARD_URCS_IF_LINK_RESERVED)
self->priv->modem_cgerep_enable_mode = MM_3GPP_CGEREP_MODE_DISCARD_URCS_IF_LINK_RESERVED;
if (supported_modes & MM_3GPP_CGEREP_MODE_DISCARD_URCS)
self->priv->modem_cgerep_disable_mode = MM_3GPP_CGEREP_MODE_DISCARD_URCS;
out:
/* go on with remaining checks */
check_and_setup_3gpp_urc_support (task);
@@ -4049,7 +4078,7 @@ modem_3gpp_enable_unsolicited_events (MMIfaceModem3gpp *_self,
ctx->cmer_command = mm_3gpp_build_cmer_set_request (self->priv->modem_cmer_enable_mode, self->priv->modem_cmer_ind);
if (self->priv->modem_cgerep_support_checked && self->priv->modem_cgerep_supported)
ctx->cgerep_command = mm_3gpp_build_cgerep_set_request (self->priv->modem_cgerep_enable_mode);
ctx->cgerep_command = g_strdup ("+CGEREP=2");
run_unsolicited_events_setup (task);
}
@@ -4074,7 +4103,7 @@ modem_3gpp_disable_unsolicited_events (MMIfaceModem3gpp *_self,
ctx->cmer_command = mm_3gpp_build_cmer_set_request (self->priv->modem_cmer_disable_mode, MM_3GPP_CMER_IND_NONE);
if (self->priv->modem_cgerep_support_checked && self->priv->modem_cgerep_supported)
ctx->cgerep_command = mm_3gpp_build_cgerep_set_request (self->priv->modem_cgerep_disable_mode);
ctx->cgerep_command = g_strdup ("+CGEREP=0");
run_unsolicited_events_setup (task);
}
@@ -5267,28 +5296,32 @@ modem_3gpp_setup_unsolicited_registration_events (MMIfaceModem3gpp *self,
gpointer user_data)
{
MMPortSerialAt *ports[2];
g_autoptr(GRegex) regex = NULL;
GPtrArray *array;
guint i;
guint j;
GTask *task;
ports[0] = mm_base_modem_peek_port_primary (MM_BASE_MODEM (self));
ports[1] = mm_base_modem_peek_port_secondary (MM_BASE_MODEM (self));
/* Set up CREG unsolicited message handlers in both ports */
regex = mm_3gpp_creg_regex_get (FALSE);
array = mm_3gpp_creg_regex_get (FALSE);
for (i = 0; i < 2; i++) {
if (!ports[i])
continue;
mm_obj_dbg (self, "setting up 3GPP unsolicited registration messages handlers in %s",
mm_port_get_device (MM_PORT (ports[i])));
mm_port_serial_at_add_unsolicited_msg_handler (
MM_PORT_SERIAL_AT (ports[i]),
regex,
(MMPortSerialAtUnsolicitedMsgFn)registration_state_changed,
self,
NULL);
for (j = 0; j < array->len; j++) {
mm_port_serial_at_add_unsolicited_msg_handler (
MM_PORT_SERIAL_AT (ports[i]),
(GRegex *) g_ptr_array_index (array, j),
(MMPortSerialAtUnsolicitedMsgFn)registration_state_changed,
self,
NULL);
}
}
mm_3gpp_creg_regex_destroy (array);
task = g_task_new (self, NULL, callback, user_data);
g_task_return_boolean (task, TRUE);
@@ -5312,28 +5345,32 @@ modem_3gpp_cleanup_unsolicited_registration_events (MMIfaceModem3gpp *self,
gpointer user_data)
{
MMPortSerialAt *ports[2];
g_autoptr(GRegex) regex = NULL;
GPtrArray *array;
guint i;
guint j;
GTask *task;
ports[0] = mm_base_modem_peek_port_primary (MM_BASE_MODEM (self));
ports[1] = mm_base_modem_peek_port_secondary (MM_BASE_MODEM (self));
/* Set up CREG unsolicited message handlers in both ports */
regex = mm_3gpp_creg_regex_get (FALSE);
array = mm_3gpp_creg_regex_get (FALSE);
for (i = 0; i < 2; i++) {
if (!ports[i])
continue;
mm_obj_dbg (self, "cleaning up unsolicited registration messages handlers in %s",
mm_port_get_device (MM_PORT (ports[i])));
mm_port_serial_at_add_unsolicited_msg_handler (
MM_PORT_SERIAL_AT (ports[i]),
regex,
NULL,
NULL,
NULL);
for (j = 0; j < array->len; j++) {
mm_port_serial_at_add_unsolicited_msg_handler (
MM_PORT_SERIAL_AT (ports[i]),
(GRegex *) g_ptr_array_index (array, j),
NULL,
NULL,
NULL);
}
}
mm_3gpp_creg_regex_destroy (array);
task = g_task_new (self, NULL, callback, user_data);
g_task_return_boolean (task, TRUE);
@@ -5600,6 +5637,7 @@ registration_status_check_ready (MMBroadbandModem *self,
RunRegistrationChecksContext *ctx;
const gchar *response;
GError *error = NULL;
guint i;
gboolean parsed;
gboolean cgreg = FALSE;
gboolean cereg = FALSE;
@@ -5632,10 +5670,18 @@ registration_status_check_ready (MMBroadbandModem *self,
}
/* Try to match the response */
if (!g_regex_match (self->priv->modem_3gpp_registration_regex,
response,
0,
&match_info)) {
for (i = 0;
i < self->priv->modem_3gpp_registration_regex->len;
i++) {
if (g_regex_match ((GRegex *)g_ptr_array_index (self->priv->modem_3gpp_registration_regex, i),
response,
0,
&match_info))
break;
g_clear_pointer (&match_info, g_match_info_free);
}
if (!match_info) {
error = g_error_new (MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Unknown registration status response: '%s'",
@@ -5859,7 +5905,6 @@ modem_3gpp_create_initial_eps_bearer (MMIfaceModem3gpp *self,
* attempt connection through this bearer object. */
bearer = g_object_new (MM_TYPE_BASE_BEARER,
MM_BASE_BEARER_MODEM, MM_BASE_MODEM (self),
MM_BIND_TO, G_OBJECT (self),
MM_BASE_BEARER_CONFIG, config,
"bearer-type", MM_BEARER_TYPE_DEFAULT_ATTACH,
"connected", TRUE,
@@ -6402,7 +6447,6 @@ modem_3gpp_ussd_context_send_unencoded (MMBroadbandModem *self)
{
Modem3gppUssdSendContext *ctx;
gchar *at_command = NULL;
gchar *quoted_command;
g_assert (self->priv->pending_ussd_action);
ctx = g_task_get_task_data (self->priv->pending_ussd_action);
@@ -6410,11 +6454,9 @@ modem_3gpp_ussd_context_send_unencoded (MMBroadbandModem *self)
/* Build AT command with action unencoded */
ctx->unencoded_used = TRUE;
ctx->current_is_unencoded = TRUE;
quoted_command = mm_at_quote_string (ctx->command);
at_command = g_strdup_printf ("+CUSD=1,%s,%d",
quoted_command,
MM_MODEM_GSM_USSD_SCHEME_7BIT);
g_free (quoted_command);
at_command = g_strdup_printf ("+CUSD=1,\"%s\",%d",
ctx->command,
MM_MODEM_GSM_USSD_SCHEME_7BIT);
mm_base_modem_at_command (MM_BASE_MODEM (self),
at_command,
@@ -7140,13 +7182,11 @@ modem_messaging_init_current_storages (MMIfaceModemMessaging *self,
* the default one if needed.
*/
static void
modem_messaging_unlock_storages (MMIfaceModemMessaging *_self,
gboolean mem1,
gboolean mem2)
void
mm_broadband_modem_unlock_sms_storages (MMBroadbandModem *self,
gboolean mem1,
gboolean mem2)
{
MMBroadbandModem *self = MM_BROADBAND_MODEM (_self);
if (mem1) {
g_assert (self->priv->mem1_storage_locked);
self->priv->mem1_storage_locked = FALSE;
@@ -7158,10 +7198,10 @@ modem_messaging_unlock_storages (MMIfaceModemMessaging *_self,
}
}
static gboolean
modem_messaging_lock_storages_finish (MMIfaceModemMessaging *self,
GAsyncResult *res,
GError **error)
gboolean
mm_broadband_modem_lock_sms_storages_finish (MMBroadbandModem *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
@@ -7203,14 +7243,13 @@ lock_storages_cpms_set_ready (MMBaseModem *_self,
g_object_unref (task);
}
static void
modem_messaging_lock_storages (MMIfaceModemMessaging *_self,
MMSmsStorage mem1, /* reading/listing/deleting */
MMSmsStorage mem2, /* storing/sending */
GAsyncReadyCallback callback,
gpointer user_data)
void
mm_broadband_modem_lock_sms_storages (MMBroadbandModem *self,
MMSmsStorage mem1, /* reading/listing/deleting */
MMSmsStorage mem2, /* storing/sending */
GAsyncReadyCallback callback,
gpointer user_data)
{
MMBroadbandModem *self = MM_BROADBAND_MODEM (_self);
LockSmsStoragesContext *ctx;
GTask *task;
gchar *cmd = NULL;
@@ -7225,7 +7264,7 @@ modem_messaging_lock_storages (MMIfaceModemMessaging *_self,
self,
callback,
user_data,
modem_messaging_lock_storages,
mm_broadband_modem_lock_sms_storages,
MM_CORE_ERROR,
MM_CORE_ERROR_RETRY,
"SMS storage currently locked, try again later");
@@ -7499,13 +7538,13 @@ sms_part_ready (MMBroadbandModem *self,
GTask *task)
{
SmsPartContext *ctx;
MMSmsPart *part;
MM3gppPduInfo *info;
const gchar *response;
GError *error = NULL;
MMSmsPart *part;
MM3gppPduInfo *info;
const gchar *response;
GError *error = NULL;
/* Always always always unlock mem1 storage. Warned you've been. */
mm_iface_modem_messaging_unlock_storages (MM_IFACE_MODEM_MESSAGING (self), TRUE, FALSE);
mm_broadband_modem_unlock_sms_storages (self, TRUE, FALSE);
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
if (error) {
@@ -7528,22 +7567,16 @@ sms_part_ready (MMBroadbandModem *self,
}
part = mm_sms_part_3gpp_new_from_pdu (info->index, info->pdu, self, &error);
if (!part) {
if (part) {
mm_obj_dbg (self, "correctly parsed PDU (%d)", ctx->idx);
mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
part,
MM_SMS_STATE_RECEIVED,
self->priv->modem_messaging_sms_default_storage);
} else {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error parsing PDU (%d): %s", ctx->idx, error->message);
g_error_free (error);
} else {
mm_obj_dbg (self, "correctly parsed PDU (%d)", ctx->idx);
if (!mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
mm_broadband_modem_create_sms (MM_BROADBAND_MODEM (self)),
part,
MM_SMS_STATE_RECEIVED,
self->priv->modem_messaging_sms_default_storage,
&error)) {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error adding SMS (%d): %s", ctx->idx, error->message);
g_error_free (error);
}
}
/* All done */
@@ -7553,15 +7586,15 @@ sms_part_ready (MMBroadbandModem *self,
}
static void
indication_lock_storages_ready (MMIfaceModemMessaging *messaging,
GAsyncResult *res,
GTask *task)
indication_lock_storages_ready (MMBroadbandModem *self,
GAsyncResult *res,
GTask *task)
{
SmsPartContext *ctx;
gchar *command;
GError *error = NULL;
if (!mm_iface_modem_messaging_lock_storages_finish (messaging, res, &error)) {
if (!mm_broadband_modem_lock_sms_storages_finish (self, res, &error)) {
/* TODO: we should either make this lock() never fail, by automatically
* retrying after some time, or otherwise retry here. */
g_task_return_error (task, error);
@@ -7574,7 +7607,7 @@ indication_lock_storages_ready (MMIfaceModemMessaging *messaging,
/* Retrieve the message */
ctx = g_task_get_task_data (task);
command = g_strdup_printf ("+CMGR=%d", ctx->idx);
mm_base_modem_at_command (MM_BASE_MODEM (messaging),
mm_base_modem_at_command (MM_BASE_MODEM (self),
command,
10,
FALSE,
@@ -7622,11 +7655,11 @@ cmti_received (MMPortSerialAt *port,
g_task_set_task_data (task, ctx, g_free);
/* First, request to set the proper storage to read from */
mm_iface_modem_messaging_lock_storages (MM_IFACE_MODEM_MESSAGING (self),
storage,
MM_SMS_STORAGE_UNKNOWN,
(GAsyncReadyCallback)indication_lock_storages_ready,
task);
mm_broadband_modem_lock_sms_storages (self,
storage,
MM_SMS_STORAGE_UNKNOWN,
(GAsyncReadyCallback)indication_lock_storages_ready,
task);
}
static void
@@ -7634,10 +7667,10 @@ cds_received (MMPortSerialAt *port,
GMatchInfo *info,
MMBroadbandModem *self)
{
g_autoptr(GError) error = NULL;
MMSmsPart *part;
guint length;
gchar *pdu;
GError *error = NULL;
MMSmsPart *part;
guint length;
gchar *pdu;
mm_obj_dbg (self, "got new non-stored message indication");
@@ -7649,20 +7682,16 @@ cds_received (MMPortSerialAt *port,
return;
part = mm_sms_part_3gpp_new_from_pdu (SMS_PART_INVALID_INDEX, pdu, self, &error);
if (!part) {
if (part) {
mm_obj_dbg (self, "correctly parsed non-stored PDU");
mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
part,
MM_SMS_STATE_RECEIVED,
MM_SMS_STORAGE_UNKNOWN);
} else {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error parsing non-stored PDU: %s", error->message);
} else {
mm_obj_dbg (self, "correctly parsed non-stored PDU");
if (!mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
mm_broadband_modem_create_sms (MM_BROADBAND_MODEM (self)),
part,
MM_SMS_STATE_RECEIVED,
MM_SMS_STORAGE_UNKNOWN,
&error)) {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error adding SMS: %s", error->message);
}
g_error_free (error);
}
}
@@ -8046,16 +8075,10 @@ sms_text_part_list_ready (MMBroadbandModem *self,
mm_sms_part_set_class (part, -1);
mm_obj_dbg (self, "correctly parsed SMS list entry (%d)", idx);
if (!mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
mm_broadband_modem_create_sms (MM_BROADBAND_MODEM (self)),
part,
sms_state_from_str (stat),
ctx->list_storage,
&error)) {
mm_obj_dbg (self, "failed to add SMS: %s", inner_error->message);
goto next;
}
mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
part,
sms_state_from_str (stat),
ctx->list_storage);
next:
g_match_info_next (match_info, NULL);
}
@@ -8094,7 +8117,7 @@ sms_pdu_part_list_ready (MMBroadbandModem *self,
GList *l;
/* Always always always unlock mem1 storage. Warned you've been. */
mm_iface_modem_messaging_unlock_storages (MM_IFACE_MODEM_MESSAGING (self), TRUE, FALSE);
mm_broadband_modem_unlock_sms_storages (self, TRUE, FALSE);
response = mm_base_modem_at_command_finish (MM_BASE_MODEM (self), res, &error);
if (error) {
@@ -8117,22 +8140,16 @@ sms_pdu_part_list_ready (MMBroadbandModem *self,
MMSmsPart *part;
part = mm_sms_part_3gpp_new_from_pdu (info->index, info->pdu, self, &error);
if (!part) {
if (part) {
mm_obj_dbg (self, "correctly parsed PDU (%d)", info->index);
mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
part,
sms_state_from_index (info->status),
ctx->list_storage);
} else {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error parsing PDU (%d): %s", info->index, error->message);
g_clear_error (&error);
} else {
mm_obj_dbg (self, "correctly parsed PDU (%d)", info->index);
if (!mm_iface_modem_messaging_take_part (MM_IFACE_MODEM_MESSAGING (self),
mm_broadband_modem_create_sms (MM_BROADBAND_MODEM (self)),
part,
sms_state_from_index (info->status),
ctx->list_storage,
&error)) {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error adding SMS (%d): %s", info->index, error->message);
g_clear_error (&error);
}
}
}
@@ -8144,13 +8161,13 @@ sms_pdu_part_list_ready (MMBroadbandModem *self,
}
static void
list_parts_lock_storages_ready (MMIfaceModemMessaging *self,
GAsyncResult *res,
GTask *task)
list_parts_lock_storages_ready (MMBroadbandModem *self,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
if (!mm_iface_modem_messaging_lock_storages_finish (self, res, &error)) {
if (!mm_broadband_modem_lock_sms_storages_finish (self, res, &error)) {
/* TODO: we should either make this lock() never fail, by automatically
* retrying after some time, or otherwise retry here. */
g_task_return_error (task, error);
@@ -8192,33 +8209,20 @@ modem_messaging_load_initial_sms_parts (MMIfaceModemMessaging *self,
mm_obj_dbg (self, "listing SMS parts in storage '%s'", mm_sms_storage_get_string (storage));
/* First, request to set the proper storage to read from */
mm_iface_modem_messaging_lock_storages (self,
storage,
MM_SMS_STORAGE_UNKNOWN,
(GAsyncReadyCallback)list_parts_lock_storages_ready,
task);
mm_broadband_modem_lock_sms_storages (MM_BROADBAND_MODEM (self),
storage,
MM_SMS_STORAGE_UNKNOWN,
(GAsyncReadyCallback)list_parts_lock_storages_ready,
task);
}
/*****************************************************************************/
/* Create SMS */
MMBaseSms *
mm_broadband_modem_create_sms (MMBroadbandModem *self)
{
g_assert (MM_BROADBAND_MODEM_GET_CLASS (self)->create_sms != NULL);
return MM_BROADBAND_MODEM_GET_CLASS (self)->create_sms (self);
}
/* Create SMS (Messaging interface) */
static MMBaseSms *
modem_messaging_create_sms (MMBroadbandModem *self)
modem_messaging_create_sms (MMIfaceModemMessaging *self)
{
MMSmsStorage default_storage;
default_storage = mm_iface_modem_messaging_get_default_storage (MM_IFACE_MODEM_MESSAGING (self));
return mm_sms_at_new (MM_BASE_MODEM (self),
mm_iface_modem_is_3gpp (MM_IFACE_MODEM (self)),
default_storage);
return mm_base_sms_new (MM_BASE_MODEM (self));
}
/*****************************************************************************/
@@ -8412,7 +8416,8 @@ set_voice_in_call_unsolicited_events_handlers (MMBroadbandModem *self,
g_autoptr(GRegex) in_call_event_regex = NULL;
guint i;
in_call_event_regex = mm_call_end_regex_get ();
in_call_event_regex = g_regex_new ("\\r\\n(NO CARRIER|BUSY|NO ANSWER|NO DIALTONE)(\\r)?\\r\\n$",
G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
ports[0] = MM_PORT_SERIAL_AT (ports_ctx->primary);
ports[1] = MM_PORT_SERIAL_AT (ports_ctx->secondary);
@@ -8886,22 +8891,19 @@ modem_voice_disable_unsolicited_events (MMIfaceModemVoice *self,
static MMBaseCall *
modem_voice_create_call (MMIfaceModemVoice *_self,
MMCallDirection direction,
const gchar *number,
const guint dtmf_tone_duration)
const gchar *number)
{
MMBroadbandModem *self = MM_BROADBAND_MODEM (_self);
return mm_call_at_new (MM_BASE_MODEM (self),
G_OBJECT (self),
direction,
number,
dtmf_tone_duration,
/* If +CLCC is supported, we want no incoming timeout.
* Also, we're able to support detailed call state updates without
* additional vendor-specific commands. */
self->priv->clcc_supported, /* skip incoming timeout */
self->priv->clcc_supported, /* dialing->ringing supported */
self->priv->clcc_supported); /* ringing->active supported */
return mm_base_call_new (MM_BASE_MODEM (self),
direction,
number,
/* If +CLCC is supported, we want no incoming timeout.
* Also, we're able to support detailed call state updates without
* additional vendor-specific commands. */
self->priv->clcc_supported, /* skip incoming timeout */
self->priv->clcc_supported, /* dialing->ringing supported */
self->priv->clcc_supported); /* ringing->active supported */
}
/*****************************************************************************/
@@ -10600,7 +10602,7 @@ cbc_cbm_received (MMPortSerialAt *port,
GMatchInfo *info,
MMBroadbandModem *self)
{
g_autoptr(GError) error = NULL;
GError *error = NULL;
MMCbmPart *part;
guint length;
gchar *pdu;
@@ -10615,19 +10617,15 @@ cbc_cbm_received (MMPortSerialAt *port,
return;
part = mm_cbm_part_new_from_pdu (pdu, self, &error);
if (!part) {
if (part) {
mm_obj_dbg (self, "correctly parsed PDU");
mm_iface_modem_cell_broadcast_take_part (MM_IFACE_MODEM_CELL_BROADCAST (self),
part,
MM_CBM_STATE_RECEIVED);
} else {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error parsing PDU: %s", error->message);
} else {
mm_obj_dbg (self, "correctly parsed PDU");
if (!mm_iface_modem_cell_broadcast_take_part (MM_IFACE_MODEM_CELL_BROADCAST (self),
G_OBJECT (self),
part,
MM_CBM_STATE_RECEIVED,
&error)) {
/* Don't treat the error as critical */
mm_obj_dbg (self, "error adding CBM: %s", error->message);
}
g_error_free (error);
}
}
@@ -10684,6 +10682,15 @@ modem_cell_broadcast_cleanup_unsolicited_events (MMIfaceModemCellBroadcast *self
set_cell_broadcast_unsolicited_events_handlers (self, FALSE, callback, user_data);
}
/*****************************************************************************/
/* Create CBM (CellBroadcast interface) */
static MMBaseCbm *
modem_cell_broadcast_create_cbm (MMIfaceModemCellBroadcast *self)
{
return mm_base_cbm_new (MM_BASE_MODEM (self));
}
/***********************************************************************************/
/* Get channels (CellBroadcast interface) */
@@ -10955,27 +10962,6 @@ modem_time_check_support (MMIfaceModemTime *self,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMIfacePortAt *port;
GError *error = NULL;
port = mm_base_modem_peek_best_at_port (MM_BASE_MODEM (self), &error);
if (!port) {
g_task_report_error (self, callback, user_data, modem_time_check_support, error);
return;
}
if (mm_kernel_device_get_global_property_as_boolean (mm_port_peek_kernel_device (MM_PORT (port)),
ID_MM_AT_NETWORK_TIME_BROKEN)) {
g_task_report_new_error (self,
callback,
user_data,
modem_time_check_support,
MM_MOBILE_EQUIPMENT_ERROR,
MM_MOBILE_EQUIPMENT_ERROR_NOT_SUPPORTED,
"AT network time tagged as broken");
return;
}
mm_base_modem_at_sequence (MM_BASE_MODEM (self),
time_check_sequence,
NULL, /* response_processor_context */
@@ -11687,8 +11673,9 @@ setup_ports (MMBroadbandModem *self)
g_autoptr(GRegex) ciev_regex = NULL;
g_autoptr(GRegex) cmti_regex = NULL;
g_autoptr(GRegex) cusd_regex = NULL;
g_autoptr(GRegex) creg_regex = NULL;
GPtrArray *array;
guint i;
guint j;
ports[0] = mm_base_modem_peek_port_primary (MM_BASE_MODEM (self));
ports[1] = mm_base_modem_peek_port_secondary (MM_BASE_MODEM (self));
@@ -11704,7 +11691,7 @@ setup_ports (MMBroadbandModem *self)
NULL);
/* Cleanup all unsolicited message handlers in all AT ports */
creg_regex = mm_3gpp_creg_regex_get (FALSE);
array = mm_3gpp_creg_regex_get (FALSE);
ciev_regex = mm_3gpp_ciev_regex_get ();
cmti_regex = mm_3gpp_cmti_regex_get ();
cusd_regex = mm_3gpp_cusd_regex_get ();
@@ -11713,11 +11700,14 @@ setup_ports (MMBroadbandModem *self)
if (!ports[i])
continue;
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]), creg_regex, NULL, NULL, NULL);
for (j = 0; j < array->len; j++)
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]), (GRegex *)g_ptr_array_index (array, j), NULL, NULL, NULL);
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]), ciev_regex, NULL, NULL, NULL);
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]), cmti_regex, NULL, NULL, NULL);
mm_port_serial_at_add_unsolicited_msg_handler (MM_PORT_SERIAL_AT (ports[i]), cusd_regex, NULL, NULL, NULL);
}
mm_3gpp_creg_regex_destroy (array);
}
/*****************************************************************************/
@@ -12951,11 +12941,7 @@ enable (MMBaseModem *self,
return;
case MM_MODEM_STATE_ENABLING:
/* Enabling can be ongoing when another user enable request arrives,
* just error out gracefully. */
g_task_return_new_error (task, MM_CORE_ERROR, MM_CORE_ERROR_WRONG_STATE,
"Cannot enable modem (again): enabling ongoing");
g_object_unref (task);
g_assert_not_reached ();
return;
case MM_MODEM_STATE_ENABLED:
@@ -14242,8 +14228,6 @@ mm_broadband_modem_init (MMBroadbandModem *self)
self->priv->modem_cmer_enable_mode = MM_3GPP_CMER_MODE_NONE;
self->priv->modem_cmer_disable_mode = MM_3GPP_CMER_MODE_NONE;
self->priv->modem_cmer_ind = MM_3GPP_CMER_IND_NONE;
self->priv->modem_cgerep_enable_mode = MM_3GPP_CGEREP_MODE_NONE;
self->priv->modem_cgerep_disable_mode = MM_3GPP_CGEREP_MODE_NONE;
self->priv->flow_control = MM_FLOW_CONTROL_NONE;
self->priv->initial_eps_bearer_cid = -1;
}
@@ -14263,7 +14247,7 @@ finalize (GObject *object)
ports_context_unref (self->priv->in_call_ports_ctx);
if (self->priv->modem_3gpp_registration_regex)
g_regex_unref (self->priv->modem_3gpp_registration_regex);
mm_3gpp_creg_regex_destroy (self->priv->modem_3gpp_registration_regex);
g_free (self->priv->carrier_config_mapping);
@@ -14570,6 +14554,7 @@ iface_modem_cell_broadcast_init (MMIfaceModemCellBroadcastInterface *iface)
iface->cleanup_unsolicited_events_finish = modem_cell_broadcast_setup_cleanup_unsolicited_events_finish;
iface->set_channels = modem_cell_broadcast_set_channels;
iface->set_channels_finish = modem_cell_broadcast_set_channels_finish;
iface->create_cbm = modem_cell_broadcast_create_cbm;
}
static void
@@ -14605,11 +14590,9 @@ iface_modem_messaging_init (MMIfaceModemMessagingInterface *iface)
iface->enable_unsolicited_events_finish = modem_messaging_enable_unsolicited_events_finish;
iface->cleanup_unsolicited_events = modem_messaging_cleanup_unsolicited_events;
iface->cleanup_unsolicited_events_finish = modem_messaging_setup_cleanup_unsolicited_events_finish;
iface->create_sms = modem_messaging_create_sms;
iface->init_current_storages = modem_messaging_init_current_storages;
iface->init_current_storages_finish = modem_messaging_init_current_storages_finish;
iface->lock_storages = modem_messaging_lock_storages;
iface->lock_storages_finish = modem_messaging_lock_storages_finish;
iface->unlock_storages = modem_messaging_unlock_storages;
}
static void
@@ -14728,7 +14711,6 @@ mm_broadband_modem_class_init (MMBroadbandModemClass *klass)
klass->disabling_stopped = disabling_stopped;
klass->load_initial_eps_bearer_cid = load_initial_eps_bearer_cid;
klass->load_initial_eps_bearer_cid_finish = load_initial_eps_bearer_cid_finish;
klass->create_sms = modem_messaging_create_sms;
g_object_class_override_property (object_class,
PROP_MODEM_DBUS_SKELETON,
+12 -7
View File
@@ -27,7 +27,6 @@
#include "mm-modem-helpers.h"
#include "mm-charsets.h"
#include "mm-base-modem.h"
#include "mm-base-sms.h"
#define MM_TYPE_BROADBAND_MODEM (mm_broadband_modem_get_type ())
#define MM_BROADBAND_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BROADBAND_MODEM, MMBroadbandModem))
@@ -106,9 +105,6 @@ struct _MMBroadbandModemClass {
gint (* load_initial_eps_bearer_cid_finish) (MMBroadbandModem *self,
GAsyncResult *res,
GError **error);
/* Create SMS objects */
MMBaseSms * (* create_sms) (MMBroadbandModem *self);
};
GType mm_broadband_modem_get_type (void);
@@ -130,6 +126,18 @@ gchar *mm_broadband_modem_create_device_identifier (MMBroadbandModem *self,
const gchar *ati1,
GError **error);
/* Locking/unlocking SMS storages */
void mm_broadband_modem_lock_sms_storages (MMBroadbandModem *self,
MMSmsStorage mem1, /* reading/listing/deleting */
MMSmsStorage mem2, /* storing/sending */
GAsyncReadyCallback callback,
gpointer user_data);
gboolean mm_broadband_modem_lock_sms_storages_finish (MMBroadbandModem *self,
GAsyncResult *res,
GError **error);
void mm_broadband_modem_unlock_sms_storages (MMBroadbandModem *self,
gboolean mem1,
gboolean mem2);
/* Helper to update SIM hot swap */
gboolean mm_broadband_modem_sim_hot_swap_ports_context_init (MMBroadbandModem *self,
GError **error);
@@ -138,7 +146,4 @@ void mm_broadband_modem_sim_hot_swap_ports_context_reset (MMBroadbandModem
/* Helper to manage initial EPS bearer */
gint mm_broadband_modem_get_initial_eps_bearer_cid (MMBroadbandModem *self);
/* Helper to create a new modem-specific SMS object */
MMBaseSms *mm_broadband_modem_create_sms (MMBroadbandModem *self);
#endif /* MM_BROADBAND_MODEM_H */
-474
View File
@@ -1,474 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2015 Riccardo Vangelisti <riccardo.vangelisti@sadel.it>
* Copyright (C) 2019 Aleksander Morgado <aleksander@aleksander.es>
* Copyright (C) 2019 Purism SPC
*/
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <ctype.h>
#include <ModemManager.h>
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
#include "mm-call-at.h"
#include "mm-base-modem-at.h"
#include "mm-base-modem.h"
#include "mm-modem-helpers.h"
#include "mm-error-helpers.h"
#include "mm-log-object.h"
#include "mm-bind.h"
G_DEFINE_TYPE (MMCallAt, mm_call_at, MM_TYPE_BASE_CALL)
typedef enum {
FEATURE_SUPPORT_UNKNOWN,
FEATURE_NOT_SUPPORTED,
FEATURE_SUPPORTED,
} FeatureSupport;
struct _MMCallAtPrivate {
/* The modem which owns this call */
MMBaseModem *modem;
/* DTMF support */
FeatureSupport vtd_supported;
};
/*****************************************************************************/
/* Start the CALL */
static gboolean
call_start_finish (MMBaseCall *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
call_start_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
const gchar *response = NULL;
response = mm_base_modem_at_command_finish (modem, res, &error);
/* check response for error */
if (response && response[0])
error = g_error_new (MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Couldn't start the call: Unhandled response '%s'", response);
if (error)
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
call_start (MMBaseCall *_self,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMCallAt *self = MM_CALL_AT (_self);
GError *error = NULL;
GTask *task;
gchar *cmd;
MMIfacePortAt *port;
task = g_task_new (self, NULL, callback, user_data);
port = mm_base_modem_peek_best_at_port (self->priv->modem, &error);
if (!port) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
cmd = g_strdup_printf ("ATD%s;", mm_gdbus_call_get_number (MM_GDBUS_CALL (self)));
mm_base_modem_at_command_full (self->priv->modem,
port,
cmd,
90,
FALSE, /* no cached */
FALSE, /* no raw */
cancellable,
(GAsyncReadyCallback)call_start_ready,
task);
g_free (cmd);
}
/*****************************************************************************/
/* Accept the call */
static gboolean
call_accept_finish (MMBaseCall *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
call_accept_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
const gchar *response;
response = mm_base_modem_at_command_finish (modem, res, &error);
/* check response for error */
if (response && response[0])
g_set_error (&error, MM_CORE_ERROR, MM_CORE_ERROR_FAILED,
"Couldn't accept the call: Unhandled response '%s'", response);
if (error)
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
call_accept (MMBaseCall *_self,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMCallAt *self = MM_CALL_AT (_self);
GTask *task;
task = g_task_new (self, NULL, callback, user_data);
mm_base_modem_at_command (self->priv->modem,
"ATA",
2,
FALSE,
(GAsyncReadyCallback)call_accept_ready,
task);
}
/*****************************************************************************/
/* Deflect the call */
static gboolean
call_deflect_finish (MMBaseCall *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
call_deflect_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
mm_base_modem_at_command_finish (modem, res, &error);
if (error)
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
call_deflect (MMBaseCall *_self,
const gchar *number,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMCallAt *self = MM_CALL_AT (_self);
GTask *task;
gchar *cmd;
task = g_task_new (self, NULL, callback, user_data);
cmd = g_strdup_printf ("+CTFR=%s", number);
mm_base_modem_at_command (self->priv->modem,
cmd,
20,
FALSE,
(GAsyncReadyCallback)call_deflect_ready,
task);
g_free (cmd);
}
/*****************************************************************************/
/* Hangup the call */
static gboolean
call_hangup_finish (MMBaseCall *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_boolean (G_TASK (res), error);
}
static void
chup_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
{
GError *error = NULL;
mm_base_modem_at_command_finish (modem, res, &error);
if (error)
g_task_return_error (task, error);
else
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
chup_fallback (GTask *task)
{
MMCallAt *self;
self = MM_CALL_AT (g_task_get_source_object (task));
mm_base_modem_at_command (self->priv->modem,
"+CHUP",
2,
FALSE,
(GAsyncReadyCallback)chup_ready,
task);
}
static void
chld_hangup_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
{
MMBaseCall *self;
GError *error = NULL;
self = g_task_get_source_object (task);
mm_base_modem_at_command_finish (modem, res, &error);
if (error) {
mm_obj_warn (self, "couldn't hangup single call with call id '%u': %s",
mm_base_call_get_index (MM_BASE_CALL (self)), error->message);
g_error_free (error);
chup_fallback (task);
return;
}
g_task_return_boolean (task, TRUE);
g_object_unref (task);
}
static void
call_hangup (MMBaseCall *_self,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMCallAt *self = MM_CALL_AT (_self);
GTask *task;
guint index;
task = g_task_new (self, NULL, callback, user_data);
/* Try to hangup the single call id */
index = mm_base_call_get_index (MM_BASE_CALL (self));
if (index) {
gchar *cmd;
cmd = g_strdup_printf ("+CHLD=1%u", index);
mm_base_modem_at_command (self->priv->modem,
cmd,
2,
FALSE,
(GAsyncReadyCallback)chld_hangup_ready,
task);
g_free (cmd);
return;
}
/* otherwise terminate all */
chup_fallback (task);
}
/*****************************************************************************/
/* Send DTMF tone to call */
static gssize
call_send_dtmf_finish (MMBaseCall *self,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_int (G_TASK (res), error);
}
static void
call_send_dtmf_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
{
MMBaseCall *self;
GError *error = NULL;
self = g_task_get_source_object (task);
mm_base_modem_at_command_finish (modem, res, &error);
if (error) {
mm_obj_dbg (self, "couldn't send dtmf: %s", error->message);
g_task_return_error (task, error);
g_object_unref (task);
return;
}
/* We sent one character */
g_task_return_int (task, 1);
g_object_unref (task);
}
static void
send_dtmf_digit (MMCallAt *self,
GTask *task,
const gchar dtmf_digit)
{
g_autofree gchar *cmd = NULL;
cmd = g_strdup_printf ("AT+VTS=%c", dtmf_digit);
mm_base_modem_at_command (self->priv->modem,
cmd,
3,
FALSE,
(GAsyncReadyCallback)call_send_dtmf_ready,
task);
}
static void
call_dtmf_vtd_ready (MMBaseModem *modem,
GAsyncResult *res,
GTask *task)
{
MMCallAt *self;
g_autoptr(GError) error = NULL;
gchar dtmf_digit;
self = g_task_get_source_object (task);
mm_base_modem_at_command_finish (modem, res, &error);
self->priv->vtd_supported = error ? FEATURE_NOT_SUPPORTED : FEATURE_SUPPORTED;
dtmf_digit = (gchar) GPOINTER_TO_UINT (g_task_get_task_data (task));
send_dtmf_digit (self, task, dtmf_digit);
}
static void
call_send_dtmf (MMBaseCall *_self,
const gchar *dtmf,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMCallAt *self = MM_CALL_AT (_self);
GTask *task;
g_autofree gchar *cmd = NULL;
task = g_task_new (self, NULL, callback, user_data);
if (self->priv->vtd_supported == FEATURE_NOT_SUPPORTED) {
send_dtmf_digit (self, task, dtmf[0]);
return;
}
g_task_set_task_data (task, GUINT_TO_POINTER (dtmf[0]), NULL);
/* Otherwise try to set duration */
cmd = g_strdup_printf ("AT+VTD=%u", mm_base_call_get_dtmf_tone_duration (_self));
mm_base_modem_at_command (self->priv->modem,
cmd,
3,
FALSE,
(GAsyncReadyCallback)call_dtmf_vtd_ready,
task);
}
/*****************************************************************************/
MMBaseCall *
mm_call_at_new (MMBaseModem *modem,
GObject *bind_to,
MMCallDirection direction,
const gchar *number,
const guint dtmf_tone_duration,
gboolean skip_incoming_timeout,
gboolean supports_dialing_to_ringing,
gboolean supports_ringing_to_active)
{
MMBaseCall *call;
call = MM_BASE_CALL (g_object_new (MM_TYPE_CALL_AT,
MM_BASE_CALL_IFACE_MODEM_VOICE, modem,
MM_BIND_TO, bind_to,
MM_CALL_DIRECTION, direction,
MM_CALL_NUMBER, number,
MM_CALL_DTMF_TONE_DURATION, dtmf_tone_duration,
MM_BASE_CALL_SKIP_INCOMING_TIMEOUT, skip_incoming_timeout,
MM_BASE_CALL_SUPPORTS_DIALING_TO_RINGING, supports_dialing_to_ringing,
MM_BASE_CALL_SUPPORTS_RINGING_TO_ACTIVE, supports_ringing_to_active,
NULL));
MM_CALL_AT (call)->priv->modem = g_object_ref (modem);
return call;
}
static void
mm_call_at_init (MMCallAt *self)
{
/* Initialize private data */
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_CALL_AT, MMCallAtPrivate);
}
static void
dispose (GObject *object)
{
MMCallAt *self = MM_CALL_AT (object);
g_clear_object (&self->priv->modem);
G_OBJECT_CLASS (mm_call_at_parent_class)->dispose (object);
}
static void
mm_call_at_class_init (MMCallAtClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MMBaseCallClass *base_call_class = MM_BASE_CALL_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMCallAtPrivate));
object_class->dispose = dispose;
base_call_class->start = call_start;
base_call_class->start_finish = call_start_finish;
base_call_class->accept = call_accept;
base_call_class->accept_finish = call_accept_finish;
base_call_class->deflect = call_deflect;
base_call_class->deflect_finish = call_deflect_finish;
base_call_class->hangup = call_hangup;
base_call_class->hangup_finish = call_hangup_finish;
base_call_class->send_dtmf = call_send_dtmf;
base_call_class->send_dtmf_finish = call_send_dtmf_finish;
}
-61
View File
@@ -1,61 +0,0 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details:
*
* Copyright (C) 2015 Riccardo Vangelisti <riccardo.vangelisti@sadel.it>
* Copyright (C) 2019 Purism SPC
*/
#ifndef MM_CALL_AT_H
#define MM_CALL_AT_H
#include <glib.h>
#include <glib-object.h>
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
#include "mm-base-call.h"
#include "mm-base-modem.h"
#define MM_TYPE_CALL_AT (mm_call_at_get_type ())
#define MM_CALL_AT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_CALL_AT, MMCallAt))
#define MM_CALL_AT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_CALL_AT, MMCallAtClass))
#define MM_IS_CALL_AT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_CALL_AT))
#define MM_IS_CALL_AT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_CALL_AT))
#define MM_CALL_AT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_CALL_AT, MMCallAtClass))
typedef struct _MMCallAt MMCallAt;
typedef struct _MMCallAtClass MMCallAtClass;
typedef struct _MMCallAtPrivate MMCallAtPrivate;
struct _MMCallAt {
MMBaseCall parent;
MMCallAtPrivate *priv;
};
struct _MMCallAtClass {
MMBaseCallClass parent;
};
GType mm_call_at_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCallAt, g_object_unref)
MMBaseCall *mm_call_at_new (MMBaseModem *modem,
GObject *bind_to,
MMCallDirection direction,
const gchar *number,
const guint dtmf_tone_duration,
gboolean skip_incoming_timeout,
gboolean supports_dialing_to_ringing,
gboolean supports_ringing_to_active);
#endif /* MM_CALL_AT_H */
+63 -2
View File
@@ -24,12 +24,20 @@
#define _LIBMM_INSIDE_MM
#include <libmm-glib.h>
#include "mm-iface-modem-messaging.h"
#include "mm-call-list.h"
#include "mm-base-call.h"
#include "mm-log.h"
G_DEFINE_TYPE (MMCallList, mm_call_list, G_TYPE_OBJECT)
enum {
PROP_0,
PROP_MODEM,
PROP_LAST
};
static GParamSpec *properties[PROP_LAST];
enum {
SIGNAL_CALL_ADDED,
SIGNAL_CALL_DELETED,
@@ -38,6 +46,8 @@ enum {
static guint signals[SIGNAL_LAST];
struct _MMCallListPrivate {
/* The owner modem */
MMBaseModem *modem;
/* List of call objects */
GList *list;
};
@@ -203,10 +213,49 @@ mm_call_list_add_call (MMCallList *self,
/*****************************************************************************/
MMCallList *
mm_call_list_new (void)
mm_call_list_new (MMBaseModem *modem)
{
/* Create the object */
return g_object_new (MM_TYPE_CALL_LIST, NULL);
return g_object_new (MM_TYPE_CALL_LIST,
MM_CALL_LIST_MODEM, modem,
NULL);
}
static void
set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
MMCallList *self = MM_CALL_LIST (object);
switch (prop_id) {
case PROP_MODEM:
g_clear_object (&self->priv->modem);
self->priv->modem = g_value_dup_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
MMCallList *self = MM_CALL_LIST (object);
switch (prop_id) {
case PROP_MODEM:
g_value_set_object (value, self->priv->modem);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
@@ -223,6 +272,7 @@ dispose (GObject *object)
{
MMCallList *self = MM_CALL_LIST (object);
g_clear_object (&self->priv->modem);
g_list_free_full (self->priv->list, g_object_unref);
self->priv->list = NULL;
@@ -237,8 +287,19 @@ mm_call_list_class_init (MMCallListClass *klass)
g_type_class_add_private (object_class, sizeof (MMCallListPrivate));
/* Virtual methods */
object_class->get_property = get_property;
object_class->set_property = set_property;
object_class->dispose = dispose;
/* Properties */
properties[PROP_MODEM] =
g_param_spec_object (MM_CALL_LIST_MODEM,
"Modem",
"The Modem which owns this CALL list",
MM_TYPE_BASE_MODEM,
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]);
/* Signals */
signals[SIGNAL_CALL_ADDED] =
g_signal_new (MM_CALL_ADDED,
+4 -1
View File
@@ -19,6 +19,7 @@
#include <glib.h>
#include <glib-object.h>
#include "mm-base-modem.h"
#include "mm-base-call.h"
#define MM_TYPE_CALL_LIST (mm_call_list_get_type ())
@@ -32,6 +33,8 @@ typedef struct _MMCallList MMCallList;
typedef struct _MMCallListClass MMCallListClass;
typedef struct _MMCallListPrivate MMCallListPrivate;
#define MM_CALL_LIST_MODEM "call-list-modem"
#define MM_CALL_ADDED "call-added"
#define MM_CALL_DELETED "call-deleted"
@@ -54,7 +57,7 @@ struct _MMCallListClass {
GType mm_call_list_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCallList, g_object_unref)
MMCallList *mm_call_list_new (void);
MMCallList *mm_call_list_new (MMBaseModem *modem);
GStrv mm_call_list_get_paths (MMCallList *self);
guint mm_call_list_get_count (MMCallList *self);
+94 -139
View File
@@ -31,15 +31,9 @@
#include "mm-call-qmi.h"
#include "mm-base-modem.h"
#include "mm-log-object.h"
#include "mm-bind.h"
G_DEFINE_TYPE (MMCallQmi, mm_call_qmi, MM_TYPE_BASE_CALL)
struct _MMCallQmiPrivate {
/* The modem which owns this call */
MMBaseModem *modem;
};
/*****************************************************************************/
static gboolean
@@ -53,7 +47,12 @@ ensure_qmi_client (MMCallQmi *self,
QmiClient *client;
MMPortQmi *port;
port = mm_broadband_modem_qmi_peek_port_qmi (MM_BROADBAND_MODEM_QMI (self->priv->modem));
g_object_get (self,
MM_BASE_CALL_MODEM, &modem,
NULL);
g_assert (MM_IS_BASE_MODEM (modem));
port = mm_broadband_modem_qmi_peek_port_qmi (MM_BROADBAND_MODEM_QMI (modem));
g_object_unref (modem);
if (!port) {
@@ -331,41 +330,22 @@ call_hangup (MMBaseCall *self,
}
/*****************************************************************************/
/* DTMF handling */
/* Send DTMF character */
static gboolean
get_client_and_call_id (MMCallQmi *self,
GAsyncReadyCallback callback,
gpointer user_data,
QmiClient **client,
guint *call_id)
typedef struct {
QmiClient *client;
guint8 call_id;
} SendDtmfContext;
static void
send_dtmf_context_free (SendDtmfContext *ctx)
{
g_return_val_if_fail (client, FALSE);
g_return_val_if_fail (call_id, FALSE);
/* Ensure Voice client */
if (!ensure_qmi_client (self,
QMI_SERVICE_VOICE, client,
callback, user_data))
return FALSE;
*call_id = mm_base_call_get_index (MM_BASE_CALL (self));
if (*call_id == 0) {
g_task_report_new_error (self,
callback,
user_data,
(gpointer) __func__,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
"Invalid call index");
return FALSE;
}
return TRUE;
g_clear_object (&ctx->client);
g_slice_free (SendDtmfContext, ctx);
}
static gboolean
call_stop_dtmf_finish (MMBaseCall *call,
call_send_dtmf_finish (MMBaseCall *self,
GAsyncResult *res,
GError **error)
{
@@ -385,59 +365,35 @@ voice_stop_continuous_dtmf_ready (QmiClientVoice *client,
g_prefix_error (&error, "QMI operation failed: ");
g_task_return_error (task, error);
} else if (!qmi_message_voice_stop_continuous_dtmf_output_get_result (output, &error)) {
g_prefix_error (&error, "Couldn't stop DTMF character: ");
g_prefix_error (&error, "Couldn't send DTMF character: ");
g_task_return_error (task, error);
} else {
g_task_return_boolean (task, TRUE);
}
g_object_unref (task);
}
static void
call_stop_dtmf (MMBaseCall *_self,
GAsyncReadyCallback callback,
gpointer user_data)
static gboolean
voice_stop_continuous_dtmf (GTask *task)
{
MMCallQmi *self = MM_CALL_QMI (_self);
GTask *task;
QmiClient *client = NULL;
guint call_id = 0;
GError *error = NULL;
g_autoptr (QmiMessageVoiceStopContinuousDtmfInput) input = NULL;
SendDtmfContext *ctx;
GError *error = NULL;
g_autoptr (QmiMessageVoiceStopContinuousDtmfInput) input = NULL;
if (!get_client_and_call_id (self,
callback,
user_data,
&client,
&call_id))
return;
task = g_task_new (self, NULL, callback, user_data);
ctx = g_task_get_task_data (task);
input = qmi_message_voice_stop_continuous_dtmf_input_new ();
if (!qmi_message_voice_stop_continuous_dtmf_input_set_data (input,
call_id,
&error)) {
g_task_return_error (task, error);
g_object_unref (task);
return;
}
qmi_message_voice_stop_continuous_dtmf_input_set_data (input, ctx->call_id, &error);
/* Stop sending DTMF tone */
qmi_client_voice_stop_continuous_dtmf (QMI_CLIENT_VOICE (client),
qmi_client_voice_stop_continuous_dtmf (QMI_CLIENT_VOICE (ctx->client),
input,
5,
NULL,
(GAsyncReadyCallback) voice_stop_continuous_dtmf_ready,
task);
}
static gssize
call_send_dtmf_finish (MMBaseCall *call,
GAsyncResult *res,
GError **error)
{
return g_task_propagate_int (G_TASK (res), error);
return G_SOURCE_REMOVE;
}
static void
@@ -445,55 +401,80 @@ voice_start_continuous_dtmf_ready (QmiClientVoice *client,
GAsyncResult *res,
GTask *task)
{
g_autoptr (QmiMessageVoiceStartContinuousDtmfOutput) output = NULL;
GError *error = NULL;
g_autoptr(QmiMessageVoiceStartContinuousDtmfOutput) output = NULL;
GError *error = NULL;
output = qmi_client_voice_start_continuous_dtmf_finish (client, res, &error);
if (!output) {
g_prefix_error (&error, "QMI operation failed: ");
g_task_return_error (task, error);
} else if (!qmi_message_voice_start_continuous_dtmf_output_get_result (output, &error)) {
g_prefix_error (&error, "Couldn't send DTMF character: ");
g_task_return_error (task, error);
} else {
g_task_return_int (task, 1);
}
g_object_unref (task);
}
static void
call_send_dtmf (MMBaseCall *_self,
const gchar *dtmf,
GAsyncReadyCallback callback,
gpointer user_data)
{
MMCallQmi *self = MM_CALL_QMI (_self);
GTask *task;
QmiClient *client = NULL;
guint call_id = 0;
GError *error = NULL;
g_autoptr (QmiMessageVoiceStartContinuousDtmfInput) input = NULL;
if (!get_client_and_call_id (self,
callback,
user_data,
&client,
&call_id))
g_object_unref (task);
return;
}
task = g_task_new (self, NULL, callback, user_data);
input = qmi_message_voice_start_continuous_dtmf_input_new ();
if (!qmi_message_voice_start_continuous_dtmf_input_set_data (input,
call_id,
dtmf[0],
&error)) {
if (!qmi_message_voice_start_continuous_dtmf_output_get_result (output, &error)) {
g_prefix_error (&error, "Couldn't send DTMF character: ");
g_task_return_error (task, error);
g_object_unref (task);
return;
}
/* Disable DTMF press after 500 ms */
g_timeout_add (500, (GSourceFunc) voice_stop_continuous_dtmf, task);
}
static void
call_send_dtmf (MMBaseCall *self,
const gchar *dtmf,
GAsyncReadyCallback callback,
gpointer user_data)
{
GTask *task;
GError *error = NULL;
SendDtmfContext *ctx;
QmiClient *client = NULL;
guint8 call_id;
g_autoptr (QmiMessageVoiceStartContinuousDtmfInput) input = NULL;
/* Ensure Voice client */
if (!ensure_qmi_client (MM_CALL_QMI (self),
QMI_SERVICE_VOICE, &client,
callback, user_data))
return;
task = g_task_new (self, NULL, callback, user_data);
call_id = mm_base_call_get_index (self);
if (call_id == 0) {
g_task_return_new_error (task,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
"Invalid call index");
g_object_unref (task);
return;
}
ctx = g_slice_new0 (SendDtmfContext);
ctx->client = g_object_ref (client);
ctx->call_id = call_id;
g_task_set_task_data (task, ctx, (GDestroyNotify) send_dtmf_context_free);
/* Send DTMF character as ASCII number */
input = qmi_message_voice_start_continuous_dtmf_input_new ();
qmi_message_voice_start_continuous_dtmf_input_set_data (input,
call_id,
(guint8) dtmf[0],
&error);
if (error) {
g_task_return_new_error (task,
MM_CORE_ERROR,
MM_CORE_ERROR_INVALID_ARGS,
"DTMF data build failed");
g_object_unref (task);
return;
}
qmi_client_voice_start_continuous_dtmf (QMI_CLIENT_VOICE (client),
input,
5,
@@ -507,52 +488,28 @@ call_send_dtmf (MMBaseCall *_self,
MMBaseCall *
mm_call_qmi_new (MMBaseModem *modem,
MMCallDirection direction,
const gchar *number,
const guint dtmf_tone_duration)
const gchar *number)
{
MMBaseCall *call;
call = MM_BASE_CALL (g_object_new (MM_TYPE_CALL_QMI,
MM_BASE_CALL_IFACE_MODEM_VOICE, modem,
MM_BIND_TO, modem,
MM_CALL_DIRECTION, direction,
MM_CALL_NUMBER, number,
MM_CALL_DTMF_TONE_DURATION, dtmf_tone_duration,
return MM_BASE_CALL (g_object_new (MM_TYPE_CALL_QMI,
MM_BASE_CALL_MODEM, modem,
"direction", direction,
"number", number,
MM_BASE_CALL_SKIP_INCOMING_TIMEOUT, TRUE,
MM_BASE_CALL_SUPPORTS_DIALING_TO_RINGING, TRUE,
MM_BASE_CALL_SUPPORTS_RINGING_TO_ACTIVE, TRUE,
NULL));
MM_CALL_QMI (call)->priv->modem = g_object_ref (modem);
return call;
}
static void
mm_call_qmi_init (MMCallQmi *self)
{
/* Initialize private data */
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, MM_TYPE_CALL_QMI, MMCallQmiPrivate);
}
static void
dispose (GObject *object)
{
MMCallQmi *self = MM_CALL_QMI (object);
g_clear_object (&self->priv->modem);
G_OBJECT_CLASS (mm_call_qmi_parent_class)->dispose (object);
}
static void
mm_call_qmi_class_init (MMCallQmiClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
MMBaseCallClass *base_call_class = MM_BASE_CALL_CLASS (klass);
g_type_class_add_private (object_class, sizeof (MMCallQmiPrivate));
object_class->dispose = dispose;
base_call_class->start = call_start;
base_call_class->start_finish = call_start_finish;
base_call_class->accept = call_accept;
@@ -561,6 +518,4 @@ mm_call_qmi_class_init (MMCallQmiClass *klass)
base_call_class->hangup_finish = call_hangup_finish;
base_call_class->send_dtmf = call_send_dtmf;
base_call_class->send_dtmf_finish = call_send_dtmf_finish;
base_call_class->stop_dtmf = call_stop_dtmf;
base_call_class->stop_dtmf_finish = call_stop_dtmf_finish;
}
+1 -4
View File
@@ -33,11 +33,9 @@
typedef struct _MMCallQmi MMCallQmi;
typedef struct _MMCallQmiClass MMCallQmiClass;
typedef struct _MMCallQmiPrivate MMCallQmiPrivate;
struct _MMCallQmi {
MMBaseCall parent;
MMCallQmiPrivate *priv;
};
struct _MMCallQmiClass {
@@ -49,7 +47,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCallQmi, g_object_unref)
MMBaseCall *mm_call_qmi_new (MMBaseModem *modem,
MMCallDirection direction,
const gchar *number,
const guint dtmf_tone_duration);
const gchar *number);
#endif /* MM_CALL_QMI_H */
+9 -29
View File
@@ -32,18 +32,14 @@
#include "mm-cbm-list.h"
#include "mm-base-cbm.h"
#include "mm-log-object.h"
#include "mm-bind.h"
static void log_object_iface_init (MMLogObjectInterface *iface);
static void bind_iface_init (MMBindInterface *iface);
G_DEFINE_TYPE_EXTENDED (MMCbmList, mm_cbm_list, G_TYPE_OBJECT, 0,
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init)
G_IMPLEMENT_INTERFACE (MM_TYPE_BIND, bind_iface_init))
G_IMPLEMENT_INTERFACE (MM_TYPE_LOG_OBJECT, log_object_iface_init))
enum {
PROP_0,
PROP_BIND_TO,
PROP_MODEM,
PROP_LAST
};
@@ -57,8 +53,6 @@ enum {
static guint signals[SIGNAL_LAST];
struct _MMCbmListPrivate {
/* The object this CBM list is bound to */
GObject *bind_to;
/* The owner modem */
MMBaseModem *modem;
/* List of cbm objects */
@@ -179,7 +173,6 @@ cmp_cbm_by_serial_and_id (MMBaseCbm *cbm,
static gboolean
take_part (MMCbmList *self,
GObject *bind_to,
MMCbmPart *part,
MMCbmState state,
GError **error)
@@ -203,7 +196,7 @@ take_part (MMCbmList *self,
}
/* Create new cbm */
cbm = mm_base_cbm_new_with_part (bind_to,
cbm = mm_base_cbm_new_with_part (self->priv->modem,
state,
mm_cbm_part_get_num_parts (part),
part,
@@ -257,7 +250,6 @@ mm_cbm_list_has_part (MMCbmList *self,
gboolean
mm_cbm_list_take_part (MMCbmList *self,
GObject *bind_to,
MMCbmPart *part,
MMCbmState state,
GError **error)
@@ -277,7 +269,7 @@ mm_cbm_list_take_part (MMCbmList *self,
return FALSE;
}
return take_part (self, bind_to, part, state, error);
return take_part (self, part, state, error);
}
/*****************************************************************************/
@@ -291,12 +283,11 @@ log_object_build_id (MMLogObject *_self)
/*****************************************************************************/
MMCbmList *
mm_cbm_list_new (MMBaseModem *modem, GObject *bind_to)
mm_cbm_list_new (MMBaseModem *modem)
{
/* Create the object */
return g_object_new (MM_TYPE_CBM_LIST,
MM_CBM_LIST_MODEM, modem,
MM_BIND_TO, bind_to,
NULL);
}
@@ -309,14 +300,14 @@ set_property (GObject *object,
MMCbmList *self = MM_CBM_LIST (object);
switch (prop_id) {
case PROP_BIND_TO:
g_clear_object (&self->priv->bind_to);
self->priv->bind_to = g_value_dup_object (value);
mm_bind_to (MM_BIND (self), NULL, self->priv->bind_to);
break;
case PROP_MODEM:
g_clear_object (&self->priv->modem);
self->priv->modem = g_value_dup_object (value);
if (self->priv->modem) {
/* Set owner ID */
mm_log_object_set_owner_id (MM_LOG_OBJECT (self),
mm_log_object_get_id (MM_LOG_OBJECT (self->priv->modem)));
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -333,9 +324,6 @@ get_property (GObject *object,
MMCbmList *self = MM_CBM_LIST (object);
switch (prop_id) {
case PROP_BIND_TO:
g_value_set_object (value, self->priv->bind_to);
break;
case PROP_MODEM:
g_value_set_object (value, self->priv->modem);
break;
@@ -360,7 +348,6 @@ dispose (GObject *object)
MMCbmList *self = MM_CBM_LIST (object);
g_clear_object (&self->priv->modem);
g_clear_object (&self->priv->bind_to);
g_list_free_full (self->priv->list, g_object_unref);
self->priv->list = NULL;
@@ -373,11 +360,6 @@ log_object_iface_init (MMLogObjectInterface *iface)
iface->build_id = log_object_build_id;
}
static void
bind_iface_init (MMBindInterface *iface)
{
}
static void
mm_cbm_list_class_init (MMCbmListClass *klass)
{
@@ -399,8 +381,6 @@ mm_cbm_list_class_init (MMCbmListClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_MODEM, properties[PROP_MODEM]);
g_object_class_override_property (object_class, PROP_BIND_TO, MM_BIND_TO);
/* Signals */
signals[SIGNAL_ADDED] =
g_signal_new (MM_CBM_ADDED,
+1 -3
View File
@@ -57,8 +57,7 @@ struct _MMCbmListClass {
GType mm_cbm_list_get_type (void);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCbmList, g_object_unref)
MMCbmList *mm_cbm_list_new (MMBaseModem *modem,
GObject *bind_to);
MMCbmList *mm_cbm_list_new (MMBaseModem *modem);
GStrv mm_cbm_list_get_paths (MMCbmList *self);
guint mm_cbm_list_get_count (MMCbmList *self);
@@ -69,7 +68,6 @@ gboolean mm_cbm_list_has_part (MMCbmList *self,
guint8 part_num);
gboolean mm_cbm_list_take_part (MMCbmList *self,
GObject *bind_to,
MMCbmPart *part,
MMCbmState state,
GError **error);
+11 -117
View File
@@ -27,17 +27,9 @@
#include "mm-sms-part-3gpp.h"
#define CBS_DATA_CODING_GROUP_MASK 0b11110000
#define CBS_DATA_CODING_LANG_MASK 0b00001111
#define CBS_DATA_CODING_LANG_GSM7 0b00000000
#define CBS_DATA_CODING_GSM7 0b00010000
#define CBS_DATA_CODING_UCS2 0b00010001
#define CBS_DATA_CODING_OTHER 0b00100000
#define CBS_DATA_CODING_OTHER_CZECH 0b00100000
#define CBS_DATA_CODING_OTHER_HEBREW 0b00100001
#define CBS_DATA_CODING_OTHER_ARABIC 0b00100010
#define CBS_DATA_CODING_OTHER_RUSSIAN 0b00100011
#define CBS_DATA_CODING_OTHER_ICELANDIC 0b00100100
#define CBS_DATA_CODING_UNSPECIFIED 0b00110000
#define CBS_DATA_CODING_GENERAL_NO_CLASS 0b01000000
#define CBS_DATA_CODING_GENERAL_CLASS 0b01010000
#define CBS_DATA_CODING_GENERAL_CHARSET_MASK 0b00001100
@@ -54,48 +46,10 @@ struct _MMCbmPart {
guint8 part_num;
gchar *text;
gchar *language;
MMSmsEncoding encoding;
};
static gchar *
mm_cbm_part_coding_group_to_language (guint8 group)
{
switch (group & CBS_DATA_CODING_LANG_MASK) {
case 0b0000:
return g_strdup ("de");
case 0b0001:
return g_strdup ("en");
case 0b0010:
return g_strdup ("it");
case 0b0011:
return g_strdup ("fr");
case 0b0100:
return g_strdup ("es");
case 0b0101:
return g_strdup ("nl");
case 0b0110:
return g_strdup ("sv");
case 0b0111:
return g_strdup ("da");
case 0b1000:
return g_strdup ("pt");
case 0b1001:
return g_strdup ("fi");
case 0b1010:
return g_strdup ("no");
case 0b1011:
return g_strdup ("el");
case 0b1110:
return g_strdup ("pl");
case 0b1111:
default:
return NULL;
};
}
MMCbmPart *
mm_cbm_part_new_from_pdu (const gchar *hexpdu,
gpointer log_object,
@@ -120,13 +74,12 @@ mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
gpointer log_object,
GError **error)
{
g_autoptr (MMCbmPart) cbm_part = NULL;
MMCbmPart *cbm_part;
MMCbmGeoScope scope;
guint offset = 0;
guint16 serial, group;
int len;
g_autofree gchar *text = NULL;
gboolean has_lang = FALSE, has_7bit_lang = FALSE;
cbm_part = mm_cbm_part_new ();
@@ -141,6 +94,7 @@ mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
check_descr_str, \
pdu_len, \
required_size); \
mm_cbm_part_free (cbm_part); \
return NULL; \
}
@@ -162,6 +116,7 @@ mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
mm_obj_dbg (log_object, " immediate cell cbm scope");
break;
default:
mm_cbm_part_free (cbm_part);
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
@@ -182,40 +137,14 @@ mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
/* Order matches 3GPP TS 23.038 Chapter 5 */
if (group == CBS_DATA_CODING_LANG_GSM7) {
cbm_part->encoding = MM_SMS_ENCODING_GSM7;
cbm_part->language = mm_cbm_part_coding_group_to_language (pdu[offset]);
} else if (pdu[offset] == CBS_DATA_CODING_GSM7) {
has_lang = TRUE;
PDU_SIZE_CHECK (offset + 4, "cannot skip lang");
offset += 3;
cbm_part->encoding = MM_SMS_ENCODING_GSM7;
} else if (pdu[offset] == CBS_DATA_CODING_UCS2) {
has_7bit_lang = TRUE;
PDU_SIZE_CHECK (offset + 3, "cannot skip lang");
offset += 2;
cbm_part->encoding = MM_SMS_ENCODING_UCS2;
} else if (group == CBS_DATA_CODING_OTHER) {
switch (group) {
case CBS_DATA_CODING_OTHER_CZECH:
cbm_part->encoding = MM_SMS_ENCODING_GSM7;
cbm_part->language = g_strdup ("cs");
break;
case CBS_DATA_CODING_OTHER_HEBREW:
cbm_part->encoding = MM_SMS_ENCODING_UCS2;
cbm_part->language = g_strdup ("he");
break;
case CBS_DATA_CODING_OTHER_ARABIC:
cbm_part->encoding = MM_SMS_ENCODING_UCS2;
cbm_part->language = g_strdup ("ar");
break;
case CBS_DATA_CODING_OTHER_RUSSIAN:
cbm_part->encoding = MM_SMS_ENCODING_UCS2;
cbm_part->language = g_strdup ("ru");
break;
case CBS_DATA_CODING_OTHER_ICELANDIC:
cbm_part->encoding = MM_SMS_ENCODING_GSM7;
cbm_part->language = g_strdup ("is");
break;
default:
cbm_part->encoding = MM_SMS_ENCODING_GSM7;
}
} else if (group == CBS_DATA_CODING_UNSPECIFIED) {
cbm_part->encoding = MM_SMS_ENCODING_GSM7;
} else if ((group == CBS_DATA_CODING_GENERAL_CLASS) ||
(group == CBS_DATA_CODING_GENERAL_NO_CLASS) ||
(group == CBS_DATA_CODING_UDH)) {
@@ -225,9 +154,8 @@ mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
cbm_part->encoding = MM_SMS_ENCODING_GSM7;
else if (charset == CBS_DATA_CODING_GENERAL_UCS2)
cbm_part->encoding = MM_SMS_ENCODING_UCS2;
}
if (cbm_part->encoding == MM_SMS_ENCODING_UNKNOWN) {
} else {
mm_cbm_part_free (cbm_part);
g_set_error (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
@@ -242,45 +170,12 @@ mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
cbm_part->part_num = (pdu[offset] & 0xF0) >> 4;
offset++;
if (has_lang) {
PDU_SIZE_CHECK (offset + 4, "cannot read lang");
if (pdu[offset+2] != '\r') {
g_set_error_literal (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Failed to parse lang");
return NULL;
}
cbm_part->language = g_strdup_printf ("%c%c", pdu[offset], pdu[offset+1]);
offset += 3;
} else if (has_7bit_lang) {
PDU_SIZE_CHECK (offset + 3, "cannot read 7bit lang");
cbm_part->language = mm_sms_decode_text (&pdu[offset],
2,
MM_SMS_ENCODING_GSM7,
0,
log_object,
NULL);
if (!cbm_part->language) {
g_set_error_literal (error,
MM_CORE_ERROR,
MM_CORE_ERROR_FAILED,
"Failed to parse lang");
return NULL;
}
offset += 2;
}
switch (cbm_part->encoding) {
case MM_SMS_ENCODING_GSM7:
len = ((pdu_len - offset) * 8) / 7;
break;
case MM_SMS_ENCODING_UCS2:
len = pdu_len - offset;
/* UCS2 must be even number of bytes but some messages
* eg from 'il' have trailing 00 */
if (len % 2)
len--;
break;
case MM_SMS_ENCODING_8BIT:
case MM_SMS_ENCODING_UNKNOWN:
@@ -295,11 +190,12 @@ mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
log_object,
error);
if (!text) {
mm_cbm_part_free (cbm_part);
return NULL;
}
cbm_part->text = g_steal_pointer (&text);
return g_steal_pointer (&cbm_part);
return cbm_part;
}
MMCbmPart *
@@ -311,7 +207,6 @@ mm_cbm_part_new (void)
void
mm_cbm_part_free (MMCbmPart *part)
{
g_clear_pointer (&part->language, g_free);
g_clear_pointer (&part->text, g_free);
g_slice_free (MMCbmPart, part);
}
@@ -328,4 +223,3 @@ PART_GET_FUNC (guint, num_parts)
PART_GET_FUNC (const char *, text)
PART_GET_FUNC (guint16, channel)
PART_GET_FUNC (guint16, serial)
PART_GET_FUNC (const char *, language)
-3
View File
@@ -59,14 +59,11 @@ MMCbmPart *mm_cbm_part_new_from_binary_pdu (const guint8 *pdu,
MMCbmPart *mm_cbm_part_new (void);
void mm_cbm_part_free (MMCbmPart *part);
G_DEFINE_AUTOPTR_CLEANUP_FUNC (MMCbmPart, mm_cbm_part_free)
guint mm_cbm_part_get_part_num (MMCbmPart *part);
guint mm_cbm_part_get_num_parts (MMCbmPart *part);
const char *mm_cbm_part_get_text (MMCbmPart *part);
guint16 mm_cbm_part_get_serial (MMCbmPart *part);
guint16 mm_cbm_part_get_channel (MMCbmPart *part);
const char *mm_cbm_part_get_language (MMCbmPart *part);
#endif
+5 -6
View File
@@ -27,7 +27,6 @@
#include "mm-plugin.h"
#include "mm-log-object.h"
#include "mm-daemon-enums-types.h"
#include "mm-bind.h"
static void log_object_iface_init (MMLogObjectInterface *iface);
@@ -342,7 +341,7 @@ unexport_modem (MMDevice *self)
if (path != NULL) {
g_dbus_object_manager_server_unexport (self->priv->object_manager, path);
g_object_set (self->priv->modem,
MM_BINDABLE_CONNECTION, NULL,
MM_BASE_MODEM_CONNECTION, NULL,
NULL);
mm_obj_dbg (self, "unexported modem from path '%s'", path);
g_free (path);
@@ -390,7 +389,7 @@ export_modem (MMDevice *self)
path = g_strdup_printf (MM_DBUS_MODEM_PREFIX "/%d", mm_base_modem_get_dbus_id (self->priv->modem));
g_object_set (self->priv->modem,
"g-object-path", path,
MM_BINDABLE_CONNECTION, connection,
MM_BASE_MODEM_CONNECTION, connection,
NULL);
g_dbus_object_manager_server_export (self->priv->object_manager,
@@ -437,7 +436,7 @@ mm_device_initialize_modem (MMDevice *self)
mm_obj_dbg (self, "modem initializing...");
mm_base_modem_initialize (modem,
MM_OPERATION_LOCK_REQUIRED,
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
(GAsyncReadyCallback)initialize_ready,
g_object_ref (self));
}
@@ -869,8 +868,8 @@ mm_device_inhibit (MMDevice *self,
* an exclusive lock marked as override, so the modem object will not
* allow any additional lock request any more. */
mm_base_modem_disable (self->priv->modem,
MM_OPERATION_LOCK_REQUIRED,
MM_OPERATION_PRIORITY_OVERRIDE,
MM_BASE_MODEM_OPERATION_LOCK_REQUIRED,
MM_BASE_MODEM_OPERATION_PRIORITY_OVERRIDE,
(GAsyncReadyCallback)inhibit_disable_ready,
task);
}
+12 -25
View File
@@ -31,6 +31,8 @@
#endif
#define OPERATION_DESCRIPTION "connection status report"
#define CONNECTED_STRING "connected"
#define DISCONNECTED_STRING "disconnected"
/* Maximum time a connection dispatcher command is allowed to run before
* us killing it */
@@ -49,30 +51,15 @@ G_DEFINE_TYPE (MMDispatcherConnection, mm_dispatcher_connection, MM_TYPE_DISPATC
/*****************************************************************************/
typedef struct {
gchar *modem_dbus_path;
gchar *bearer_dbus_path;
gchar *data_port;
MMDispatcherConnectionEvent event;
GList *dispatcher_scripts;
GFile *current;
guint n_failures;
gchar *modem_dbus_path;
gchar *bearer_dbus_path;
gchar *data_port;
gboolean connected;
GList *dispatcher_scripts;
GFile *current;
guint n_failures;
} ConnectionRunContext;
static gchar *
mm_dispatcher_connection_event_to_string (MMDispatcherConnectionEvent event)
{
switch (event) {
case MM_DISPATCHER_CONNECTION_EVENT_CONNECTED:
return g_strdup ("connected");
case MM_DISPATCHER_CONNECTION_EVENT_DISCONNECTED:
return g_strdup ("disconnected");
case MM_DISPATCHER_CONNECTION_EVENT_DISCONNECT_REQUEST:
return g_strdup ("disconnect-request");
default:
return NULL;
}
}
static void
connection_run_context_free (ConnectionRunContext *ctx)
{
@@ -150,7 +137,7 @@ connection_run_next (GTask *task)
g_ptr_array_add (aux, g_strdup (ctx->modem_dbus_path));
g_ptr_array_add (aux, g_strdup (ctx->bearer_dbus_path));
g_ptr_array_add (aux, g_strdup (ctx->data_port));
g_ptr_array_add (aux, mm_dispatcher_connection_event_to_string (ctx->event));
g_ptr_array_add (aux, g_strdup (ctx->connected ? CONNECTED_STRING : DISCONNECTED_STRING));
g_ptr_array_add (aux, NULL);
argv = (GStrv) g_ptr_array_free (aux, FALSE);
@@ -181,7 +168,7 @@ mm_dispatcher_connection_run (MMDispatcherConnection *self,
const gchar *modem_dbus_path,
const gchar *bearer_dbus_path,
const gchar *data_port,
MMDispatcherConnectionEvent event,
gboolean connected,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
@@ -200,7 +187,7 @@ mm_dispatcher_connection_run (MMDispatcherConnection *self,
ctx->modem_dbus_path = g_strdup (modem_dbus_path);
ctx->bearer_dbus_path = g_strdup (bearer_dbus_path);
ctx->data_port = g_strdup (data_port);
ctx->event = event;
ctx->connected = connected;
g_task_set_task_data (task, ctx, (GDestroyNotify)connection_run_context_free);
/* Iterate over all enabled dirs and collect all dispatcher script paths */
+1 -7
View File
@@ -32,19 +32,13 @@ typedef struct _MMDispatcherConnection MMDispatcherConnection;
typedef struct _MMDispatcherConnectionClass MMDispatcherConnectionClass;
typedef struct _MMDispatcherConnectionPrivate MMDispatcherConnectionPrivate;
typedef enum { /*< underscore_name=mm_dispatcher_connection_event >*/
MM_DISPATCHER_CONNECTION_EVENT_CONNECTED,
MM_DISPATCHER_CONNECTION_EVENT_DISCONNECTED,
MM_DISPATCHER_CONNECTION_EVENT_DISCONNECT_REQUEST,
} MMDispatcherConnectionEvent;
GType mm_dispatcher_connection_get_type (void);
MMDispatcherConnection *mm_dispatcher_connection_get (void);
void mm_dispatcher_connection_run (MMDispatcherConnection *self,
const gchar *modem_dbus_path,
const gchar *bearer_dbus_path,
const gchar *data_port,
MMDispatcherConnectionEvent event,
gboolean connected,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data);

Some files were not shown because too many files have changed in this diff Show More