aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-roccat-kone.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hid/hid-roccat-kone.c')
-rw-r--r--drivers/hid/hid-roccat-kone.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
index 5d9ced0defa5..8f35fe22f419 100644
--- a/drivers/hid/hid-roccat-kone.c
+++ b/drivers/hid/hid-roccat-kone.c
@@ -912,6 +912,24 @@ static void kone_remove(struct hid_device *hdev)
912 hid_hw_stop(hdev); 912 hid_hw_stop(hdev);
913} 913}
914 914
915/* handle special events and keep actual profile and dpi values up to date */
916static void kone_keep_values_up_to_date(struct kone_device *kone,
917 struct kone_mouse_event const *event)
918{
919 switch (event->event) {
920 case kone_mouse_event_switch_profile:
921 case kone_mouse_event_osd_profile:
922 kone->actual_profile = event->value;
923 kone->actual_dpi = kone->profiles[kone->actual_profile - 1].
924 startup_dpi;
925 break;
926 case kone_mouse_event_switch_dpi:
927 case kone_mouse_event_osd_dpi:
928 kone->actual_dpi = event->value;
929 break;
930 }
931}
932
915/* 933/*
916 * Is called for keyboard- and mousepart. 934 * Is called for keyboard- and mousepart.
917 * Only mousepart gets informations about special events in its extended event 935 * Only mousepart gets informations about special events in its extended event
@@ -938,41 +956,9 @@ static int kone_raw_event(struct hid_device *hdev, struct hid_report *report,
938 else 956 else
939 memset(&event->tilt, 0, 5); 957 memset(&event->tilt, 0, 5);
940 958
941 /* 959 kone_keep_values_up_to_date(kone, event);
942 * handle special events and keep actual profile and dpi values
943 * up to date
944 */
945 switch (event->event) {
946 case kone_mouse_event_osd_dpi:
947 dev_dbg(&hdev->dev, "osd dpi event. actual dpi %d\n",
948 event->value);
949 return 1; /* return 1 if event was handled */
950 case kone_mouse_event_switch_dpi:
951 kone->actual_dpi = event->value;
952 dev_dbg(&hdev->dev, "switched dpi to %d\n", event->value);
953 return 1;
954 case kone_mouse_event_osd_profile:
955 dev_dbg(&hdev->dev, "osd profile event. actual profile %d\n",
956 event->value);
957 return 1;
958 case kone_mouse_event_switch_profile:
959 kone->actual_profile = event->value;
960 kone->actual_dpi = kone->profiles[kone->actual_profile - 1].
961 startup_dpi;
962 dev_dbg(&hdev->dev, "switched profile to %d\n", event->value);
963 return 1;
964 case kone_mouse_event_call_overlong_macro:
965 dev_dbg(&hdev->dev, "overlong macro called, button %d %s/%s\n",
966 event->macro_key,
967 kone->profiles[kone->actual_profile - 1].
968 button_infos[event->macro_key].macro_set_name,
969 kone->profiles[kone->actual_profile - 1].
970 button_infos[event->macro_key].macro_name
971 );
972 return 1;
973 }
974 960
975 return 0; /* do further processing */ 961 return 0; /* always do further processing */
976} 962}
977 963
978static const struct hid_device_id kone_devices[] = { 964static const struct hid_device_id kone_devices[] = {