提交 3200a6a5 编写于 作者: S Stefan Achatz 提交者: Jiri Kosina

HID: roccat: Kone 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: NStefan Achatz <erazor_de@users.sourceforge.net>
Signed-off-by: NJiri Kosina <jkosina@suse.cz>
上级 bd9c35d0
...@@ -43,6 +43,15 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile) ...@@ -43,6 +43,15 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile)
kone->actual_dpi = kone->profiles[new_profile - 1].startup_dpi; kone->actual_dpi = kone->profiles[new_profile - 1].startup_dpi;
} }
static void kone_profile_report(struct kone_device *kone, uint new_profile)
{
struct kone_roccat_report roccat_report;
roccat_report.event = kone_mouse_event_switch_profile;
roccat_report.value = new_profile;
roccat_report.key = 0;
roccat_report_event(kone->chrdev_minor, (uint8_t *)&roccat_report);
}
static int kone_receive(struct usb_device *usb_dev, uint usb_command, static int kone_receive(struct usb_device *usb_dev, uint usb_command,
void *data, uint size) void *data, uint size)
{ {
...@@ -289,7 +298,7 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj, ...@@ -289,7 +298,7 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj,
container_of(kobj, struct device, kobj)->parent->parent; container_of(kobj, struct device, kobj)->parent->parent;
struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev));
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, difference; int retval = 0, difference, old_profile;
/* I need to get my data in one piece */ /* I need to get my data in one piece */
if (off != 0 || count != sizeof(struct kone_settings)) 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,9 +314,13 @@ static ssize_t kone_sysfs_write_settings(struct file *fp, struct kobject *kobj,
return retval; return retval;
} }
old_profile = kone->settings.startup_profile;
memcpy(&kone->settings, buf, sizeof(struct kone_settings)); memcpy(&kone->settings, buf, sizeof(struct kone_settings));
kone_profile_activated(kone, kone->settings.startup_profile); kone_profile_activated(kone, kone->settings.startup_profile);
if (kone->settings.startup_profile != old_profile)
kone_profile_report(kone, kone->settings.startup_profile);
} }
mutex_unlock(&kone->kone_lock); mutex_unlock(&kone->kone_lock);
...@@ -554,6 +567,7 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev, ...@@ -554,6 +567,7 @@ static ssize_t kone_sysfs_set_startup_profile(struct device *dev,
/* changing the startup profile immediately activates this profile */ /* changing the startup profile immediately activates this profile */
kone_profile_activated(kone, new_startup_profile); kone_profile_activated(kone, new_startup_profile);
kone_profile_report(kone, new_startup_profile);
mutex_unlock(&kone->kone_lock); mutex_unlock(&kone->kone_lock);
return size; return size;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册