port-serial: Flow Control property is flags, not enum

MMFlowControl is a flags enumeration, so change the property type to
match that, or we'll end up with nasty criticals during runtime.

    (ModemManager:30758): GLib-GObject-CRITICAL **: 10:54:26.435: g_param_spec_enum: assertion 'G_TYPE_IS_ENUM (enum_type)' failed

    Thread 1 "ModemManager" received signal SIGTRAP, Trace/breakpoint trap.
    0x00007ffff71f2a96 in ?? () from /usr/lib/libglib-2.0.so.0
    (gdb) bt
    #0  0x00007ffff71f2a96 in  () at /usr/lib/libglib-2.0.so.0
    #1  0x00007ffff71f3def in g_logv () at /usr/lib/libglib-2.0.so.0
    #2  0x00007ffff71f3fe0 in g_log () at /usr/lib/libglib-2.0.so.0
    #3  0x00007ffff72d90ac in g_param_spec_enum () at /usr/lib/libgobject-2.0.so.0
    #4  0x000055555564caf2 in mm_port_serial_class_init (klass=0x5555557607c0) at mm-port-serial.c:2101
    #5  0x000055555564759a in mm_port_serial_class_intern_init (klass=0x5555557607c0) at mm-port-serial.c:49
    #6  0x00007ffff72ea9b4 in g_type_class_ref () at /usr/lib/libgobject-2.0.so.0
    #7  0x00007ffff72eab5a in g_type_class_ref () at /usr/lib/libgobject-2.0.so.0
    #8  0x00007ffff72d0f53 in g_object_new_valist () at /usr/lib/libgobject-2.0.so.0
    #9  0x00007ffff72d103a in g_object_new () at /usr/lib/libgobject-2.0.so.0
    #10 0x000055555564e187 in mm_port_serial_at_new (name=0x55555576e280 "ttyUSB4", subsys=MM_PORT_SUBSYS_TTY) at mm-port-serial-at.c:533
    #11 0x0000555555602512 in serial_open_at (self=0x555555715390) at mm-port-probe.c:1285
    #12 0x00007ffff71ecb49 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
    #13 0x00007ffff71ecf59 in  () at /usr/lib/libglib-2.0.so.0
    #14 0x00007ffff71ed272 in g_main_loop_run () at /usr/lib/libglib-2.0.so.0
    #15 0x00005555555957e0 in main (argc=3, argv=0x7fffffffe458) at
    main.c:181

Also, rename the property to match the naming convention of other
properties in the same object.
This commit is contained in:
Aleksander Morgado
2018-09-12 17:15:46 +00:00
committed by Dan Williams
parent e3c2f0e9cc
commit 48d2fa399a
+8 -8
View File
@@ -1957,7 +1957,7 @@ set_property (GObject *object,
self->priv->stopbits = g_value_get_uint (value);
break;
case PROP_FLOW_CONTROL:
self->priv->flow_control = g_value_get_enum (value);
self->priv->flow_control = g_value_get_flags (value);
break;
case PROP_SEND_DELAY:
self->priv->send_delay = g_value_get_uint64 (value);
@@ -1999,7 +1999,7 @@ get_property (GObject *object,
g_value_set_uint (value, self->priv->stopbits);
break;
case PROP_FLOW_CONTROL:
g_value_set_enum (value, self->priv->flow_control);
g_value_set_flags (value, self->priv->flow_control);
break;
case PROP_SEND_DELAY:
g_value_set_uint64 (value, self->priv->send_delay);
@@ -2100,12 +2100,12 @@ mm_port_serial_class_init (MMPortSerialClass *klass)
g_object_class_install_property
(object_class, PROP_FLOW_CONTROL,
g_param_spec_enum (MM_PORT_SERIAL_FLOW_CONTROL,
"flowcontrol",
"Select flow control (see MMFlowControl definition)",
MM_TYPE_FLOW_CONTROL,
MM_FLOW_CONTROL_UNKNOWN,
G_PARAM_READWRITE));
g_param_spec_flags (MM_PORT_SERIAL_FLOW_CONTROL,
"FlowControl",
"Select flow control",
MM_TYPE_FLOW_CONTROL,
MM_FLOW_CONTROL_UNKNOWN,
G_PARAM_READWRITE));
g_object_class_install_property
(object_class, PROP_SEND_DELAY,