diff options
Diffstat (limited to 'drivers/hid/hid-roccat-pyra.c')
-rw-r--r-- | drivers/hid/hid-roccat-pyra.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/hid/hid-roccat-pyra.c b/drivers/hid/hid-roccat-pyra.c index 38280c055a19..8140776bd8c5 100644 --- a/drivers/hid/hid-roccat-pyra.c +++ b/drivers/hid/hid-roccat-pyra.c @@ -53,7 +53,7 @@ static int pyra_send_control(struct usb_device *usb_dev, int value, control.value = value; control.request = request; - return roccat_common_send(usb_dev, PYRA_USB_COMMAND_CONTROL, + return roccat_common_send(usb_dev, PYRA_COMMAND_CONTROL, &control, sizeof(struct pyra_control)); } @@ -64,7 +64,7 @@ static int pyra_receive_control_status(struct usb_device *usb_dev) do { msleep(10); - retval = roccat_common_receive(usb_dev, PYRA_USB_COMMAND_CONTROL, + retval = roccat_common_receive(usb_dev, PYRA_COMMAND_CONTROL, &control, sizeof(struct pyra_control)); /* requested too early, try again */ @@ -89,7 +89,7 @@ static int pyra_get_profile_settings(struct usb_device *usb_dev, PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); if (retval) return retval; - return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_PROFILE_SETTINGS, + return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, buf, sizeof(struct pyra_profile_settings)); } @@ -101,20 +101,20 @@ static int pyra_get_profile_buttons(struct usb_device *usb_dev, PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); if (retval) return retval; - return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_PROFILE_BUTTONS, + return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, buf, sizeof(struct pyra_profile_buttons)); } static int pyra_get_settings(struct usb_device *usb_dev, struct pyra_settings *buf) { - return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_SETTINGS, + return roccat_common_receive(usb_dev, PYRA_COMMAND_SETTINGS, buf, sizeof(struct pyra_settings)); } static int pyra_get_info(struct usb_device *usb_dev, struct pyra_info *buf) { - return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_INFO, + return roccat_common_receive(usb_dev, PYRA_COMMAND_INFO, buf, sizeof(struct pyra_info)); } @@ -131,26 +131,22 @@ static int pyra_send(struct usb_device *usb_dev, uint command, static int pyra_set_profile_settings(struct usb_device *usb_dev, struct pyra_profile_settings const *settings) { - return pyra_send(usb_dev, PYRA_USB_COMMAND_PROFILE_SETTINGS, settings, + return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, settings, sizeof(struct pyra_profile_settings)); } static int pyra_set_profile_buttons(struct usb_device *usb_dev, struct pyra_profile_buttons const *buttons) { - return pyra_send(usb_dev, PYRA_USB_COMMAND_PROFILE_BUTTONS, buttons, + return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, buttons, sizeof(struct pyra_profile_buttons)); } static int pyra_set_settings(struct usb_device *usb_dev, struct pyra_settings const *settings) { - int retval; - retval = roccat_common_send(usb_dev, PYRA_USB_COMMAND_SETTINGS, settings, + return pyra_send(usb_dev, PYRA_COMMAND_SETTINGS, settings, sizeof(struct pyra_settings)); - if (retval) - return retval; - return pyra_receive_control_status(usb_dev); } static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, @@ -641,6 +637,9 @@ static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report, != USB_INTERFACE_PROTOCOL_MOUSE) return 0; + if (pyra == NULL) + return 0; + pyra_keep_values_up_to_date(pyra, data); if (pyra->roccat_claimed) |