ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
device_vtable.c
Go to the documentation of this file.
1 #include "command.h"
2 #include "device.h"
3 #include "dpi.h"
4 #include "firmware.h"
5 #include "input.h"
6 #include "led.h"
7 #include "notify.h"
8 #include "profile.h"
9 
10 // Do-nothing functions
11 static void cmd_none(usbdevice* kb, usbmode* dummy1, int dummy2, int dummy3, const char* dummy4){
12  (void)kb;
13  (void)dummy1;
14  (void)dummy2;
15  (void)dummy3;
16  (void)dummy4;
17 }
18 static int cmd_io_none(usbdevice* kb, usbmode* dummy1, int dummy2, int dummy3, const char* dummy4){
19  (void)kb;
20  (void)dummy1;
21  (void)dummy2;
22  (void)dummy3;
23  (void)dummy4;
24 
25  return 0;
26 }
27 static void cmd_macro_none(usbdevice* kb, usbmode* dummy1, int dummy2, const char* dummy3, const char* dummy4){
28  (void)kb;
29  (void)dummy1;
30  (void)dummy2;
31  (void)dummy3;
32  (void)dummy4;
33 }
34 static int loadprofile_none(usbdevice* kb){
35  (void)kb;
36 
37  return 0;
38 }
39 static void int1_void_none(usbdevice* kb, int dummy){
40  (void)kb;
41  (void)dummy;
42 }
43 static int int1_int_none(usbdevice* kb, int dummy){
44  (void)kb;
45  (void)dummy;
46 
47  return 0;
48 }
49 
53  .hwload = cmd_hwload_kb,
54  .hwsave = cmd_hwsave_kb,
55  .fwupdate = cmd_fwupdate,
56  .pollrate = cmd_io_none,
57 
58  .active = cmd_active_kb,
59  .idle = cmd_idle_kb,
60 
61  .erase = cmd_erase,
62  .eraseprofile = cmd_eraseprofile,
63  .name = cmd_name,
64  .profilename = cmd_profilename,
65  .id = cmd_id,
66  .profileid = cmd_profileid,
67 
68  .rgb = cmd_rgb,
69  .ioff = cmd_ioff,
70  .ion = cmd_ion,
71  .iauto = cmd_iauto,
72 
73  .bind = cmd_bind,
74  .unbind = cmd_unbind,
75  .rebind = cmd_rebind,
76  .macro = cmd_macro,
77 
78  .dpi = cmd_macro_none,
79  .dpisel = cmd_none,
80  .lift = cmd_none,
81  .snap = cmd_none,
82 
83  .notify = cmd_notify,
84  .inotify = cmd_inotify,
85  .get = cmd_get,
86  .restart = cmd_restart,
87 
88  .start = start_dev,
89  .setmodeindex = int1_void_none,
90  .allocprofile = allocprofile,
91  .loadprofile = loadprofile,
92  .freeprofile = freeprofile,
93  .updatergb = updatergb_kb,
94  .updateindicators = updateindicators_kb,
95  .updatedpi = int1_int_none
96 };
97 
98 // Non-RGB keyboard vtable (K70)
100  .hwload = cmd_io_none,
101  .hwsave = cmd_io_none,
102  .fwupdate = cmd_io_none,
103  .pollrate = cmd_io_none,
104 
105  .active = cmd_io_none,
106  .idle = cmd_io_none,
107 
108  .erase = cmd_erase,
109  .eraseprofile = cmd_eraseprofile,
110  .name = cmd_name,
111  .profilename = cmd_profilename,
112  .id = cmd_id,
113  .profileid = cmd_profileid,
114 
115  .rgb = cmd_none,
116  .ioff = cmd_ioff,
117  .ion = cmd_ion,
118  .iauto = cmd_iauto,
119 
120  .bind = cmd_bind,
121  .unbind = cmd_unbind,
122  .rebind = cmd_rebind,
123  .macro = cmd_macro,
124 
125  .dpi = cmd_macro_none,
126  .dpisel = cmd_none,
127  .lift = cmd_none,
128  .snap = cmd_none,
129 
130  .notify = cmd_notify,
131  .inotify = cmd_inotify,
132  .get = cmd_get,
133  .restart = cmd_restart,
134 
135  .start = start_kb_nrgb,
136  .setmodeindex = setmodeindex_nrgb,
137  .allocprofile = allocprofile,
138  .loadprofile = loadprofile_none,
139  .freeprofile = freeprofile,
140  .updatergb = int1_int_none,
141  .updateindicators = updateindicators_kb,
142  .updatedpi = int1_int_none
143 };
144 
145 // RGB mouse vtable
147  .hwload = cmd_hwload_mouse,
148  .hwsave = cmd_hwsave_mouse,
149  .fwupdate = cmd_fwupdate,
150  .pollrate = cmd_pollrate,
151 
152  .active = cmd_active_mouse,
153  .idle = cmd_idle_mouse,
154 
155  .erase = cmd_erase,
156  .eraseprofile = cmd_eraseprofile,
157  .name = cmd_name,
158  .profilename = cmd_profilename,
159  .id = cmd_id,
160  .profileid = cmd_profileid,
161 
162  .rgb = cmd_rgb,
163  .ioff = cmd_none,
164  .ion = cmd_none,
165  .iauto = cmd_none,
166 
167  .bind = cmd_bind,
168  .unbind = cmd_unbind,
169  .rebind = cmd_rebind,
170  .macro = cmd_macro,
171 
172  .dpi = cmd_dpi,
173  .dpisel = cmd_dpisel,
174  .lift = cmd_lift,
175  .snap = cmd_snap,
176 
177  .notify = cmd_notify,
178  .inotify = cmd_none,
179  .get = cmd_get,
180  .restart = cmd_restart,
181 
182  .start = start_dev,
183  .setmodeindex = int1_void_none,
184  .allocprofile = allocprofile,
185  .loadprofile = loadprofile,
186  .freeprofile = freeprofile,
187  .updatergb = updatergb_mouse,
188  .updateindicators = int1_void_none,
189  .updatedpi = updatedpi
190 };
void cmd_ioff(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *led)
Definition: led.c:41
void freeprofile(usbdevice *kb)
Definition: profile.c:253
Definition: command.h:73
void cmd_dpi(usbdevice *kb, usbmode *mode, int dummy, const char *stages, const char *values)
Definition: dpi.c:4
void cmd_lift(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *height)
Definition: dpi.c:60
void updateindicators_kb(usbdevice *kb, int force)
Definition: input.c:261
int updatergb_mouse(usbdevice *kb, int force)
Definition: led_mouse.c:20
void cmd_id(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *id)
Definition: profile.c:168
int start_dev(usbdevice *kb, int makeactive)
Definition: device.c:89
int cmd_hwload_mouse(usbdevice *kb, usbmode *dummy1, int dummy2, int apply, const char *dummy3)
Definition: profile_mouse.c:6
int cmd_hwsave_mouse(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: profile_mouse.c:54
static int loadprofile_none(usbdevice *kb)
Definition: device_vtable.c:34
void cmd_rgb(usbdevice *kb, usbmode *mode, int dummy, int keyindex, const char *code)
Definition: led.c:6
static int cmd_io_none(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: device_vtable.c:18
int updatedpi(usbdevice *kb, int force)
Definition: dpi.c:106
const devcmd vtable_mouse
void cmd_name(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *name)
Definition: profile.c:117
void cmd_inotify(usbdevice *kb, usbmode *mode, int nnumber, int dummy, const char *led)
Definition: led.c:74
int updatergb_kb(usbdevice *kb, int force)
Definition: led_keyboard.c:79
int start_kb_nrgb(usbdevice *kb, int makeactive)
int cmd_hwload_kb(usbdevice *kb, usbmode *dummy1, int dummy2, int apply, const char *dummy3)
void cmd_profilename(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *name)
Definition: profile.c:128
void cmd_unbind(usbdevice *kb, usbmode *mode, int dummy, int keyindex, const char *to)
Definition: input.c:331
void cmd_snap(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *enable)
Definition: dpi.c:73
void allocprofile(usbdevice *kb)
Definition: profile.c:198
int cmd_active_mouse(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: device_mouse.c:44
void cmd_profileid(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *id)
Definition: profile.c:179
void cmd_notify(usbdevice *kb, usbmode *mode, int nnumber, int keyindex, const char *toggle)
Definition: notify.c:61
void cmd_macro(usbdevice *kb, usbmode *mode, const int notifynumber, const char *keys, const char *assignment)
Definition: input.c:475
void cmd_get(usbdevice *kb, usbmode *mode, int nnumber, int dummy, const char *setting)
Definition: notify.c:215
int cmd_hwsave_kb(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
static void cmd_none(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: device_vtable.c:11
int cmd_idle_kb(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
void cmd_bind(usbdevice *kb, usbmode *mode, int dummy, int keyindex, const char *to)
Definition: input.c:307
int cmd_idle_mouse(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: device_mouse.c:53
void cmd_dpisel(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *stage)
Definition: dpi.c:47
void setmodeindex_nrgb(usbdevice *kb, int index)
void cmd_erase(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *dummy3)
Definition: profile.c:219
void cmd_restart(usbdevice *kb, usbmode *mode, int nnumber, int dummy, const char *content)
Definition: notify.c:225
static void cmd_macro_none(usbdevice *kb, usbmode *dummy1, int dummy2, const char *dummy3, const char *dummy4)
Definition: device_vtable.c:27
static int int1_int_none(usbdevice *kb, int dummy)
Definition: device_vtable.c:43
int cmd_fwupdate(usbdevice *kb, usbmode *dummy1, int nnumber, int dummy2, const char *path)
Definition: firmware.c:154
int cmd_active_kb(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
static void int1_void_none(usbdevice *kb, int dummy)
Definition: device_vtable.c:39
const devcmd vtable_keyboard
RGB keyboard vtable holds functions for each device type.
Definition: device_vtable.c:52
void cmd_iauto(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *led)
Definition: led.c:63
void cmd_rebind(usbdevice *kb, usbmode *mode, int dummy, int keyindex, const char *to)
Definition: input.c:342
int cmd_pollrate(usbdevice *kb, usbmode *dummy1, int dummy2, int rate, const char *dummy3)
Definition: device_mouse.c:62
void cmd_eraseprofile(usbdevice *kb, usbmode *dummy1, int dummy2, int dummy3, const char *dummy4)
Definition: profile.c:241
const devcmd vtable_keyboard_nonrgb
Definition: device_vtable.c:99
int loadprofile(usbdevice *kb)
Definition: profile.c:208
void cmd_ion(usbdevice *kb, usbmode *mode, int dummy1, int dummy2, const char *led)
Definition: led.c:52