Commit Graph
3559 Commits
Author SHA1 Message Date
Aleksander Morgado 38f6e4eec9 broadband-modem-mbim: fix segfault when loading capabilities
If loading capabilities using QMI over MBIM returns NONE without an
explicit error, the process would crash. Fix that by making the error
optional when NONE is received.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/185
2020-03-16 09:58:08 +01:00
Aleksander Morgado b9e6f30ba8 kerneldevice,udev: don't assume interface is the direct parent object
E.g. it may be one more layer up:

  looking at device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1/ttyUSB1/tty/ttyUSB1':
    KERNEL=="ttyUSB1"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1/ttyUSB1':
    KERNELS=="ttyUSB1"
    SUBSYSTEMS=="usb-serial"
    DRIVERS=="option1"
    ATTRS{port_number}=="0"

  looking at parent device '/devices/pci0000:00/0000:00:14.0/usb1/1-8/1-8.4/1-8.4:1.1':
    KERNELS=="1-8.4:1.1"
    SUBSYSTEMS=="usb"
    DRIVERS=="option"
    ATTRS{bNumEndpoints}=="02"
    ATTRS{supports_autosuspend}=="1"
    ATTRS{bInterfaceNumber}=="01"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceSubClass}=="06"
    ATTRS{bInterfaceProtocol}=="13"
    ATTRS{interface}=="Huawei Mobile Connect - Application"
    ATTRS{bInterfaceClass}=="ff"
    ATTRS{authorized}=="1"
2020-03-03 17:23:07 +00:00
Aleksander Morgado 9ef84d2cff kerneldevice: support reading interface 'description' 2020-03-03 17:23:07 +00:00
Aleksander Morgado fd052c8e58 base-sim: don't allow sending PIN/PUK if not required
This avoids issues when e.g. sending SIM-PIN while the modem is
already unlocked or when SIM-PIN is not enabled.

Under those conditions, the needlessly sent SIM-PIN unlock attempt may
fail while libmm-glib/mmcli reports a successful operation. E.g.:

  # mmcli --sim=/org/freedesktop/ModemManager1/SIM/0 --pin=3497
  successfully sent PIN code to the SIM

But in reality...

  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: <debug> [1574260732.489513] Verifying PIN...
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] sent message...
  <<<<<< RAW:
  <<<<<<   length = 27
  <<<<<<   data   = 01:1A:00:00:0B:02:00:09:00:26:00:0E:00:02:06:00:01:04:33:34:39:37:01:02:00:06:00
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] sent generic request (translated)...
  <<<<<< QMUX:
  <<<<<<   length  = 26
  <<<<<<   flags   = 0x00
  <<<<<<   service = "uim"
  <<<<<<   client  = 2
  <<<<<< QMI:
  <<<<<<   flags       = "none"
  <<<<<<   transaction = 9
  <<<<<<   tlv_length  = 14
  <<<<<<   message     = "Verify PIN" (0x0026)
  <<<<<< TLV:
  <<<<<<   type       = "Info" (0x02)
  <<<<<<   length     = 6
  <<<<<<   value      = 01:04:33:34:39:37
  <<<<<<   translated = [ pin_id = 'pin1' pin_value = '3497' ]
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] received message...
  <<<<<< RAW:
  <<<<<<   length = 30
  <<<<<<   data   = 01:1D:00:80:0B:02:02:09:00:26:00:11:00:02:04:00:01:00:52:00:13:02:00:69:84:10:02:00:03:0A
  Wed Nov 20 14:38:52 2019 daemon.debug [4254]: [/dev/cdc-wdm0] received generic response (translated)...
  <<<<<< QMUX:
  <<<<<<   length  = 29
  <<<<<<   flags   = 0x80
  <<<<<<   service = "uim"
  <<<<<<   client  = 2
  <<<<<< QMI:
  <<<<<<   flags       = "response"
  <<<<<<   transaction = 9
  <<<<<<   tlv_length  = 17
  <<<<<<   message     = "Verify PIN" (0x0026)
  <<<<<< TLV:
  <<<<<<   type       = "Result" (0x02)
  <<<<<<   length     = 4
  <<<<<<   value      = 01:00:52:00
  <<<<<<   translated = FAILURE: AccessDenied

As we already know what the current lock status is, just abort the
user operation if the unlock operation isn't required.
2020-02-12 09:41:10 +00:00
Aleksander Morgado 9f192be632 iface-modem: allow loading current required lock info 2020-02-12 09:41:10 +00:00
Aleksander Morgado 634bb1caac base-sim: avoid using 'self' to refer to the modem 2020-02-12 09:41:10 +00:00
Aleksander Morgado b6add18157 iface-modem-simple: don't abort connection attempt if SIM-PUK2 locked 2020-02-12 09:41:10 +00:00
Aleksander Morgado 94025aad6c base-sim: refactor common PIN/PUK unlock operations
Keep the saved GError directly as GTask context, instead of allocating
the SendPinPukContext unconditionally.
2020-02-12 09:41:10 +00:00
Aleksander Morgado 00dc961cad iface-modem-location: common helper code to test raw gps 2020-02-07 14:42:16 +00:00
Aleksander Morgado a61caff747 iface-modem-location: plug memleaks when updating gps raw variant
The helper method returning a variant from a MMLocationGpsRaw would
return already a full variant reference instead of a floating one, so
we were really increasing the refcount when doing g_variant_ref_sink()
in the location interface.

Fix this by consolidating all helper methods in libmm-glib that return
variants from the different MMLocationXX objects, so that they all
return full variants instead of floating ones.
2020-02-07 14:42:16 +00:00
Bob Ham a7a8fc909a broadband-modem: add optional extra carriage return to in-call URC regex
The BroadMobi BM818 has inconsitent line endings and the in-call URC
regex can miss events, particularly NO CARRIER, because the regex
doesn't match.  To fix this we add an optional carriage return to the
regex.  This will match for the BM818's output.
2020-02-06 15:16:46 +00:00
Bob Ham 38d7cc6683 broadband-modem: add secondary AT port to in-call port context
The BroadMobi BM818 sends URCs on the secondary port which are
currently missed.  To fix this, we include the secondary port in the
port context.
2020-02-06 15:16:46 +00:00
Bob Ham e128210a27 iface-modem-voice: report calls only if +CLCC was successful
The BroadMobi BM818 can time out with +CLCC calls.  When this happens,
active calls are terminated due to reporting an empty list.  To fix
this, we only report the call list if the +CLCC didn't result in an
error.
2020-02-06 15:16:46 +00:00
Bob Ham 2c9760af66 iface-modem-voice: log details when ending call missing from call list
If a call is missing from the +CLCC call list and terminated because
of that, add a debugging statement to log the call details.
2020-02-06 15:16:30 +00:00
Bob Ham b5d4f045d8 iface-modem-voice: match calls in call list by number
Outgoing calls which ring before the first +CLCC response cannot match
on the direction/state and are terminated, at least on the BroadMobi
BM818.  For example:

<debug> 1 calls being established: call list polling required
<debug> (ttyUSB1) device open count is 3 (open)
<debug> (ttyUSB1): --> 'AT+CLCC<CR>'
<debug> (ttyUSB1): <-- '<CR><LF>+CLCC: 1,1,0,1,0,"",128<CR><LF>+CLCC: 2,0,3,0,0,"07763578094",129<CR><LF><CR><LF>OK<CR><LF>'
<debug> Reported 2 ongoing calls
<debug> call at index 1: direction incoming, state active, number n/a
<debug> call at index 2: direction outgoing, state ringing-out, number 07763578094
<info>  Call state changed: dialing -> terminated (unknown)
<warn>  unexpected incoming call to number 'n/a' reported in call list: state active
<warn>  unexpected outgoing call to number '07763578094' reported in call list: state ringing-out

To fix this, we match calls in a +CLCC call list by number as
well.
2020-02-06 15:16:00 +00:00
Aleksander Morgado a8fd33ebaa port-qmi: fallback to raw-ip if WDA Get Data Format requests arguments
New devices return a "Missing Argument" error in WDA Get Data Format,
requiring the use of the "Endpoint info" TLV. Given that all these new
devices are raw-ip only anyway, let's use this error to right away
fallback to require raw-ip in the interface.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/177
2020-02-01 12:52:30 +01:00
Aleksander Morgado 2020f1f2e7 port-serial-qcdm: rewrite condition to make it more readable
The logic is the same.
2020-01-31 15:18:35 +01:00
Aleksander Morgado 9e24226364 port-probe: MMPortProbeAtCommand always has constant command strings 2020-01-31 15:18:35 +01:00
Aleksander Morgado accd1a5841 base-modem: define new helper MMBaseModemAtCommandAlloc
It has the same exact format as MMBaseModemAtCommand, but its contents
are assumed heap allocated.

The only real purpose of this type is to allow defining static
constant MMBaseModemAtCommand variables without warnings when using
-Wdiscarded-qualifiers.
2020-01-31 15:18:35 +01:00
Aleksander Morgado bbeabb495e helpers: new macro to CLAMP high threshold only
Useful when clamping a unsigned integer with low threshold set to 0,
which would give us compiler warnings with -Wtype-limits when using
CLAMP(), e.g.:

  via/mm-broadband-modem-via.c: In function ‘handle_evdo_quality_change’:
  /usr/include/glib-2.0/glib/gmacros.h:811:63: error: comparison of unsigned expression < 0 is always false [-Werror=type-limits]
    811 | #define CLAMP(x, low, high)  (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
        |                                                               ^
  via/mm-broadband-modem-via.c:284:19: note: in expansion of macro ‘CLAMP’
    284 |         quality = CLAMP (quality, 0, 100);
        |                   ^~~~~
2020-01-31 15:18:35 +01:00
Aleksander Morgado 6cb9dc07dc broadband-modem-qmi,helpers-qmi: add missing 5GNR access tech enums
Not adding full 5GNR support in ModemManager yet, just the enums in
QMI so that we don't fail building with -Wswitch-enum.
2020-01-31 14:52:49 +01:00
Aleksander Morgado af2bea5a54 broadband-modem-mbim: avoid using the deprecated mm_pco_list_free() 2020-01-31 14:52:49 +01:00
Aleksander Morgado 808f823451 sim-qmi: avoid using deprecated libqmi declarations
Let's use the suggested compat symbols instead, provided in libqmi 1.22.

  mm-sim-qmi.c: In function ‘uim_read’:
  mm-sim-qmi.c:170:5: error: ‘qmi_message_uim_read_transparent_input_set_session_information’ is deprecated: Use 'qmi_message_uim_read_transparent_input_set_session' instead [-Werror=deprecated-declarations]
    170 |     qmi_message_uim_read_transparent_input_set_session_information (
        |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  In file included from /usr/include/libqmi-glib/libqmi-glib.h:40,
                   from mm-port-qmi.h:23,
                   from mm-base-modem.h:39,
                   from mm-base-sim.h:25,
                   from mm-sim-qmi.h:22,
                   from mm-sim-qmi.c:29:
  /usr/include/libqmi-glib/qmi-compat.h:1154:10: note: declared here
   1154 | gboolean qmi_message_uim_read_transparent_input_set_session_information (
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ...
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7075e852ca test-error-helpers: fix warnings with -Wsign-compare
test-error-helpers.c: In function ‘test_error_helpers_connection_error’:
  test-error-helpers.c:36:39: error: comparison of integer expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ {aka ‘int’} [-Werror=sign-compare]
     36 |       for (i = enum_class->minimum; i <= enum_class->maximum; i++) {        \
        |                                       ^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7125a86e04 test-qcdm-serial-port: fix warnings with -Wsign-compare
test-qcdm-serial-port.c: In function ‘print_buf’:
  test-qcdm-serial-port.c:79:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘gsize’ {aka ‘long unsigned int’} [-Werror=sign-compare]
     79 |     for (i = 0; i < len; i++) {
        |                   ^
  test-qcdm-serial-port.c: In function ‘server_wait_request’:
  test-qcdm-serial-port.c:163:20: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
    163 |     } while (total < sizeof (readbuf));
        |                    ^
2020-01-31 14:52:49 +01:00
Aleksander Morgado 9ad6e1f633 test-modem-helpers: fix warnings with -Wswitch-enum
test-modem-helpers.c: In function ‘test_cgev_indication’:
  test-modem-helpers.c:2165:9: error: enumeration value ‘MM_3GPP_CGEV_UNKNOWN’ not handled in switch [-Werror=switch-enum]
   2165 |         switch (type) {
        |         ^~~~~~
  cc1: all warnings being treated as errors
2020-01-31 14:52:49 +01:00
Aleksander Morgado a27c957dc5 test-modem-helpers: fix warnings with -Wsign-compare
test-modem-helpers.c: In function ‘test_creg_match’:
  test-modem-helpers.c:1127:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   1127 |     for (i = 0; i < array->len; i++) {
        |                   ^
2020-01-31 14:52:49 +01:00
Aleksander Morgado 6dcbda1c80 test-modem-helpers: fix warnings with -Wdiscarded-qualifiers
test-modem-helpers.c: In function ‘test_cmgl_response_generic’:
  test-modem-helpers.c:294:20: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
    294 |             .pdu = "07914306073011F00405812261F700003130916191314095C27"
        |                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  ...
2020-01-31 14:52:49 +01:00
Aleksander Morgado 0e59b9ec90 kernel-device-udev: fix warnings with -Wshadow
kerneldevice/mm-kernel-device-udev.c: In function ‘mm_kernel_device_udev_new_from_properties’:
  kerneldevice/mm-kernel-device-udev.c:770:70: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow]
    770 | mm_kernel_device_udev_new_from_properties (MMKernelEventProperties  *properties,
        |                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
  kerneldevice/mm-kernel-device-udev.c:38:20: note: shadowed declaration is here
     38 | static GParamSpec *properties[PROP_LAST];
        |                    ^~~~~~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado b20d538418 kernel-device-generic-rules: fix warnings with -Wswitch-default
kerneldevice/mm-kernel-device-generic-rules.c: In function ‘udev_rule_clear’:
  kerneldevice/mm-kernel-device-generic-rules.c:40:5: error: switch missing default case [-Werror=switch-default]
     40 |     switch (rule->result.type) {
        |     ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado a13d0102c1 kernel-device-generic: fix warnings with -Wshadow
kerneldevice/mm-kernel-device-generic.c: In function ‘mm_kernel_device_generic_new_with_rules’:
  kerneldevice/mm-kernel-device-generic.c:954:68: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow]
    954 | mm_kernel_device_generic_new_with_rules (MMKernelEventProperties  *properties,
        |                                          ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
  kerneldevice/mm-kernel-device-generic.c:46:20: note: shadowed declaration is here
     46 | static GParamSpec *properties[PROP_LAST];
        |                    ^~~~~~~~~~
  kerneldevice/mm-kernel-device-generic.c: In function ‘mm_kernel_device_generic_new’:
  kerneldevice/mm-kernel-device-generic.c:971:57: error: declaration of ‘properties’ shadows a global declaration [-Werror=shadow]
    971 | mm_kernel_device_generic_new (MMKernelEventProperties  *properties,
        |                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
  kerneldevice/mm-kernel-device-generic.c:46:20: note: shadowed declaration is here
     46 | static GParamSpec *properties[PROP_LAST];
        |                    ^~~~~~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado ba53d2c29f kernel-device-generic: fix warnings with -Wswitch-default
kerneldevice/mm-kernel-device-generic.c: In function ‘check_rule’:
  kerneldevice/mm-kernel-device-generic.c:802:9: error: switch missing default case [-Werror=switch-default]
    802 |         switch (rule->result.type) {
        |         ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado f5fa268411 modem-helpers-mbim: fix warnings with -Wswitch-enum
mm-modem-helpers-mbim.c: In function ‘mm_mobile_equipment_error_from_mbim_nw_error’:
  mm-modem-helpers-mbim.c:206:5: error: enumeration value ‘MBIM_NW_ERROR_IMEI_NOT_ACCEPTED’ not handled in switch [-Werror=switch-enum]
    206 |     switch (nw_error) {
        |     ^~~~~~
  mm-modem-helpers-mbim.c: In function ‘mm_bearer_ip_family_from_mbim_context_ip_type’:
  mm-modem-helpers-mbim.c:403:5: error: enumeration value ‘MBIM_CONTEXT_IP_TYPE_DEFAULT’ not handled in switch [-Werror=switch-enum]
    403 |     switch (ip_type) {
        |     ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado fa2330cba4 modem-helpers-mbim: fix warnings with -Wswitch-default
mm-modem-helpers-mbim.c: In function ‘mm_modem_lock_from_mbim_pin_type’:
  mm-modem-helpers-mbim.c:49:5: error: switch missing default case [-Werror=switch-default]
     49 |     switch (pin_type) {
        |     ^~~~~~
  mm-modem-helpers-mbim.c: In function ‘mm_sms_state_from_mbim_message_status’:
  mm-modem-helpers-mbim.c:425:5: error: switch missing default case [-Werror=switch-default]
    425 |     switch (status) {
        |     ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 911a763a55 modem-helpers-qmi: fix warnings with -Wlogical-op
mm-modem-helpers-qmi.c: In function ‘mm_modem_capability_from_qmi_capabilities_context’:
  mm-modem-helpers-qmi.c:1455:31: error: logical ‘and’ of equal expressions [-Werror=logical-op]
   1455 |     else if (ctx->nas_tp_mask && (ctx->nas_tp_mask != QMI_NAS_RADIO_TECHNOLOGY_PREFERENCE_AUTO))
        |                               ^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 9bd54e76fc modem-helpers-qmi: fix warnings with -Wsign-compare
mm-modem-helpers-qmi.c: In function ‘mm_qmi_unique_id_to_firmware_unique_id’:
  mm-modem-helpers-qmi.c:1653:19: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   1653 |     for (i = 0; i < qmi_unique_id->len; i++) {
        |                   ^
  mm-modem-helpers-qmi.c:1679:11: error: comparison of integer expressions of different signedness: ‘gint’ {aka ‘int’} and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
   1679 |     if (i != qmi_unique_id->len)
        |           ^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7c900c51b5 modem-helpers-qmi: fix warnings with -Wswitch-enum
mm-modem-helpers-qmi.c: In function ‘mm_3gpp_facility_to_qmi_uim_facility’:
  mm-modem-helpers-qmi.c:137:5: error: enumeration value ‘MM_MODEM_3GPP_FACILITY_NONE’ not handled in switch [-Werror=switch-enum]
    137 |     switch (mm) {
        |     ^~~~~~
  mm-modem-helpers-qmi.c:137:5: error: enumeration value ‘MM_MODEM_3GPP_FACILITY_SIM’ not handled in switch [-Werror=switch-enum]
  mm-modem-helpers-qmi.c:137:5: error: enumeration value ‘MM_MODEM_3GPP_FACILITY_FIXED_DIALING’ not handled in switch [-Werror=switch-enum]
  mm-modem-helpers-qmi.c:137:5: error: enumeration value ‘MM_MODEM_3GPP_FACILITY_PH_FSIM’ not handled in switch [-Werror=switch-enum]
  ...
2020-01-31 14:52:49 +01:00
Aleksander Morgado 40327b1b48 sms-part-cdma: fix warnings with -Wswitch-default
mm-sms-part-cdma.c: In function ‘mm_sms_part_cdma_new_from_binary_pdu’:
  mm-sms-part-cdma.c:1138:5: error: switch missing default case [-Werror=switch-default]
   1138 |     switch (message_type) {
        |     ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado a5c0a7849a sms-part-3gpp: fix warnings with -Wswitch-enum
mm-sms-part-3gpp.c: In function ‘mm_sms_part_3gpp_new_from_binary_pdu’:
  mm-sms-part-3gpp.c:721:9: error: enumeration value ‘MM_SMS_ENCODING_8BIT’ not handled in switch [-Werror=switch-enum]
    721 |         switch (user_data_encoding) {
        |         ^~~~~~
  mm-sms-part-3gpp.c: In function ‘mm_sms_part_3gpp_get_submit_pdu’:
  mm-sms-part-3gpp.c:917:5: error: enumeration value ‘MM_SMS_ENCODING_UNKNOWN’ not handled in switch [-Werror=switch-enum]
    917 |     switch (mm_sms_part_get_encoding (part)) {
        |     ^~~~~~
  mm-sms-part-3gpp.c:917:5: error: enumeration value ‘MM_SMS_ENCODING_8BIT’ not handled in switch [-Werror=switch-enum]
2020-01-31 14:52:49 +01:00
Aleksander Morgado 6a7b1e7b8c sms-part-3gpp: fix warnings with -Wswitch-enum
mm-sms-part-3gpp.c: In function ‘mm_sms_part_3gpp_new_from_binary_pdu’:
  mm-sms-part-3gpp.c:607:9: error: enumeration value ‘MM_SMS_ENCODING_UNKNOWN’ not handled in switch [-Werror=switch-enum]
    607 |         switch (user_data_encoding) {
        |         ^~~~~~
  mm-sms-part-3gpp.c:714:9: error: enumeration value ‘MM_SMS_ENCODING_UNKNOWN’ not handled in switch [-Werror=switch-enum]
    714 |         switch (user_data_encoding) {
        |         ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 5eedad988e sms-part-3gpp: fix warnings with -Wswitch-default
mm-sms-part-3gpp.c: In function ‘sms_encoding_type’:
  mm-sms-part-3gpp.c:190:13: error: switch missing default case [-Werror=switch-default]
    190 |             switch (dcs & 0x0c) {
        |             ^~~~~~
  mm-sms-part-3gpp.c:219:13: error: switch missing default case [-Werror=switch-default]
    219 |             switch (dcs & 0x04) {
        |             ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 6dfb9d7a7e charsets: fix warnings with -Wswitch-default
mm-charsets.c: In function ‘mm_charset_take_and_convert_to_utf8’:
  mm-charsets.c:730:5: error: switch missing default case [-Werror=switch-default]
    730 |     switch (charset) {
        |     ^~~~~~
  mm-charsets.c: In function ‘mm_utf8_take_and_convert_to_charset’:
  mm-charsets.c:852:5: error: switch missing default case [-Werror=switch-default]
    852 |     switch (charset) {
        |     ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 7619148aa5 charsets: fix warnings with -Wsign-compare
mm-charsets.c: In function ‘mm_charset_gsm_unpacked_to_utf8’:
  mm-charsets.c:423:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
    423 |     for (i = 0; i < len; i++) {
        |                   ^
  mm-charsets.c: In function ‘pccp437_is_subset’:
  mm-charsets.c:544:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
    544 |     for (i = 0; i < G_N_ELEMENTS (t); i++) {
        |                   ^
  mm-charsets.c: In function ‘pcdn_is_subset’:
  mm-charsets.c:575:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Werror=sign-compare]
    575 |     for (i = 0; i < sizeof (t) / sizeof (t[0]); i++) {
        |                   ^
  mm-charsets.c: In function ‘mm_charset_gsm_unpack’:
  mm-charsets.c:657:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
    657 |     for (i = 0; i < num_septets; i++) {
        |                   ^
  mm-charsets.c: In function ‘mm_charset_gsm_pack’:
  mm-charsets.c:701:42: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint32’ {aka ‘unsigned int’} [-Werror=sign-compare]
    701 |     for (i = 0, lshift = start_offset; i < src_len; i++) {
        |                                          ^
2020-01-31 14:52:49 +01:00
Aleksander Morgado 623443d50f modem-helpers: fix warnings with -Wswitch-enum
mm-modem-helpers.c: In function ‘mm_3gpp_get_pdp_type_from_ip_family’:
  mm-modem-helpers.c:4166:5: error: enumeration value ‘MM_BEARER_IP_FAMILY_NONE’ not handled in switch [-Werror=switch-enum]
   4166 |     switch (family) {
        |     ^~~~~~
  mm-modem-helpers.c:4166:5: error: enumeration value ‘MM_BEARER_IP_FAMILY_ANY’ not handled in switch [-Werror=switch-enum]
2020-01-31 14:52:49 +01:00
Aleksander Morgado 520a7ec7db modem-helpers: fix warnings with -Wdiscarded-qualifiers
mm-modem-helpers.c:4019:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4019 |     { MM_MODEM_3GPP_FACILITY_SIM,           "SC" },
        |                                             ^~~~
  mm-modem-helpers.c:4020:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4020 |     { MM_MODEM_3GPP_FACILITY_PH_SIM,        "PS" },
        |                                             ^~~~
  mm-modem-helpers.c:4021:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4021 |     { MM_MODEM_3GPP_FACILITY_PH_FSIM,       "PF" },
        |                                             ^~~~
  mm-modem-helpers.c:4022:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4022 |     { MM_MODEM_3GPP_FACILITY_FIXED_DIALING, "FD" },
        |                                             ^~~~
  mm-modem-helpers.c:4023:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4023 |     { MM_MODEM_3GPP_FACILITY_NET_PERS,      "PN" },
        |                                             ^~~~
  mm-modem-helpers.c:4024:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4024 |     { MM_MODEM_3GPP_FACILITY_NET_SUB_PERS,  "PU" },
        |                                             ^~~~
  mm-modem-helpers.c:4025:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4025 |     { MM_MODEM_3GPP_FACILITY_PROVIDER_PERS, "PP" },
        |                                             ^~~~
  mm-modem-helpers.c:4026:45: error: initialization discards ‘const’ qualifier from pointer target type [-Werror=discarded-qualifiers]
   4026 |     { MM_MODEM_3GPP_FACILITY_CORP_PERS,     "PC" }
        |                                             ^~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 1f94d3f5f8 modem-helpers: fix warnings with -Wsign-compare
mm-modem-helpers.c: In function ‘parse_uint’:
  mm-modem-helpers.c:1953:36: error: comparison of integer expressions of different signedness: ‘gulong’ {aka ‘long unsigned int’} and ‘glong’ {aka ‘long int’} [-Werror=sign-compare]
   1953 |         if ((nmin == nmax) || (ret >= nmin && ret <= nmax))
        |                                    ^~
  mm-modem-helpers.c:1953:51: error: comparison of integer expressions of different signedness: ‘gulong’ {aka ‘long unsigned int’} and ‘glong’ {aka ‘long int’} [-Werror=sign-compare]
   1953 |         if ((nmin == nmax) || (ret >= nmin && ret <= nmax))
        |                                                   ^~
2020-01-31 14:52:49 +01:00
Aleksander Morgado 02e5015b5c port-qmi: fix warnings with -Wimplicit-fallthrough
mm-port-qmi.c:353:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    353 |         ctx->step++;
        |         ~~~~~~~~~^~
  mm-port-qmi.c:356:5: note: here
    356 |     case PORT_OPEN_STEP_CHECK_OPENING:
        |     ^~~~
  mm-port-qmi.c:366:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    366 |         ctx->step++;
        |         ~~~~~~~~~^~
  mm-port-qmi.c:369:5: note: here
    369 |     case PORT_OPEN_STEP_CHECK_ALREADY_OPEN:
        |     ^~~~
  mm-port-qmi.c:376:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    376 |         ctx->step++;
        |         ~~~~~~~~~^~
  mm-port-qmi.c:379:5: note: here
    379 |     case PORT_OPEN_STEP_DEVICE_NEW: {
        |     ^~~~
  mm-port-qmi.c:424:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    424 |         ctx->step++;
        |         ~~~~~~~~~^~
  mm-port-qmi.c:427:5: note: here
    427 |     case PORT_OPEN_STEP_ALLOCATE_WDA_CLIENT:
        |     ^~~~
  mm-port-qmi.c:474:18: error: this statement may fall through [-Werror=implicit-fallthrough=]
    474 |         ctx->step++;
        |         ~~~~~~~~~^~
  mm-port-qmi.c:477:5: note: here
    477 |     case PORT_OPEN_STEP_SET_KERNEL_DATA_FORMAT:
        |     ^~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado a4b5419287 port-qmi: fix warnings with -Wswitch-default
mm-port-qmi.c: In function ‘port_open_step’:
  mm-port-qmi.c:350:5: error: switch missing default case [-Werror=switch-default]
    350 |     switch (ctx->step) {
        |     ^~~~~~
2020-01-31 14:52:49 +01:00
Aleksander Morgado afc314e596 port-serial-qcdm: fix warnings with -Wsign-compare
mm-port-serial-qcdm.c: In function ‘find_qcdm_start’:
  mm-port-serial-qcdm.c:51:19: error: comparison of integer expressions of different signedness: ‘int’ and ‘guint’ {aka ‘unsigned int’} [-Werror=sign-compare]
     51 |     for (i = 0; i < response->len; i++) {
        |                   ^
2020-01-30 19:09:52 +01:00
Aleksander Morgado 8d3d1183b9 port-serial: fix warnings with -Wimplicit-fallthrough
mm-port-serial.c: In function ‘port_serial_process_command’:
  mm-port-serial.c:605:16: error: this statement may fall through [-Werror=implicit-fallthrough=]
    605 |             if (written > 0) {
        |                ^
  mm-port-serial.c:611:9: note: here
    611 |         case G_IO_STATUS_AGAIN:
        |         ^~~~
2020-01-30 19:09:52 +01:00