core: fix possible crash in g_utf8_validate()

We can skip additional UTF-8 validity check when parsing operator.
mm_charset_take_and_convert_to_utf8() already does a UTF-8 validity check
internally before returning the string, so it's pointless to do a new one
on the returned string.
Plus, mm_charset_take_and_convert_to_utf8() may really return NULL, which
would end up in segfaulting as g_utf8_validate() expects always a non-NULL
string.

Based on 219424a6e2d017491a05ecbed661bccde3f991ef (MM_06 branch)
libmm-glib,manager: client creation may fail, avoid explicit MM_MANAGER() cast
broadband-modem: fall back to +CSQ if +CIND signal quality checking fails

If +CIND fails for any reason (generic failure, wrong indexes, etc) or
reports zero signal strength (quirky modem) then fall back to +CSQ.
qcdm: handle more test failures for NW subsystem

Bandrich C120 returns BAD_LENGTH rather than BAD_COMMAND, perhaps
because it re-uses the same subsystem number for something else.
port-probe: fix checking of Icera capability on some devices

Sierra devices often have limited AT parsers on their APP ports
which reply with OK to any command they don't understand, and
thus we need to actually check for a valid IPSYS reply instead of
just checking whether the IPSYS request completed without error.

Previously MM would detect Icera capability on devices that
didn't actually have it.
port-probe: fix crash in buffer-full processing

Signal was attached with user_data as MMPortProbe*, but
serial_buffer_full() treated user_data as a PortProbeRunTask*.
Hillarity ensued.
serial-port: stop reading data if the serial port was closed

If a response processor closed the port, don't try to read any
more data from it.  Move the priv->watch_id check to the
while condition so the loop terminates before calling
g_io_channel_read_chars() again, which caused a warning since
the underlying file descriptor was already closed.

Also, bytes_read will never be less than zero (it's unsigned),
so skip the bytes_read > 0 check and just assert that this
condition is true.
serial-port: consistently use mm_warn() instead of g_warning()
port-probe: early-exit if port is certainly not AT capable

If we read a response that indicates the port is definitely not an
AT capable port, stop AT probing.  Certain ports that use proprietary
protocols or other non-AT protocols tend to spew data at us, so when
this happens we can cut probing short.
hso: DIAG ports aren't always DIAG

The 'hso' driver tags Icera-based modems' proprietary protocol port
as a DIAG port, but since they aren't Qualcomm-based, it's not
a DIAG port.  Just turn off AT probing and let QCDM probing
fail the port instead of assuming it's a DIAG port.
broadband-modem-huawei: don't call non-existent MMBroadbandModem CDMA functions
huawei: don't assume g_regex_match_full() sets error when not matching
plugin-base: handle Huawei Data07 capabilities probing
sierra: USB 306 modems support PPP on the APPx ports
serial: clear serial info struct before calling ioctl()

We need the kernel driver to give a proper value for the 'closing_wait'
variable, but don't assume it will.

This should solve the following kind of issues reported by valgrind:

==8985== Conditional jump or move depends on uninitialised value(s)
==8985==    at 0x4409A6: mm_serial_port_close (mm-serial-port.c:932)
==8985==    by 0x41A420: disable_all_done (mm-generic-cdma.c:753)
==8985==    by 0x4125A4: mm_manager_shutdown (mm-manager.c:1130)
==8985==    by 0x40DE35: main (main.c:203)
huawei: consolidate SYSINFO parsing

Both CDMA and 3GPP modems use SYSINFO, so consolidate the parsing of
its response.
huawei: consolidate MODE parsing

Both CDMA and 3GPP modems emit this, but using slightly different
formats.
huawei: implement Huawei-specific CDMA signal quality checks

Many Huawei CDMA modems implement vendor commands for 1x and EVDO
signal quality, so use them since they are more accurate than the
generic signal checking.

(port of a similar patch for MM_06 by heiher <admin@heiher.info>)
huawei: fix crash disabling CDMA unsolicited response handlers

Parent MMBroadbandModem may not implement these functions so we
shouldn't call them unless it does.
huawei: handle CDMA allowed modes