Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a97015c9 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

greybus: bundle: add bundle_id attribute



Add a bundle_id attribute for the interface-unique id of a bundle that
user space can use for matching.

Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 2b14daba
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -104,6 +104,13 @@ Contact: Greg Kroah-Hartman <greg@kroah.com>
Description:
		The greybus class of the bundle B.

What:		/sys/bus/greybus/device/N-I.B/bundle_id
Date:		October 2015
KernelVersion:	4.XX
Contact:	Greg Kroah-Hartman <greg@kroah.com>
Description:
		The interface-unique id of the bundle B.

What:		/sys/bus/greybus/device/N-I.B/state
Date:		October 2015
KernelVersion:	4.XX
+10 −0
Original line number Diff line number Diff line
@@ -18,6 +18,15 @@ static ssize_t bundle_class_show(struct device *dev,
}
static DEVICE_ATTR_RO(bundle_class);

static ssize_t bundle_id_show(struct device *dev,
			      struct device_attribute *attr, char *buf)
{
	struct gb_bundle *bundle = to_gb_bundle(dev);

	return sprintf(buf, "%u\n", bundle->id);
}
static DEVICE_ATTR_RO(bundle_id);

static ssize_t state_show(struct device *dev, struct device_attribute *attr,
			  char *buf)
{
@@ -49,6 +58,7 @@ static DEVICE_ATTR_RW(state);

static struct attribute *bundle_attrs[] = {
	&dev_attr_bundle_class.attr,
	&dev_attr_bundle_id.attr,
	&dev_attr_state.attr,
	NULL,
};