Lines Matching +full:control +full:- +full:parent
1 // SPDX-License-Identifier: GPL-2.0-or-later
22 #include <linux/hid-roccat.h>
23 #include "hid-ids.h"
24 #include "hid-roccat-common.h"
25 #include "hid-roccat-pyra.h"
35 if (new_profile >= ARRAY_SIZE(pyra->profile_settings)) in profile_activated()
37 pyra->actual_profile = new_profile; in profile_activated()
38 pyra->actual_cpi = pyra->profile_settings[pyra->actual_profile].y_cpi; in profile_activated()
44 struct roccat_common2_control control; in pyra_send_control() local
49 return -EINVAL; in pyra_send_control()
51 control.command = ROCCAT_COMMON_COMMAND_CONTROL; in pyra_send_control()
52 control.value = value; in pyra_send_control()
53 control.request = request; in pyra_send_control()
56 &control, sizeof(struct roccat_common2_control)); in pyra_send_control()
90 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_read()
99 return -EINVAL; in pyra_sysfs_read()
101 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_read()
103 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_read()
115 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_write()
121 return -EINVAL; in pyra_sysfs_write()
123 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_write()
125 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_write()
180 PYRA_BIN_ATTRIBUTE_W(control, CONTROL);
189 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_read_profilex_settings()
193 retval = pyra_send_control(usb_dev, *(uint *)(attr->private), in pyra_sysfs_read_profilex_settings()
207 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_read_profilex_buttons()
211 retval = pyra_send_control(usb_dev, *(uint *)(attr->private), in pyra_sysfs_read_profilex_buttons()
226 .private = &profile_numbers[number-1], \
232 .private = &profile_numbers[number-1], \
244 struct device *dev = kobj_to_dev(kobj)->parent->parent; in pyra_sysfs_write_settings()
252 return -EINVAL; in pyra_sysfs_write_settings()
255 if (settings->startup_profile >= ARRAY_SIZE(pyra->profile_settings)) in pyra_sysfs_write_settings()
256 return -EINVAL; in pyra_sysfs_write_settings()
258 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_write_settings()
262 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_write_settings()
266 profile_activated(pyra, settings->startup_profile); in pyra_sysfs_write_settings()
269 roccat_report.value = settings->startup_profile + 1; in pyra_sysfs_write_settings()
271 roccat_report_event(pyra->chrdev_minor, in pyra_sysfs_write_settings()
274 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_write_settings()
288 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in pyra_sysfs_show_actual_cpi()
289 return snprintf(buf, PAGE_SIZE, "%d\n", pyra->actual_cpi); in pyra_sysfs_show_actual_cpi()
297 hid_get_drvdata(dev_get_drvdata(dev->parent->parent)); in pyra_sysfs_show_actual_profile()
301 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_show_actual_profile()
304 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_show_actual_profile()
318 dev = dev->parent->parent; in pyra_sysfs_show_firmware_version()
322 mutex_lock(&pyra->pyra_lock); in pyra_sysfs_show_firmware_version()
325 mutex_unlock(&pyra->pyra_lock); in pyra_sysfs_show_firmware_version()
375 mutex_init(&pyra->pyra_lock); in pyra_init_pyra_device_struct()
383 &pyra->profile_settings[i], i); in pyra_init_pyra_device_struct()
395 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in pyra_init_specials()
400 if (intf->cur_altsetting->desc.bInterfaceProtocol in pyra_init_specials()
406 return -ENOMEM; in pyra_init_specials()
421 pyra->chrdev_minor = retval; in pyra_init_specials()
422 pyra->roccat_claimed = 1; in pyra_init_specials()
436 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in pyra_remove_specials()
439 if (intf->cur_altsetting->desc.bInterfaceProtocol in pyra_remove_specials()
442 if (pyra->roccat_claimed) in pyra_remove_specials()
443 roccat_disconnect(pyra->chrdev_minor); in pyra_remove_specials()
453 return -EINVAL; in pyra_probe()
494 switch (button_event->type) { in pyra_keep_values_up_to_date()
496 profile_activated(pyra, button_event->data1 - 1); in pyra_keep_values_up_to_date()
499 pyra->actual_cpi = button_event->data1; in pyra_keep_values_up_to_date()
517 switch (button_event->type) { in pyra_report_to_chrdev()
520 roccat_report.type = button_event->type; in pyra_report_to_chrdev()
521 roccat_report.value = button_event->data1; in pyra_report_to_chrdev()
523 roccat_report_event(pyra->chrdev_minor, in pyra_report_to_chrdev()
529 if (button_event->data2 == PYRA_MOUSE_EVENT_BUTTON_PRESS) { in pyra_report_to_chrdev()
530 roccat_report.type = button_event->type; in pyra_report_to_chrdev()
531 roccat_report.key = button_event->data1; in pyra_report_to_chrdev()
533 * pyra reports profile numbers with range 1-5. in pyra_report_to_chrdev()
536 roccat_report.value = pyra->actual_profile + 1; in pyra_report_to_chrdev()
537 roccat_report_event(pyra->chrdev_minor, in pyra_report_to_chrdev()
547 struct usb_interface *intf = to_usb_interface(hdev->dev.parent); in pyra_raw_event()
550 if (intf->cur_altsetting->desc.bInterfaceProtocol in pyra_raw_event()
559 if (pyra->roccat_claimed) in pyra_raw_event()
591 pyra_class->dev_groups = pyra_groups; in pyra_init()