Commit dc186b66 authored by Stefan Achatz's avatar Stefan Achatz Committed by Jiri Kosina

HID: roccat: Pyra now reports external profile changes via roccat device

Profile changes were only reported when issued mouse internal. Now all
changes are reported.
Signed-off-by: default avatarStefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent 1c5784da
...@@ -298,6 +298,7 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, ...@@ -298,6 +298,7 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp,
struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
int retval = 0; int retval = 0;
int difference; int difference;
struct pyra_roccat_report roccat_report;
if (off != 0 || count != sizeof(struct pyra_settings)) if (off != 0 || count != sizeof(struct pyra_settings))
return -EINVAL; return -EINVAL;
...@@ -307,17 +308,23 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, ...@@ -307,17 +308,23 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp,
if (difference) { if (difference) {
retval = pyra_set_settings(usb_dev, retval = pyra_set_settings(usb_dev,
(struct pyra_settings const *)buf); (struct pyra_settings const *)buf);
if (!retval) if (retval) {
memcpy(&pyra->settings, buf, mutex_unlock(&pyra->pyra_lock);
sizeof(struct pyra_settings)); return retval;
} }
mutex_unlock(&pyra->pyra_lock);
if (retval) memcpy(&pyra->settings, buf,
return retval; sizeof(struct pyra_settings));
profile_activated(pyra, pyra->settings.startup_profile); profile_activated(pyra, pyra->settings.startup_profile);
roccat_report.type = PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2;
roccat_report.value = pyra->settings.startup_profile + 1;
roccat_report.key = 0;
roccat_report_event(pyra->chrdev_minor,
(uint8_t const *)&roccat_report);
}
mutex_unlock(&pyra->pyra_lock);
return sizeof(struct pyra_settings); return sizeof(struct pyra_settings);
} }
......
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