Commit 37d79bce authored by Christian Kellner's avatar Christian Kellner
Browse files

device: add name, vendor & sysfs properties

parent e15873e3
......@@ -30,6 +30,11 @@ struct _BoltDevice
BoltDBusDeviceSkeleton object;
char *uid;
char *name;
char *vendor;
/* when device is attached */
char *syspath;
};
......@@ -37,6 +42,9 @@ enum {
PROP_0,
PROP_UID,
PROP_NAME,
PROP_VENDOR,
PROP_SYSFS,
PROP_LAST
};
......@@ -52,6 +60,9 @@ bolt_device_finalize (GObject *object)
BoltDevice *dev = BOLT_DEVICE (object);
g_free (dev->uid);
g_free (dev->name);
g_free (dev->vendor);
g_free (dev->syspath);
G_OBJECT_CLASS (bolt_device_parent_class)->finalize (object);
}
......@@ -76,6 +87,18 @@ bolt_device_get_property (GObject *object,
g_value_set_string (value, dev->uid);
break;
case PROP_NAME:
g_value_set_string (value, dev->name);
break;
case PROP_VENDOR:
g_value_set_string (value, dev->vendor);
break;
case PROP_SYSFS:
g_value_set_string (value, dev->syspath);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -95,6 +118,18 @@ bolt_device_set_property (GObject *object,
dev->uid = g_value_dup_string (value);
break;
case PROP_NAME:
dev->vendor = g_value_dup_string (value);
break;
case PROP_VENDOR:
dev->name = g_value_dup_string (value);
break;
case PROP_SYSFS:
dev->syspath = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
......@@ -114,6 +149,20 @@ bolt_device_class_init (BoltDeviceClass *klass)
g_object_class_override_property (gobject_class,
PROP_UID,
"uid");
g_object_class_override_property (gobject_class,
PROP_NAME,
"name");
g_object_class_override_property (gobject_class,
PROP_VENDOR,
"vendor");
g_object_class_override_property (gobject_class,
PROP_SYSFS,
"sysfs-path");
}
}
/* public methods */
......
......@@ -37,6 +37,24 @@
</doc:para></doc:description></doc:doc>
</property>
<property name="Name" type="s" access="read">
<doc:doc><doc:description><doc:para>
The name of the device.
</doc:para></doc:description></doc:doc>
</property>
<property name="Vendor" type="s" access="read">
<doc:doc><doc:description><doc:para>
The vendor of the device.
</doc:para></doc:description></doc:doc>
</property>
<property name="SysfsPath" type="s" access="read">
<doc:doc><doc:description><doc:para>
The sysfs path of the device, if it is connected.
</doc:para></doc:description></doc:doc>
</property>
</interface>
</node>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment