Contact:       Greg Kroah-Hartman <greg@kroah.com>
 Description:
                The device id of a Greybus bundle.
+
+What:          /sys/bus/greybus/device/.../state
+Date:          October 2015
+KernelVersion: 4.XX
+Contact:       Greg Kroah-Hartman <greg@kroah.com>
+Description:
+               A bundle has a state that is managed by the userspace
+               Endo process.  This file allows that Endo to signal
+               other Android HALs that the state of the bundle has
+               changed to a specific value.  When written to, any
+               process watching the file will be woken up, and the new
+               value can be read. It's a "poor-man's IPC", yes, but
+               simplifies the Android userspace code immensely.
 
 /*
  * Greybus bundles
  *
- * Copyright 2014 Google Inc.
- * Copyright 2014 Linaro Ltd.
+ * Copyright 2014-2015 Google Inc.
+ * Copyright 2014-2015 Linaro Ltd.
  *
  * Released under the GPLv2 only.
  */
 }
 static DEVICE_ATTR_RO(class);
 
+static ssize_t state_show(struct device *dev, struct device_attribute *attr,
+                         char *buf)
+{
+       struct gb_bundle *bundle = to_gb_bundle(dev);
+
+       if (bundle->state == NULL)
+               return sprintf(buf, "\n");
+
+       return sprintf(buf, "%s\n", bundle->state);
+}
+
+static ssize_t state_store(struct device *dev, struct device_attribute *attr,
+                          const char *buf, size_t size)
+{
+       struct gb_bundle *bundle = to_gb_bundle(dev);
+
+       kfree(bundle->state);
+       bundle->state = kzalloc(size + 1, GFP_KERNEL);
+       if (!bundle->state)
+               return -ENOMEM;
+
+       memcpy(bundle->state, buf, size);
+
+       /* Tell userspace that the file contents changed */
+       sysfs_notify(&bundle->dev.kobj, NULL, "state");
+
+       return size;
+}
+static DEVICE_ATTR_RW(state);
+
+
 static struct attribute *bundle_attrs[] = {
        &dev_attr_device_id.attr,
        &dev_attr_class.attr,
+       &dev_attr_state.attr,
        NULL,
 };
 
 {
        struct gb_bundle *bundle = to_gb_bundle(dev);
 
+       kfree(bundle->state);
        kfree(bundle);
 }