kernel-device: ID_USB_INTERFACE_NUM should be read as an hex string

The original g_udev_device_get_property_as_int() uses strtol() without
an explicit base (i.e. 0) so that the base is autodetected from the
string whenever possible (e.g. if prefixes with '0x' it is treated as a
hexadecimal string).

But, for ID_USB_INTERFACE_NUM, we explicitly require reading the number
as an hex string, even if we don't have any '0x' prefix.

Reported-by: Matthew Stanger <stangerm2@gmail.com>
This commit is contained in:
Aleksander Morgado
2016-11-07 19:41:05 +01:00
parent 4f748144b0
commit 820ab01ddf
6 changed files with 55 additions and 8 deletions
+2 -2
View File
@@ -56,7 +56,7 @@ grab_port (MMPlugin *self,
{
MMPortSerialAtFlag pflags = MM_PORT_SERIAL_AT_FLAG_NONE;
MMKernelDevice *port;
gint usbif;
guint usbif;
/* The Option plugin cannot do anything with non-AT ports */
if (!mm_port_probe_is_at (probe)) {
@@ -73,7 +73,7 @@ grab_port (MMPlugin *self,
* the modem/data port, per mail with Option engineers. Only this port
* will emit responses to dialing commands.
*/
usbif = mm_kernel_device_get_property_as_int (port, "ID_USB_INTERFACE_NUM");
usbif = mm_kernel_device_get_property_as_int_hex (port, "ID_USB_INTERFACE_NUM");
if (usbif == 0)
pflags = MM_PORT_SERIAL_AT_FLAG_PRIMARY | MM_PORT_SERIAL_AT_FLAG_PPP;