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"
35 if (new_profile_index >= ARRAY_SIZE(kovaplus->profile_settings)) in kovaplus_profile_activated()
37 kovaplus->actual_profile = new_profile_index; in kovaplus_profile_activated()
38 kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level; in kovaplus_profile_activated()
39 kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x; in kovaplus_profile_activated()
40 kovaplus->actual_y_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_y; in kovaplus_profile_activated()
47 struct roccat_common2_control control; in kovaplus_send_control() local
52 return -EINVAL; in kovaplus_send_control()
54 control.command = ROCCAT_COMMON_COMMAND_CONTROL; in kovaplus_send_control()
55 control.value = value; in kovaplus_send_control()
56 control.request = request; in kovaplus_send_control()
59 &control, sizeof(struct roccat_common2_control)); in kovaplus_send_control()
98 /* retval is 0-4 on success, < 0 on error */
128 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_read()
137 return -EINVAL; in kovaplus_sysfs_read()
139 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_read()
141 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_read()
153 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_write()
159 return -EINVAL; in kovaplus_sysfs_write()
161 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_write()
164 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_write()
210 KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL);
219 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_read_profilex_settings()
223 retval = kovaplus_select_profile(usb_dev, *(uint *)(attr->private), in kovaplus_sysfs_read_profilex_settings()
237 struct device *dev = kobj_to_dev(kobj)->parent->parent; in kovaplus_sysfs_read_profilex_buttons()
241 retval = kovaplus_select_profile(usb_dev, *(uint *)(attr->private), in kovaplus_sysfs_read_profilex_buttons()
256 .private = &profile_numbers[number-1], \
262 .private = &profile_numbers[number-1], \
274 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_profile()
275 return sysfs_emit(buf, "%d\n", kovaplus->actual_profile); in kovaplus_sysfs_show_actual_profile()
287 dev = dev->parent->parent; in kovaplus_sysfs_set_actual_profile()
296 return -EINVAL; in kovaplus_sysfs_set_actual_profile()
298 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_set_actual_profile()
301 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_set_actual_profile()
312 roccat_report_event(kovaplus->chrdev_minor, in kovaplus_sysfs_set_actual_profile()
315 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_set_actual_profile()
327 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_cpi()
328 return sysfs_emit(buf, "%d\n", kovaplus->actual_cpi); in kovaplus_sysfs_show_actual_cpi()
336 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_sensitivity_x()
337 return sysfs_emit(buf, "%d\n", kovaplus->actual_x_sensitivity); in kovaplus_sysfs_show_actual_sensitivity_x()
346 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in kovaplus_sysfs_show_actual_sensitivity_y()
347 return sysfs_emit(buf, "%d\n", kovaplus->actual_y_sensitivity); in kovaplus_sysfs_show_actual_sensitivity_y()
359 dev = dev->parent->parent; in kovaplus_sysfs_show_firmware_version()
363 mutex_lock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_show_firmware_version()
366 mutex_unlock(&kovaplus->kovaplus_lock); in kovaplus_sysfs_show_firmware_version()
421 mutex_init(&kovaplus->kovaplus_lock); in kovaplus_init_kovaplus_device_struct()
426 &kovaplus->profile_settings[i], i); in kovaplus_init_kovaplus_device_struct()
432 &kovaplus->profile_buttons[i], i); in kovaplus_init_kovaplus_device_struct()
448 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in kovaplus_init_specials()
453 if (intf->cur_altsetting->desc.bInterfaceProtocol in kovaplus_init_specials()
459 return -ENOMEM; in kovaplus_init_specials()
474 kovaplus->chrdev_minor = retval; in kovaplus_init_specials()
475 kovaplus->roccat_claimed = 1; in kovaplus_init_specials()
490 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in kovaplus_remove_specials()
493 if (intf->cur_altsetting->desc.bInterfaceProtocol in kovaplus_remove_specials()
496 if (kovaplus->roccat_claimed) in kovaplus_remove_specials()
497 roccat_disconnect(kovaplus->chrdev_minor); in kovaplus_remove_specials()
508 return -EINVAL; in kovaplus_probe()
552 switch (button_report->type) { in kovaplus_keep_values_up_to_date()
554 kovaplus_profile_activated(kovaplus, button_report->data1 - 1); in kovaplus_keep_values_up_to_date()
557 kovaplus->actual_cpi = kovaplus_convert_event_cpi(button_report->data1); in kovaplus_keep_values_up_to_date()
560 kovaplus->actual_x_sensitivity = button_report->data1; in kovaplus_keep_values_up_to_date()
561 kovaplus->actual_y_sensitivity = button_report->data2; in kovaplus_keep_values_up_to_date()
579 if (button_report->type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_2) in kovaplus_report_to_chrdev()
582 roccat_report.type = button_report->type; in kovaplus_report_to_chrdev()
583 roccat_report.profile = kovaplus->actual_profile + 1; in kovaplus_report_to_chrdev()
589 roccat_report.button = button_report->data1; in kovaplus_report_to_chrdev()
594 roccat_report.data1 = kovaplus_convert_event_cpi(button_report->data1); in kovaplus_report_to_chrdev()
596 roccat_report.data1 = button_report->data1; in kovaplus_report_to_chrdev()
598 roccat_report.data2 = button_report->data2; in kovaplus_report_to_chrdev()
600 roccat_report_event(kovaplus->chrdev_minor, in kovaplus_report_to_chrdev()
607 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in kovaplus_raw_event()
610 if (intf->cur_altsetting->desc.bInterfaceProtocol in kovaplus_raw_event()
619 if (kovaplus->roccat_claimed) in kovaplus_raw_event()