Lines Matching +full:control +full:- +full:parent

1 // SPDX-License-Identifier: GPL-2.0-or-later
20 #include <linux/hid-roccat.h>
21 #include "hid-ids.h"
22 #include "hid-roccat-common.h"
23 #include "hid-roccat-kovaplus.h"
37 if (new_profile_index >= ARRAY_SIZE(kovaplus->profile_settings)) in kovaplus_profile_activated()
39 kovaplus->actual_profile = new_profile_index; in kovaplus_profile_activated()
40 kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level; in kovaplus_profile_activated()
41 kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x; in kovaplus_profile_activated()
42 kovaplus->actual_y_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_y; in kovaplus_profile_activated()
49 struct roccat_common2_control control; in kovaplus_send_control() local
54 return -EINVAL; in kovaplus_send_control()
56 control.command = ROCCAT_COMMON_COMMAND_CONTROL; in kovaplus_send_control()
57 control.value = value; in kovaplus_send_control()
58 control.request = request; in kovaplus_send_control()
61 &control, sizeof(struct roccat_common2_control)); in kovaplus_send_control()
100 /* retval is 0-4 on success, < 0 on error */
130 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_read()
139 return -EINVAL; in kovaplus_sysfs_read()
141 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_read()
143 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_read()
155 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_write()
161 return -EINVAL; in kovaplus_sysfs_write()
163 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_write()
166 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_write()
212 KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL);
221 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_read_profilex_settings()
225 retval = kovaplus_select_profile(usb_dev, *(uint *)(attr->private), in kovaplus_sysfs_read_profilex_settings()
239 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_read_profilex_buttons()
243 retval = kovaplus_select_profile(usb_dev, *(uint *)(attr->private), in kovaplus_sysfs_read_profilex_buttons()
258 .private = &profile_numbers[number-1], \
264 .private = &profile_numbers[number-1], \
276 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_profile()
277 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_profile); in kovaplus_sysfs_show_actual_profile()
289 dev = dev->parent->parent; in kovaplus_sysfs_set_actual_profile()
298 return -EINVAL; in kovaplus_sysfs_set_actual_profile()
300 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_set_actual_profile()
303 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_set_actual_profile()
314 roccat_report_event(kovaplus->chrdev_minor, in kovaplus_sysfs_set_actual_profile()
317 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_set_actual_profile()
329 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_cpi()
330 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi); in kovaplus_sysfs_show_actual_cpi()
338 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_sensitivity_x()
339 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity); in kovaplus_sysfs_show_actual_sensitivity_x()
348 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_sensitivity_y()
349 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity); in kovaplus_sysfs_show_actual_sensitivity_y()
361 dev = dev->parent->parent; in kovaplus_sysfs_show_firmware_version()
365 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_show_firmware_version()
368 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_show_firmware_version()
418 mutex_init(&kovaplus->kovaplus_lock); in kovaplus_init_kovaplus_device_struct()
423 &kovaplus->profile_settings[i], i); in kovaplus_init_kovaplus_device_struct()
429 &kovaplus->profile_buttons[i], i); in kovaplus_init_kovaplus_device_struct()
445 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in kovaplus_init_specials()
450 if (intf->cur_altsetting->desc.bInterfaceProtocol in kovaplus_init_specials()
456 return -ENOMEM; in kovaplus_init_specials()
471 kovaplus->chrdev_minor = retval; in kovaplus_init_specials()
472 kovaplus->roccat_claimed = 1; in kovaplus_init_specials()
487 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in kovaplus_remove_specials()
490 if (intf->cur_altsetting->desc.bInterfaceProtocol in kovaplus_remove_specials()
493 if (kovaplus->roccat_claimed) in kovaplus_remove_specials()
494 roccat_disconnect(kovaplus->chrdev_minor); in kovaplus_remove_specials()
546 switch (button_report->type) { in kovaplus_keep_values_up_to_date()
548 kovaplus_profile_activated(kovaplus, button_report->data1 - 1); in kovaplus_keep_values_up_to_date()
551 kovaplus->actual_cpi = kovaplus_convert_event_cpi(button_report->data1); in kovaplus_keep_values_up_to_date()
554 kovaplus->actual_x_sensitivity = button_report->data1; in kovaplus_keep_values_up_to_date()
555 kovaplus->actual_y_sensitivity = button_report->data2; in kovaplus_keep_values_up_to_date()
573 if (button_report->type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_2) in kovaplus_report_to_chrdev()
576 roccat_report.type = button_report->type; in kovaplus_report_to_chrdev()
577 roccat_report.profile = kovaplus->actual_profile + 1; in kovaplus_report_to_chrdev()
583 roccat_report.button = button_report->data1; in kovaplus_report_to_chrdev()
588 roccat_report.data1 = kovaplus_convert_event_cpi(button_report->data1); in kovaplus_report_to_chrdev()
590 roccat_report.data1 = button_report->data1; in kovaplus_report_to_chrdev()
592 roccat_report.data2 = button_report->data2; in kovaplus_report_to_chrdev()
594 roccat_report_event(kovaplus->chrdev_minor, in kovaplus_report_to_chrdev()
601 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in kovaplus_raw_event()
604 if (intf->cur_altsetting->desc.bInterfaceProtocol in kovaplus_raw_event()
613 if (kovaplus->roccat_claimed) in kovaplus_raw_event()
641 kovaplus_class->dev_groups = kovaplus_groups; in kovaplus_init()