Lines Matching refs:kone
40 static void kone_profile_activated(struct kone_device *kone, uint new_profile) in kone_profile_activated() argument
42 kone->actual_profile = new_profile; in kone_profile_activated()
43 kone->actual_dpi = kone->profiles[new_profile - 1].startup_dpi; in kone_profile_activated()
46 static void kone_profile_report(struct kone_device *kone, uint new_profile) in kone_profile_report() argument
53 roccat_report_event(kone->chrdev_minor, (uint8_t *)&roccat_report); in kone_profile_report()
274 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_read_settings() local
282 mutex_lock(&kone->kone_lock); in kone_sysfs_read_settings()
283 memcpy(buf, ((char const *)&kone->settings) + off, count); in kone_sysfs_read_settings()
284 mutex_unlock(&kone->kone_lock); in kone_sysfs_read_settings()
299 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_write_settings() local
307 mutex_lock(&kone->kone_lock); in kone_sysfs_write_settings()
308 difference = memcmp(buf, &kone->settings, sizeof(struct kone_settings)); in kone_sysfs_write_settings()
313 mutex_unlock(&kone->kone_lock); in kone_sysfs_write_settings()
317 old_profile = kone->settings.startup_profile; in kone_sysfs_write_settings()
318 memcpy(&kone->settings, buf, sizeof(struct kone_settings)); in kone_sysfs_write_settings()
320 kone_profile_activated(kone, kone->settings.startup_profile); in kone_sysfs_write_settings()
322 if (kone->settings.startup_profile != old_profile) in kone_sysfs_write_settings()
323 kone_profile_report(kone, kone->settings.startup_profile); in kone_sysfs_write_settings()
325 mutex_unlock(&kone->kone_lock); in kone_sysfs_write_settings()
337 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_read_profilex() local
345 mutex_lock(&kone->kone_lock); in kone_sysfs_read_profilex()
346 memcpy(buf, ((char const *)&kone->profiles[*(uint *)(attr->private)]) + off, count); in kone_sysfs_read_profilex()
347 mutex_unlock(&kone->kone_lock); in kone_sysfs_read_profilex()
358 struct kone_device *kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_write_profilex() local
367 profile = &kone->profiles[*(uint *)(attr->private)]; in kone_sysfs_write_profilex()
369 mutex_lock(&kone->kone_lock); in kone_sysfs_write_profilex()
378 mutex_unlock(&kone->kone_lock); in kone_sysfs_write_profilex()
402 struct kone_device *kone = in kone_sysfs_show_actual_profile() local
404 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_profile); in kone_sysfs_show_actual_profile()
411 struct kone_device *kone = in kone_sysfs_show_actual_dpi() local
413 return snprintf(buf, PAGE_SIZE, "%d\n", kone->actual_dpi); in kone_sysfs_show_actual_dpi()
421 struct kone_device *kone; in kone_sysfs_show_weight() local
427 kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_show_weight()
430 mutex_lock(&kone->kone_lock); in kone_sysfs_show_weight()
432 mutex_unlock(&kone->kone_lock); in kone_sysfs_show_weight()
443 struct kone_device *kone = in kone_sysfs_show_firmware_version() local
445 return snprintf(buf, PAGE_SIZE, "%d\n", kone->firmware_version); in kone_sysfs_show_firmware_version()
453 struct kone_device *kone = in kone_sysfs_show_tcu() local
455 return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.tcu); in kone_sysfs_show_tcu()
473 struct kone_device *kone; in kone_sysfs_set_tcu() local
479 kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_set_tcu()
489 mutex_lock(&kone->kone_lock); in kone_sysfs_set_tcu()
518 retval = kone_get_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
523 if (kone->settings.tcu != state) { in kone_sysfs_set_tcu()
524 kone->settings.tcu = state; in kone_sysfs_set_tcu()
525 kone_set_settings_checksum(&kone->settings); in kone_sysfs_set_tcu()
527 retval = kone_set_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
534 retval = kone_get_settings(usb_dev, &kone->settings); in kone_sysfs_set_tcu()
540 kone_profile_activated(kone, kone->settings.startup_profile); in kone_sysfs_set_tcu()
547 mutex_unlock(&kone->kone_lock); in kone_sysfs_set_tcu()
555 struct kone_device *kone = in kone_sysfs_show_startup_profile() local
557 return snprintf(buf, PAGE_SIZE, "%d\n", kone->settings.startup_profile); in kone_sysfs_show_startup_profile()
563 struct kone_device *kone; in kone_sysfs_set_startup_profile() local
569 kone = hid_get_drvdata(dev_get_drvdata(dev)); in kone_sysfs_set_startup_profile()
579 mutex_lock(&kone->kone_lock); in kone_sysfs_set_startup_profile()
581 kone->settings.startup_profile = new_startup_profile; in kone_sysfs_set_startup_profile()
582 kone_set_settings_checksum(&kone->settings); in kone_sysfs_set_startup_profile()
584 retval = kone_set_settings(usb_dev, &kone->settings); in kone_sysfs_set_startup_profile()
586 mutex_unlock(&kone->kone_lock); in kone_sysfs_set_startup_profile()
591 kone_profile_activated(kone, new_startup_profile); in kone_sysfs_set_startup_profile()
592 kone_profile_report(kone, new_startup_profile); in kone_sysfs_set_startup_profile()
594 mutex_unlock(&kone->kone_lock); in kone_sysfs_set_startup_profile()
659 struct kone_device *kone) in kone_init_kone_device_struct() argument
664 mutex_init(&kone->kone_lock); in kone_init_kone_device_struct()
667 retval = kone_get_profile(usb_dev, &kone->profiles[i], i + 1); in kone_init_kone_device_struct()
672 retval = kone_get_settings(usb_dev, &kone->settings); in kone_init_kone_device_struct()
676 retval = kone_get_firmware_version(usb_dev, &kone->firmware_version); in kone_init_kone_device_struct()
680 kone_profile_activated(kone, kone->settings.startup_profile); in kone_init_kone_device_struct()
696 struct kone_device *kone; in kone_init_specials() local
702 kone = kzalloc(sizeof(*kone), GFP_KERNEL); in kone_init_specials()
703 if (!kone) in kone_init_specials()
705 hid_set_drvdata(hdev, kone); in kone_init_specials()
707 retval = kone_init_kone_device_struct(usb_dev, kone); in kone_init_specials()
719 kone->roccat_claimed = 1; in kone_init_specials()
720 kone->chrdev_minor = retval; in kone_init_specials()
728 kfree(kone); in kone_init_specials()
735 struct kone_device *kone; in kone_remove_specials() local
739 kone = hid_get_drvdata(hdev); in kone_remove_specials()
740 if (kone->roccat_claimed) in kone_remove_specials()
741 roccat_disconnect(kone->chrdev_minor); in kone_remove_specials()
783 static void kone_keep_values_up_to_date(struct kone_device *kone, in kone_keep_values_up_to_date() argument
788 kone->actual_dpi = kone->profiles[event->value - 1]. in kone_keep_values_up_to_date()
791 kone->actual_profile = event->value; in kone_keep_values_up_to_date()
795 kone->actual_dpi = event->value; in kone_keep_values_up_to_date()
800 static void kone_report_to_chrdev(struct kone_device const *kone, in kone_report_to_chrdev() argument
813 roccat_report_event(kone->chrdev_minor, in kone_report_to_chrdev()
820 roccat_report.value = kone->actual_profile; in kone_report_to_chrdev()
822 roccat_report_event(kone->chrdev_minor, in kone_report_to_chrdev()
838 struct kone_device *kone = hid_get_drvdata(hdev); in kone_raw_event() local
845 if (kone == NULL) in kone_raw_event()
853 if (memcmp(&kone->last_mouse_event.tilt, &event->tilt, 5)) in kone_raw_event()
854 memcpy(&kone->last_mouse_event, event, in kone_raw_event()
859 kone_keep_values_up_to_date(kone, event); in kone_raw_event()
861 if (kone->roccat_claimed) in kone_raw_event()
862 kone_report_to_chrdev(kone, event); in kone_raw_event()