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

Commit fabe51eb authored by Stefan Achatz's avatar Stefan Achatz Committed by Jiri Kosina
Browse files

HID: roccat: enable Koneplus device reset



Device can be reset to factory state by sending a command via info sysfs attr.
Added binary attribute info for this purpose, which obsoletes firmware_version
attribute.

Signed-off-by: default avatarStefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 9e78eb8f
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -8,3 +8,14 @@ Description: The integer value of this attribute ranges from 0-4.
		When written, this file sets the number of the startup profile
		When written, this file sets the number of the startup profile
		and the mouse activates this profile immediately.
		and the mouse activates this profile immediately.
		Please use actual_profile, it does the same thing.
		Please use actual_profile, it does the same thing.

What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/firmware_version
Date:		October 2010
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	When read, this file returns the raw integer version number of the
		firmware reported by the mouse. Using the integer value eases
		further usage in other programs. To receive the real version
		number the decimal point has to be shifted 2 positions to the
		left. E.g. a returned value of 121 means 1.21
		This file is readonly.
		Please read binary attribute info which contains firmware version.
+5 −8
Original line number Original line Diff line number Diff line
@@ -9,15 +9,12 @@ Description: The integer value of this attribute ranges from 0-4.
		and the mouse activates this profile immediately.
		and the mouse activates this profile immediately.
Users:		http://roccat.sourceforge.net
Users:		http://roccat.sourceforge.net


What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/firmware_version
What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/info
Date:		October 2010
Date:		November 2012
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Contact:	Stefan Achatz <erazor_de@users.sourceforge.net>
Description:	When read, this file returns the raw integer version number of the
Description:	When read, this file returns general data like firmware version.
		firmware reported by the mouse. Using the integer value eases
		When written, the device can be reset.
		further usage in other programs. To receive the real version
		The data is 8 bytes long.
		number the decimal point has to be shifted 2 positions to the
		left. E.g. a returned value of 121 means 1.21
		This file is readonly.
Users:		http://roccat.sourceforge.net
Users:		http://roccat.sourceforge.net


What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/macro
What:		/sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/koneplus/roccatkoneplus<minor>/macro
+22 −0
Original line number Original line Diff line number Diff line
@@ -183,6 +183,22 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj,
	return real_size;
	return real_size;
}
}


static ssize_t koneplus_sysfs_read_info(struct file *fp,
		struct kobject *kobj, struct bin_attribute *attr, char *buf,
		loff_t off, size_t count)
{
	return koneplus_sysfs_read(fp, kobj, buf, off, count,
			sizeof(struct koneplus_info), KONEPLUS_COMMAND_INFO);
}

static ssize_t koneplus_sysfs_write_info(struct file *fp,
		struct kobject *kobj, struct bin_attribute *attr, char *buf,
		loff_t off, size_t count)
{
	return koneplus_sysfs_write(fp, kobj, buf, off, count,
			sizeof(struct koneplus_info), KONEPLUS_COMMAND_INFO);
}

static ssize_t koneplus_sysfs_write_talk(struct file *fp,
static ssize_t koneplus_sysfs_write_talk(struct file *fp,
		struct kobject *kobj, struct bin_attribute *attr, char *buf,
		struct kobject *kobj, struct bin_attribute *attr, char *buf,
		loff_t off, size_t count)
		loff_t off, size_t count)
@@ -428,6 +444,12 @@ static struct device_attribute koneplus_attributes[] = {
};
};


static struct bin_attribute koneplus_bin_attributes[] = {
static struct bin_attribute koneplus_bin_attributes[] = {
	{
		.attr = { .name = "info", .mode = 0660 },
		.size = sizeof(struct koneplus_info),
		.read = koneplus_sysfs_read_info,
		.write = koneplus_sysfs_write_info
	},
	{
	{
		.attr = { .name = "sensor", .mode = 0660 },
		.attr = { .name = "sensor", .mode = 0660 },
		.size = sizeof(struct koneplus_sensor),
		.size = sizeof(struct koneplus_sensor),