diff options
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hid/hid-roccat-kone.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index c931d00c70b9..e2072afb34bb 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c | |||
| @@ -43,6 +43,15 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile) | |||
| 43 | kone->actual_dpi = kone->profiles[new_profile - 1].startup_dpi; | 43 | kone->actual_dpi = kone->profiles[new_profile - 1].startup_dpi; |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | static void kone_profile_report(struct kone_device *kone, uint new_profile) | ||
| 47 | { | ||
| 48 | struct kone_roccat_report roccat_report; | ||
| 49 | roccat_report.event = kone_mouse_event_switch_profile; | ||
| 50 | roccat_report.value = new_profile; | ||
| 51 | roccat_report.key = 0; | ||
| 52 | roccat_report_event(kone->chrdev_minor, (uint8_t *)&roccat_report); | ||
| 53 | } | ||
| 54 | |||
| 46 | static int kone_receive(struct usb_device *usb_dev, uint usb_command, | 55 | static int kone_receive(struct usb_device *usb_dev, uint usb_command, |
| 47 | void *data, uint size) | 56 | void *data, uint size) |
| 48 | { | 57 | { |
| @@ -289,7 +298,7 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj, | |||
| 289 | container_of(kobj, struct device, kobj)->parent->parent; | 298 | container_of(kobj, struct device, kobj)->parent->parent; |
| 290 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); | 299 | struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); |
| 291 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); | 300 | struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); |
| 292 | int retval = 0, difference; | 301 | int retval = 0, difference, old_profile; |
| 293 | 302 | ||
| 294 | /* I need to get my data in one piece */ | 303 | /* I need to get my data in one piece */ |
| 295 | if (off != 0 || count != sizeof(struct kone_settings)) | 304 | if (off != 0 || count != sizeof(struct kone_settings)) |
| @@ -305,9 +314,13 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj, | |||
| 305 | return retval; | 314 | return retval; |
| 306 | } | 315 | } |
| 307 | 316 | ||
| 317 | old_profile = kone->settings.startup_profile; | ||
| 308 | memcpy(&kone->settings, buf, sizeof(struct kone_settings)); | 318 | memcpy(&kone->settings, buf, sizeof(struct kone_settings)); |
| 309 | 319 | ||
| 310 | kone_profile_activated(kone, kone->settings.startup_profile); | 320 | kone_profile_activated(kone, kone->settings.startup_profile); |
| 321 | |||
| 322 | if (kone->settings.startup_profile != old_profile) | ||
| 323 | kone_profile_report(kone, kone->settings.startup_profile); | ||
| 311 | } | 324 | } |
| 312 | mutex_unlock(&kone->kone_lock); | 325 | mutex_unlock(&kone->kone_lock); |
| 313 | 326 | ||
| @@ -554,6 +567,7 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev, | |||
| 554 | 567 | ||
| 555 | /* changing the startup profile immediately activates this profile */ | 568 | /* changing the startup profile immediately activates this profile */ |
| 556 | kone_profile_activated(kone, new_startup_profile); | 569 | kone_profile_activated(kone, new_startup_profile); |
| 570 | kone_profile_report(kone, new_startup_profile); | ||
| 557 | 571 | ||
| 558 | mutex_unlock(&kone->kone_lock); | 572 | mutex_unlock(&kone->kone_lock); |
| 559 | return size; | 573 | return size; |
