huawei: port type hints management updates
We will use one single method to apply port type hints, not a mix of them:
- If AT^GETPORTMODE is supported, prefer its hints over any other method.
- Otherwise, try to guess hints from USB interface descriptions.
- And if none of the plugin-specific hints are supported, we'll default to applying generic port type hints from udev tags.
Once the hints have been applied by one of the methods above, the fallback hint sequences are run:
- Flag the first cdc-wdm port as primary if no other port has been flagged as primary.
- Flag the USB interface 0 as PPP if no other port type hint has been set in any other port.
The logic applying all these procedures has been refactored so that we have separate functions for each, which is much easier to read and follow, even if it requires multiple iterations over the port probe list.
The ^GETPORTMODE parsing has also been updated, because the numbers
associated to each port mode given by the AT^GETPORTMODE
response are not USB interface numbers, they are 'port numbers'.
Moreover, these numbers may start either at 0 or at 1, depending on
the firmware.
The only reasonable way to parse this response is to just gather the order of all the port modes reported, and apply the modes to each serial port found in the system in the same order.
Fixes #239 (closed) Fixes #238 (closed)