diff options
-rw-r--r-- | drivers/hid/hid-roccat-pyra.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 8140776bd8c5..df05c1b1064f 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c | |||
@@ -298,6 +298,7 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, | |||
298 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 298 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
299 | int retval = 0; | 299 | int retval = 0; |
300 | int difference; | 300 | int difference; |
301 | struct pyra_roccat_report roccat_report; | ||
301 | 302 | ||
302 | if (off != 0 || count != sizeof(struct pyra_settings)) | 303 | if (off != 0 || count != sizeof(struct pyra_settings)) |
303 | return -EINVAL; | 304 | return -EINVAL; |
@@ -307,17 +308,23 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp, | |||
307 | if (difference) { | 308 | if (difference) { |
308 | retval = pyra_set_settings(usb_dev, | 309 | retval = pyra_set_settings(usb_dev, |
309 | (struct pyra_settings const *)buf); | 310 | (struct pyra_settings const *)buf); |
310 | if (!retval) | 311 | if (retval) { |
311 | memcpy(&pyra->settings, buf, | 312 | mutex_unlock(&pyra->pyra_lock); |
312 | sizeof(struct pyra_settings)); | 313 | return retval; |
313 | } | 314 | } |
314 | mutex_unlock(&pyra->pyra_lock); | ||
315 | 315 | ||
316 | if (retval) | 316 | memcpy(&pyra->settings, buf, |
317 | return retval; | 317 | sizeof(struct pyra_settings)); |
318 | 318 | ||
319 | profile_activated(pyra, pyra->settings.startup_profile); | 319 | profile_activated(pyra, pyra->settings.startup_profile); |
320 | 320 | ||
321 | roccat_report.type = PYRA_MOUSE_EVENT_BUTTON_TYPE_PROFILE_2; | ||
322 | roccat_report.value = pyra->settings.startup_profile + 1; | ||
323 | roccat_report.key = 0; | ||
324 | roccat_report_event(pyra->chrdev_minor, | ||
325 | (uint8_t const *)&roccat_report); | ||
326 | } | ||
327 | mutex_unlock(&pyra->pyra_lock); | ||
321 | return sizeof(struct pyra_settings); | 328 | return sizeof(struct pyra_settings); |
322 | } | 329 | } |
323 | 330 | ||