+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
+static ssize_t online_read(struct class *cls, struct class_attribute *attr, char *_buf)
+#else
+static ssize_t online_read(struct class *cls, char *_buf)
+#endif
+{
+ return sprintf(_buf, "%d\n", online);
+
+}
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37))
+static ssize_t online_write(struct class *cls, struct class_attribute *attr, const char *_buf, size_t _count)
+#else
+static ssize_t online_write(struct class *cls, const char *_buf, size_t _count)
+#endif
+{
+ int new_value = simple_strtoul(_buf, NULL, 16);
+ if(new_value == online) return _count;
+ online = new_value;
+ return _count;
+}
+static CLASS_ATTR(online, 0777, online_read, online_write);