HID: roccat: Pyra now reports external profile changes via roccat device
authorStefan Achatz <erazor_de@users.sourceforge.net>
Sat, 27 Aug 2011 13:24:41 +0000 (15:24 +0200)
committerJiri Kosina <jkosina@suse.cz>
Wed, 7 Sep 2011 11:38:27 +0000 (13:38 +0200)
Profile changes were only reported when issued mouse internal. Now all
changes are reported.

Signed-off-by: Stefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-roccat-pyra.c

index 8140776bd8c51906f7f1296ef1d1ea5ff6d49299..df05c1b1064ff18e304d2f08f3c59d920dceda9b 100644 (file)
@@ -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));
        int retval = 0;
        int difference;
+       struct pyra_roccat_report roccat_report;
 
        if (off != 0 || count != sizeof(struct pyra_settings))
                return -EINVAL;
@@ -307,17 +308,23 @@ static ssize_t pyra_sysfs_write_settings(struct file *fp,
        if (difference) {
                retval = pyra_set_settings(usb_dev,
                                (struct pyra_settings const *)buf);
-               if (!retval)
-                       memcpy(&pyra->settings, buf,
-                                       sizeof(struct pyra_settings));
-       }
-       mutex_unlock(&pyra->pyra_lock);
+               if (retval) {
+                       mutex_unlock(&pyra->pyra_lock);
+                       return retval;
+               }
 
-       if (retval)
-               return retval;
+               memcpy(&pyra->settings, buf,
+                               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);
 }
 
This page took 0.03897 seconds and 5 git commands to generate.