blob: f170b9b4630939c858cb5f5888f4d647314931d9 [file] [log] [blame]
Jon West7d881402021-04-15 08:42:42 -04001#include "razerchromacommon.h"
2
3
4static unsigned char orochi2011_led[] = { 0x01, 0x00, 0x00, 0x06, 0x48, 0x00, 0x00, 0x00, 0x01, 0xFF, 0x03, 0x05, 0x06, 0x06, 0x10, 0x10, 0x10, 0x10, 0x24, 0x24, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x01, 0x01, 0x03, 0x03, 0x04, 0x01, 0x04, 0x04, 0x01, 0x01, 0x05, 0x05, 0x01, 0x01, 0x06, 0x31, 0x88, 0x00, 0x07, 0x31, 0x87, 0x00, 0x08, 0x08, 0x01, 0x01, 0x09, 0x09, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x01 };
5static unsigned char orochi2011_dpi[] = { 0x01, 0x00, 0x00, 0x05, 0x05, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x4c, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 };
6
7/*
8 * Standard Device Functions
9 */
10
11/**
12 * Set what mode the device will operate in.
13 *
14 * Currently known modes
15 * 0x00, 0x00: Normal Mode
16 * 0x02, 0x00: Unknown Mode
17 * 0x03, 0x00: Driver Mode
18 *
19 * 0x02, 0x00 Will make M1-5 and FN emit normal keystrokes. Some sort of factory test mode. Not recommended to be used.
20 */
21struct razer_report razer_chroma_standard_set_device_mode(unsigned char mode, unsigned char param)
22{
23 struct razer_report report = get_razer_report(0x00, 0x04, 0x02);
24
25 if(mode != 0x00 && mode != 0x03) { // Explicitly blocking the 0x02 mode
26 mode = 0x00;
27 }
28 if(param != 0x00) {
29 param = 0x00;
30 }
31
32 report.arguments[0] = mode;
33 report.arguments[1] = param;
34
35 return report;
36}
37
38/**
39 * Get what mode the device is operating in.
40 *
41 * Currently known modes
42 * 0x00, 0x00: Normal Mode
43 * 0x02, 0x00: Unknown Mode
44 * 0x03, 0x00: Driver Mode
45 *
46 * 0x02, 0x00 Will make M1-5 and FN emit normal keystrokes. Some sort of factory test mode. Not recommended to be used.
47 */
48struct razer_report razer_chroma_standard_get_device_mode(void)
49{
50 return get_razer_report(0x00, 0x84, 0x02);
51}
52
53/**
54 * Get serial from device
55 */
56struct razer_report razer_chroma_standard_get_serial(void)
57{
58 return get_razer_report(0x00, 0x82, 0x16);
59}
60
61/**
62 * Get firmware version from device
63 */
64struct razer_report razer_chroma_standard_get_firmware_version(void)
65{
66 return get_razer_report(0x00, 0x81, 0x02);
67}
68
69/*
70 * Standard Functions
71 */
72
73/**
74 * Set the state of an LED on the device
75 *
76 * Status Trans Packet Proto DataSize Class CMD Args
77 * 00 3f 0000 00 03 03 00 010801 | SET LED STATE (VARSTR, GAMEMODE, ON)
78 * 00 3f 0000 00 03 03 00 010800 | SET LED STATE (VARSTR, GAMEMODE, OFF)
79 */
80struct razer_report razer_chroma_standard_set_led_state(unsigned char variable_storage, unsigned char led_id, unsigned char led_state)
81{
82 struct razer_report report = get_razer_report(0x03, 0x00, 0x03);
83 report.arguments[0] = variable_storage;
84 report.arguments[1] = led_id;
85 report.arguments[2] = clamp_u8(led_state, 0x00, 0x01);
86
87 return report;
88}
89
90struct razer_report razer_chroma_standard_set_led_blinking(unsigned char variable_storage, unsigned char led_id)
91{
92 struct razer_report report = get_razer_report(0x03, 0x04, 0x04);
93 report.arguments[0] = variable_storage;
94 report.arguments[1] = led_id;
95 report.arguments[2] = 0x05;
96 report.arguments[3] = 0x05;
97
98 return report;
99}
100
101/**
102 * Get the state of an LED on the device
103 */
104struct razer_report razer_chroma_standard_get_led_state(unsigned char variable_storage, unsigned char led_id)
105{
106 struct razer_report report = get_razer_report(0x03, 0x80, 0x03);
107 report.arguments[0] = variable_storage;
108 report.arguments[1] = led_id;
109
110 return report;
111}
112
113
114/**
115 * Set LED RGB parameters
116 */
117struct razer_report razer_chroma_standard_set_led_rgb(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1)
118{
119 struct razer_report report = get_razer_report(0x03, 0x01, 0x05);
120 report.arguments[0] = variable_storage;
121 report.arguments[1] = led_id;
122 report.arguments[2] = rgb1->r;
123 report.arguments[3] = rgb1->g;
124 report.arguments[4] = rgb1->b;
125
126 return report;
127}
128
129/**
130 * Get LED RGB parameters
131 */
132struct razer_report razer_chroma_standard_get_led_rgb(unsigned char variable_storage, unsigned char led_id)
133{
134 struct razer_report report = get_razer_report(0x03, 0x81, 0x05);
135 report.arguments[0] = variable_storage;
136 report.arguments[1] = led_id;
137 return report;
138}
139
140
141
142
143
144/**
145 * Set the effect of an LED on the device
146 *
147 * Status Trans Packet Proto DataSize Class CMD Args
148 * ? TODO fill this
149 */
150struct razer_report razer_chroma_standard_set_led_effect(unsigned char variable_storage, unsigned char led_id, unsigned char led_effect)
151{
152 struct razer_report report = get_razer_report(0x03, 0x02, 0x03);
153 report.arguments[0] = variable_storage;
154 report.arguments[1] = led_id;
155 report.arguments[2] = clamp_u8(led_effect, 0x00, 0x05);
156
157 return report;
158}
159
160/**
161 * Get the effect of an LED on the device
162 *
163 * Status Trans Packet Proto DataSize Class CMD Args
164 * ? TODO fill this
165 */
166struct razer_report razer_chroma_standard_get_led_effect(unsigned char variable_storage, unsigned char led_id)
167{
168 struct razer_report report = get_razer_report(0x03, 0x82, 0x03);
169 report.arguments[0] = variable_storage;
170 report.arguments[1] = led_id;
171
172 return report;
173}
174
175/**
176 * Set the brightness of an LED on the device
177 *
178 * Status Trans Packet Proto DataSize Class CMD Args
179 * ? TODO fill this
180 */
181struct razer_report razer_chroma_standard_set_led_brightness(unsigned char variable_storage, unsigned char led_id, unsigned char brightness)
182{
183 struct razer_report report = get_razer_report(0x03, 0x03, 0x03);
184 report.arguments[0] = variable_storage;
185 report.arguments[1] = led_id;
186 report.arguments[2] = brightness;
187
188 return report;
189}
190
191/**
192 * Get the brightness of an LED on the device
193 *
194 * Status Trans Packet Proto DataSize Class CMD Args
195 * ? TODO fill this
196 */
197struct razer_report razer_chroma_standard_get_led_brightness(unsigned char variable_storage, unsigned char led_id)
198{
199 struct razer_report report = get_razer_report(0x03, 0x83, 0x03);
200 report.arguments[0] = variable_storage;
201 report.arguments[1] = led_id;
202
203 return report;
204}
205
206
207/*
208 * Standard Matrix Effects Functions
209 */
210
211// TODO remove varstore and led_id
212/**
213 * Set the effect of the LED matrix to None
214 *
215 * Status Trans Packet Proto DataSize Class CMD Args
216 * ? TODO fill this
217 */
218struct razer_report razer_chroma_standard_matrix_effect_none(unsigned char variable_storage, unsigned char led_id)
219{
220 struct razer_report report = get_razer_report(0x03, 0x0A, 0x01);
221 report.arguments[0] = 0x00; // Effect ID
222
223 return report;
224}
225
226/**
227 * Set the effect of the LED matrix to Wave
228 *
229 * Status Trans Packet Proto DataSize Class CMD Args
230 * ? TODO fill this
231 */
232struct razer_report razer_chroma_standard_matrix_effect_wave(unsigned char variable_storage, unsigned char led_id, unsigned char wave_direction)
233{
234 struct razer_report report = get_razer_report(0x03, 0x0A, 0x02);
235 report.arguments[0] = 0x01; // Effect ID
236 report.arguments[1] = clamp_u8(wave_direction, 0x01, 0x02);
237
238 return report;
239}
240
241/**
242 * Set the effect of the LED matrix to Spectrum
243 *
244 * Status Trans Packet Proto DataSize Class CMD Args
245 * ? TODO fill this
246 */
247struct razer_report razer_chroma_standard_matrix_effect_spectrum(unsigned char variable_storage, unsigned char led_id)
248{
249 struct razer_report report = get_razer_report(0x03, 0x0A, 0x01);
250 report.arguments[0] = 0x04; // Effect ID
251
252 return report;
253}
254
255/**
256 * Set the effect of the LED matrix to Reactive
257 *
258 * Status Trans Packet Proto DataSize Class CMD Args
259 * ? TODO fill this
260 */
261struct razer_report razer_chroma_standard_matrix_effect_reactive(unsigned char variable_storage, unsigned char led_id, unsigned char speed, struct razer_rgb *rgb1)
262{
263 struct razer_report report = get_razer_report(0x03, 0x0A, 0x05);
264 report.arguments[0] = 0x02; // Effect ID
265 report.arguments[1] = clamp_u8(speed, 0x01, 0x04); // Time
266 report.arguments[2] = rgb1->r; /*rgb color definition*/
267 report.arguments[3] = rgb1->g;
268 report.arguments[4] = rgb1->b;
269
270 return report;
271}
272
273/**
274 * Set the effect of the LED matrix to Static
275 *
276 * Status Trans Packet Proto DataSize Class CMD Args
277 * ? TODO fill this
278 */
279struct razer_report razer_chroma_standard_matrix_effect_static(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1)
280{
281 struct razer_report report = get_razer_report(0x03, 0x0A, 0x04);
282 report.arguments[0] = 0x06; // Effect ID
283 report.arguments[1] = rgb1->r; /*rgb color definition*/
284 report.arguments[2] = rgb1->g;
285 report.arguments[3] = rgb1->b;
286
287 return report;
288}
289
290/**
291 * Set the effect of the LED matrix to Starlight
292 *
293 * Status Trans Packet Proto DataSize Class CMD Args
294 * ? TODO fill this
295 */
296struct razer_report razer_chroma_standard_matrix_effect_starlight_single(unsigned char variable_storage, unsigned char led_id, unsigned char speed, struct razer_rgb *rgb1)
297{
298 struct razer_report report = get_razer_report(0x03, 0x0A, 0x01);
299
300 speed = clamp_u8(speed, 0x01, 0x03); // For now only seen
301
302 report.arguments[0] = 0x19; // Effect ID
303 report.arguments[1] = 0x01; // Type one color
304 report.arguments[2] = speed; // Speed
305
306 report.arguments[3] = rgb1->r; // Red 1
307 report.arguments[4] = rgb1->g; // Green 1
308 report.arguments[5] = rgb1->b; // Blue 1
309
310 // For now haven't seen any chroma using this, seen the extended version
311 report.arguments[6] = 0x00; // Red 2
312 report.arguments[7] = 0x00; // Green 2
313 report.arguments[8] = 0x00; // Blue 2
314
315 return report;
316}
317
318/**
319 * Set the effect of the LED matrix to Starlight
320 *
321 * Status Trans Packet Proto DataSize Class CMD Args
322 * ? TODO fill this
323 */
324struct razer_report razer_chroma_standard_matrix_effect_starlight_dual(unsigned char variable_storage, unsigned char led_id, unsigned char speed, struct razer_rgb *rgb1, struct razer_rgb *rgb2)
325{
326 struct razer_report report = get_razer_report(0x03, 0x0A, 0x01);
327
328 speed = clamp_u8(speed, 0x01, 0x03); // For now only seen
329
330 report.arguments[0] = 0x19; // Effect ID
331 report.arguments[1] = 0x02; // Type two color
332 report.arguments[2] = speed; // Speed
333
334 report.arguments[3] = rgb1->r; // Red 1
335 report.arguments[4] = rgb1->g; // Green 1
336 report.arguments[5] = rgb1->b; // Blue 1
337
338 report.arguments[6] = rgb2->r; // Red 2
339 report.arguments[7] = rgb2->g; // Green 2
340 report.arguments[8] = rgb2->b; // Blue 2
341
342 return report;
343}
344
345struct razer_report razer_chroma_standard_matrix_effect_starlight_random(unsigned char variable_storage, unsigned char led_id, unsigned char speed)
346{
347 struct razer_report report = get_razer_report(0x03, 0x0A, 0x01);
348
349 speed = clamp_u8(speed, 0x01, 0x03); // For now only seen
350
351 report.arguments[0] = 0x19; // Effect ID
352 report.arguments[1] = 0x03; // Type random color
353 report.arguments[2] = speed; // Speed
354
355 return report;
356}
357
358/**
359 * Set the device to "Breathing" effect
360 *
361 * Status Trans Packet Proto DataSize Class CMD Args
362 * ??
363 * ??
364 * ??
365 */
366struct razer_report razer_chroma_standard_matrix_effect_breathing_random(unsigned char variable_storage, unsigned char led_id)
367{
368 struct razer_report report = get_razer_report(0x03, 0x0A, 0x08);
369 report.arguments[0] = 0x03; // Effect ID
370 report.arguments[1] = 0x03; // Breathing type
371
372 return report;
373}
374struct razer_report razer_chroma_standard_matrix_effect_breathing_single(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1)
375{
376 struct razer_report report = get_razer_report(0x03, 0x0A, 0x08);
377 report.arguments[0] = 0x03; // Effect ID
378 report.arguments[1] = 0x01; // Breathing type
379 report.arguments[2] = rgb1->r;
380 report.arguments[3] = rgb1->g;
381 report.arguments[4] = rgb1->b;
382
383 return report;
384}
385struct razer_report razer_chroma_standard_matrix_effect_breathing_dual(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1, struct razer_rgb *rgb2)
386{
387 struct razer_report report = get_razer_report(0x03, 0x0A, 0x08);
388 report.arguments[0] = 0x03; // Effect ID
389 report.arguments[1] = 0x02; // Breathing type
390 report.arguments[2] = rgb1->r;
391 report.arguments[3] = rgb1->g;
392 report.arguments[4] = rgb1->b;
393 report.arguments[5] = rgb2->r;
394 report.arguments[6] = rgb2->g;
395 report.arguments[7] = rgb2->b;
396
397 return report;
398}
399
400/**
401 * Set the device to "Custom" effect
402 *
403 * Status Trans Packet Proto DataSize Class CMD Args
404 * ??
405 *
406 * Apparently Ultimate2016, Stealth and Stealth2016 need frame id to be 0x00, I don't think it's needed (depending on set_custom_frame)
407 */
408struct razer_report razer_chroma_standard_matrix_effect_custom_frame(unsigned char variable_storage)
409{
410 struct razer_report report = get_razer_report(0x03, 0x0A, 0x02);
411 report.arguments[0] = 0x05; // Effect ID
412 report.arguments[1] = variable_storage; // Data frame ID
413 // report.arguments[1] = 0x01; // Data frame ID
414
415 return report;
416}
417
418/**
419 * Set the RGB or a row
420 *
421 * Start and stop columns are inclusive
422 *
423 * This sets the colour of a row on the keyboard. Takes in an array of RGB bytes.
424 * The mappings below are correct for the BlackWidow Chroma. The BlackWidow Ultimate 2016
425 * contains LEDs under the spacebar and the FN key so there will be changes once I get the
426 * hardware.
427 *
428 * Row 0:
429 * 0 Unused
430 * 1 ESC
431 * 2 Unused
432 * 3-14 F1-F12
433 * 15-17 PrtScr, ScrLk, Pause
434 * 18-19 Unused
435 * 20 Razer Logo
436 * 21 Unused
437 *
438 * Row 1:
439 * 0-21 M1 -> NP Minus
440 *
441 * Row 2:
442 * 0-13 M2 -> Right Square Bracket ]
443 * 14 Unused
444 * 15-21 Delete -> NP Plus
445 *
446 * Row 3:
447 * 0-14 M3 -> Return
448 * 15-17 Unused
449 * 18-20 NP4 -> NP6
450 *
451 * Row 4:
452 * 0-12 M4 -> Forward Slash /
453 * 13 Unused
454 * 14 Right Shift
455 * 15 Unused
456 * 16 Up Arrow Key
457 * 17 Unused
458 * 18-21 NP1 -> NP Enter
459 *
460 * Row 5:
461 * 0-3 M5 -> Alt
462 * 4-10 Unused
463 * 11 Alt GR
464 * 12 Unused
465 * 13-17 Context Menu Key -> Right Arrow Key
466 * 18 Unused
467 * 19-20 NP0 -> NP.
468 * 21 Unused
469 */
470struct razer_report razer_chroma_standard_matrix_set_custom_frame(unsigned char row_index, unsigned char start_col, unsigned char stop_col, unsigned char *rgb_data)
471{
472 size_t row_length = (size_t) (((stop_col + 1) - start_col) * 3);
473 struct razer_report report = get_razer_report(0x03, 0x0B, 0x46); // In theory should be able to leave data size at max as we have start/stop
474 int index = 4 + (start_col * 3);
475
476 // printk(KERN_ALERT "razerkbd: Row ID: %d, Start: %d, Stop: %d, row length: %d\n", row_index, start_col, stop_col, (unsigned char)row_length);
477
478 report.arguments[0] = 0xFF; // Frame ID
479 report.arguments[1] = row_index;
480 report.arguments[2] = start_col;
481 report.arguments[3] = stop_col;
482 memcpy(&report.arguments[index], rgb_data, row_length);
483
484 return report;
485}
486
487
488/*
489 * Extended Matrix Effects
490 */
491
492/**
493 * Sets up the extended matrix effect payload
494 */
495struct razer_report razer_chroma_extended_matrix_effect_base(unsigned char arg_size, unsigned char variable_storage, unsigned char led_id, unsigned char effect_id)
496{
497 struct razer_report report = get_razer_report(0x0F, 0x02, arg_size);
498 report.transaction_id.id = 0x3F;
499
500 report.arguments[0] = variable_storage;
501 report.arguments[1] = led_id;
502 report.arguments[2] = effect_id; // Effect ID
503
504 return report;
505}
506
507/**
508 * Set the device to "None" effect
509 *
510 * Status Trans Packet Proto DataSize Class CMD Args
511 * 00 3f 0000 00 06 0f 02 010500000000 | SET LED MATRIX Effect (VARSTR, Backlight, None 0x00, 0x000000)
512 */
513struct razer_report razer_chroma_extended_matrix_effect_none(unsigned char variable_storage, unsigned char led_id)
514{
515 return razer_chroma_extended_matrix_effect_base(0x06, variable_storage, led_id, 0x00);
516}
517
518/**
519 * Set the device to "Static" effect
520 *
521 * Status Trans Packet Proto DataSize Class CMD Args
522 * 00 3f 0000 00 09 0f 02 010501000001ff0000 | SET LED MATRIX Effect (VARSTR, Backlight, Static 0x01, ? 0x000001, RGB 0xFF0000)
523 * 00 3f 0000 00 09 0f 02 01050100000100ff00 | SET LED MATRIX Effect (VARSTR, Backlight, Static 0x01, ? 0x000001, RGB 0x00FF00)
524 * 00 3f 0000 00 09 0f 02 010501000001008000 | SET LED MATRIX Effect (VARSTR, Backlight, Static 0x01, ? 0x000001, RGB 0x008000)
525 */
526struct razer_report razer_chroma_extended_matrix_effect_static(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb)
527{
528 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x09, variable_storage, led_id, 0x01);
529
530 report.arguments[5] = 0x01;
531 report.arguments[6] = rgb->r;
532 report.arguments[7] = rgb->g;
533 report.arguments[8] = rgb->b;
534 return report;
535}
536
537/**
538 * Set the device to "Wave" effect
539 *
540 * Seems like direction is now 0x00, 0x01 for Left/Right, used to be 0x01, 0x02
541 *
542 * Status Trans Packet Proto DataSize Class CMD Args
543 * 00 3f 0000 00 06 0f 02 010504002800 | SET LED MATRIX Effect (VARSTR, Backlight, Wave 0x04, Dir 0x00, ? 0x2800)
544 * 00 3f 0000 00 06 0f 02 010504012800 | SET LED MATRIX Effect (VARSTR, Backlight, Wave 0x04, Dir 0x01, ? 0x2800)
545 */
546struct razer_report razer_chroma_extended_matrix_effect_wave(unsigned char variable_storage, unsigned char led_id, unsigned char direction)
547{
548 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x06, variable_storage, led_id, 0x04);
549
550 // Some devices use values 0x00, 0x01
551 // Others use values 0x01, 0x02
552 direction = clamp_u8(direction, 0x00, 0x02);
553
554 report.arguments[3] = direction;
555 report.arguments[4] = 0x28; // Unknown
556 return report;
557}
558
559/**
560 * Set the device to "Starlight" effect
561 *
562 * Speed is 0x01 - 0x03
563 *
564 * Status Trans Packet Proto DataSize Class CMD Args
565 * 00 3f 0000 00 06 0f 02 010507000100 | SET LED MATRIX Effect (VARSTR, Backlight, Starlight 0x07, ? 0x00, Speed 0x01, Colours 0x00)
566 * 00 3f 0000 00 06 0f 02 010507000200 | SET LED MATRIX Effect (VARSTR, Backlight, Starlight 0x07, ? 0x00, Speed 0x02, Colours 0x00)
567 * 00 3f 0000 00 06 0f 02 010507000300 | SET LED MATRIX Effect (VARSTR, Backlight, Starlight 0x07, ? 0x00, Speed 0x03, Colours 0x00)
568 * 00 3f 0000 00 09 0f 02 010507000301ff0000 | SET LED MATRIX Effect (VARSTR, Backlight, Starlight 0x07, ? 0x00, Speed 0x03, Colours 0x01, RGB 0xFF0000)
569 * 00 3f 0000 00 0c 0f 02 010507000302ff000000ff00 | SET LED MATRIX Effect (VARSTR, Backlight, Starlight 0x07, ? 0x00, Speed 0x03, Colours 0x02, RGB 0xFF0000, RGB 0x00FF00)
570 */
571struct razer_report razer_chroma_extended_matrix_effect_starlight_random(unsigned char variable_storage, unsigned char led_id, unsigned char speed)
572{
573 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x06, variable_storage, led_id, 0x07);
574
575 speed = clamp_u8(speed, 0x01, 0x03);
576
577 report.arguments[4] = speed;
578 return report;
579}
580struct razer_report razer_chroma_extended_matrix_effect_starlight_single(unsigned char variable_storage, unsigned char led_id, unsigned char speed, struct razer_rgb *rgb1)
581{
582 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x09, variable_storage, led_id, 0x07);
583
584 speed = clamp_u8(speed, 0x01, 0x03);
585
586 report.arguments[4] = speed;
587 report.arguments[5] = 0x01;
588 report.arguments[6] = rgb1->r;
589 report.arguments[7] = rgb1->g;
590 report.arguments[8] = rgb1->b;
591
592 return report;
593}
594struct razer_report razer_chroma_extended_matrix_effect_starlight_dual(unsigned char variable_storage, unsigned char led_id, unsigned char speed, struct razer_rgb *rgb1, struct razer_rgb *rgb2)
595{
596 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x0C, variable_storage, led_id, 0x07);
597
598 speed = clamp_u8(speed, 0x01, 0x03);
599
600 report.arguments[4] = speed;
601 report.arguments[5] = 0x02;
602 report.arguments[6] = rgb1->r;
603 report.arguments[7] = rgb1->g;
604 report.arguments[8] = rgb1->b;
605 report.arguments[9] = rgb2->r;
606 report.arguments[10] = rgb2->g;
607 report.arguments[11] = rgb2->b;
608
609 return report;
610}
611
612/**
613 * Set the device to "Spectrum" effect
614 *
615 * Status Trans Packet Proto DataSize Class CMD Args
616 * 00 3f 0000 00 06 0f 02 010503000000 | SET LED MATRIX Effect (VARSTR, Backlight, Spectrum 0x03, 0x000000)
617 */
618struct razer_report razer_chroma_extended_matrix_effect_spectrum(unsigned char variable_storage, unsigned char led_id)
619{
620 return razer_chroma_extended_matrix_effect_base(0x06, variable_storage, led_id, 0x03);
621}
622
623/**
624 * Set the device to "Reactive" effect
625 *
626 * Status Trans Packet Proto DataSize Class CMD Args
627 * 00 3f 0000 00 09 0f 02 010505000101ffff00 | SET LED MATRIX Effect (VARSTR, Backlight, Reactive 0x05, ? 0x00, Speed 0x01, Colours 0x01, RGB 0xFFFF00)
628 * 00 3f 0000 00 09 0f 02 010505000101ff0000 | SET LED MATRIX Effect (VARSTR, Backlight, Reactive 0x05, ? 0x00, Speed 0x02, Colours 0x01, RGB 0xFF0000)
629 * 00 3f 0000 00 09 0f 02 010505000301ff0000 | SET LED MATRIX Effect (VARSTR, Backlight, Reactive 0x05, ? 0x00, Speed 0x03, Colours 0x01, RGB 0xFF0000)
630 * 00 3f 0000 00 09 0f 02 010505000401ff0000 | SET LED MATRIX Effect (VARSTR, Backlight, Reactive 0x05, ? 0x00, Speed 0x04, Colours 0x01, RGB 0xFF0000)
631 */
632struct razer_report razer_chroma_extended_matrix_effect_reactive(unsigned char variable_storage, unsigned char led_id, unsigned char speed, struct razer_rgb *rgb)
633{
634 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x09, variable_storage, led_id, 0x05);
635
636 speed = clamp_u8(speed, 0x01, 0x04);
637
638 report.arguments[4] = speed;
639 report.arguments[5] = 0x01;
640 report.arguments[6] = rgb->r;
641 report.arguments[7] = rgb->g;
642 report.arguments[8] = rgb->b;
643
644 return report;
645}
646
647/**
648 * Set the device to "Breathing" effect
649 *
650 * Status Trans Packet Proto DataSize Class CMD Args
651 * 00 3f 0000 00 09 0f 02 01050201000100ff00 | SET LED MATRIX Effect (VARSTR, Backlight, Breathing 0x02, Colours 0x01, ? 0x00, Colours 0x01, RGB 0x00FF00)
652 * 00 3f 0000 00 0c 0f 02 01050202000200ff00ff0000 | SET LED MATRIX Effect (VARSTR, Backlight, Breathing 0x02, Colours 0x02, ? 0x00, Colours 0x02, RGB 0x00FF00, RGB 0xFF0000)
653 * 00 3f 0000 00 06 0f 02 010502000000 | SET LED MATRIX Effect (VARSTR, Backlight, Breathing 0x02, Colours 0x00, ? 0x0000)
654 */
655struct razer_report razer_chroma_extended_matrix_effect_breathing_random(unsigned char variable_storage, unsigned char led_id)
656{
657 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x06, variable_storage, led_id, 0x02);
658 return report;
659}
660struct razer_report razer_chroma_extended_matrix_effect_breathing_single(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1)
661{
662 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x09, variable_storage, led_id, 0x02);
663
664 report.arguments[3] = 0x01;
665 report.arguments[5] = 0x01;
666
667 report.arguments[6] = rgb1->r;
668 report.arguments[7] = rgb1->g;
669 report.arguments[8] = rgb1->b;
670
671 return report;
672}
673struct razer_report razer_chroma_extended_matrix_effect_breathing_dual(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1, struct razer_rgb *rgb2)
674{
675 struct razer_report report = razer_chroma_extended_matrix_effect_base(0x0C, variable_storage, led_id, 0x02);
676
677 report.arguments[3] = 0x02;
678 report.arguments[5] = 0x02;
679
680 report.arguments[6] = rgb1->r;
681 report.arguments[7] = rgb1->g;
682 report.arguments[8] = rgb1->b;
683 report.arguments[9] = rgb2->r;
684 report.arguments[10] = rgb2->g;
685 report.arguments[11] = rgb2->b;
686
687 return report;
688}
689
690/**
691 * Set the device to "Custom" effect
692 *
693 * Status Trans Packet Proto DataSize Class CMD Args
694 * 00 3f 0000 00 0c 0f 02 000008000000000000000000 | DRAW LED MATRIX Frame
695 */
696struct razer_report razer_chroma_extended_matrix_effect_custom_frame(void)
697{
698 return razer_chroma_extended_matrix_effect_base(0x0C, 0x00, 0x00, 0x08);
699}
700
701/**
702 * Set the device brightness
703 *
704 * Status Trans Packet Proto DataSize Class CMD Args
705 * 00 3f 0000 00 03 0f 04 0104b7
706 */
707struct razer_report razer_chroma_extended_matrix_brightness(unsigned char variable_storage, unsigned char led_id, unsigned char brightness)
708{
709 struct razer_report report = get_razer_report(0x0F, 0x04, 0x03);
710 report.transaction_id.id = 0x3F;
711
712 report.arguments[0] = variable_storage;
713 report.arguments[1] = led_id;
714 report.arguments[2] = brightness;
715
716 return report;
717}
718
719/**
720 * Get the device brightness
721 *
722 * Status Trans Packet Proto DataSize Class CMD Args
723 * 00 3f 0000 00 03 0f 84 0104
724 */
725struct razer_report razer_chroma_extended_matrix_get_brightness(unsigned char variable_storage, unsigned char led_id)
726{
727 struct razer_report report = get_razer_report(0x0F, 0x84, 0x03);
728 report.transaction_id.id = 0x3F;
729
730 report.arguments[0] = variable_storage;
731 report.arguments[1] = led_id;
732
733 return report;
734}
735
736/**
737 * Set the RGB or a row
738 *
739 * Start and stop columns are inclusive
740 */
741struct razer_report razer_chroma_extended_matrix_set_custom_frame(unsigned char row_index, unsigned char start_col, unsigned char stop_col, unsigned char *rgb_data)
742{
743 struct razer_report report = get_razer_report(0x0F, 0x03, 0x47);
744 size_t row_length = (size_t) (((stop_col + 1) - start_col) * 3);
745 int index = 5 + (start_col * 3);
746
747 report.transaction_id.id = 0x3F;
748
749 // printk(KERN_ALERT "razerkbd: Row ID: %d, Start: %d, Stop: %d, row length: %d\n", row_index, start_col, stop_col, (unsigned char)row_length);
750
751 report.arguments[2] = row_index;
752 report.arguments[3] = start_col;
753 report.arguments[4] = stop_col;
754 memcpy(&report.arguments[index], rgb_data, row_length);
755
756 return report;
757}
758
759/*
760 * Extended Matrix Effects (Mouse)
761 */
762/**
763 * Sets up the extended matrix effect payload for mouse devices
764 */
765struct razer_report razer_chroma_mouse_extended_matrix_effect_base(unsigned char arg_size, unsigned char variable_storage, unsigned char led_id, unsigned char effect_id)
766{
767 struct razer_report report = get_razer_report(0x03, 0x0D, arg_size);
768 report.transaction_id.id = 0x3F;
769
770 report.arguments[0] = variable_storage;
771 report.arguments[1] = led_id;
772 report.arguments[2] = effect_id; // Effect ID
773
774 return report;
775}
776
777/**
778 * Set the device to "None" effect
779 *
780 * Status Trans Packet Proto DataSize Class CMD Args
781 * * 00 3f 0000 00 03 03 0d 010100 | SET Extended Matrix Effect (VARSTORE, LOGO_LED, OFF)
782 */
783struct razer_report razer_chroma_mouse_extended_matrix_effect_none(unsigned char variable_storage, unsigned char led_id)
784{
785 return razer_chroma_mouse_extended_matrix_effect_base(0x03, variable_storage, led_id, 0x00);
786}
787
788/**
789 * Set the device to "Static" effect
790 *
791 * Status Trans Packet Proto DataSize Class CMD Args
792 * 00 3f 0000 00 06 03 0d 010106 00ff00 | SET Extended Matrix Effect (VARSTORE, SCROLL_WHEEL, STATIC, RGB)
793 */
794struct razer_report razer_chroma_mouse_extended_matrix_effect_static(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb)
795{
796 struct razer_report report = razer_chroma_mouse_extended_matrix_effect_base(0x06, variable_storage, led_id, 0x06);
797
798 report.arguments[3] = rgb->r;
799 report.arguments[4] = rgb->g;
800 report.arguments[5] = rgb->b;
801 return report;
802}
803
804/**
805 * Set the device to "Spectrum" effect
806 *
807 * Status Trans Packet Proto DataSize Class CMD Args
808 * 00 3f 0000 00 03 03 0d 010104 | SET Extended Matrix Effect (VARSTORE, LOGO_LED, SPECTRUM)
809 */
810struct razer_report razer_chroma_mouse_extended_matrix_effect_spectrum(unsigned char variable_storage, unsigned char led_id)
811{
812 return razer_chroma_mouse_extended_matrix_effect_base(0x03, variable_storage, led_id, 0x04);
813}
814
815/**
816 * Set the device to "Reactive" effect
817 *
818 * Status Trans Packet Proto DataSize Class CMD Args
819 * 00 3f 0000 00 07 03 0d 010102 0300ff00 | SET Extended Matrix Effect (VARSTORE, SCROLL_WHEEL, REACTIVE, TIME, RGB)
820 * 00 3f 0000 00 07 03 0d 010102 0200ff00 | SET Extended Matrix Effect (VARSTORE, SCROLL_WHEEL, REACTIVE, TIME, RGB)
821 * 00 3f 0000 00 07 03 0d 010102 0100ff00 | SET Extended Matrix Effect (VARSTORE, SCROLL_WHEEL, REACTIVE, TIME, RGB)
822 */
823struct razer_report razer_chroma_mouse_extended_matrix_effect_reactive(unsigned char variable_storage, unsigned char led_id, unsigned char speed, struct razer_rgb *rgb)
824{
825 struct razer_report report = razer_chroma_mouse_extended_matrix_effect_base(0x07, variable_storage, led_id, 0x02);
826
827 speed = clamp_u8(speed, 0x01, 0x04);
828
829 report.arguments[3] = speed;
830 report.arguments[4] = rgb->r;
831 report.arguments[5] = rgb->g;
832 report.arguments[6] = rgb->b;
833
834 return report;
835}
836
837/**
838 * Set the device to "Breathing" effect
839 *
840 * Status Trans Packet Proto DataSize Class CMD Args
841 * 00 3f 0000 00 0a 03 0d 010103 0100ff00000000 | SET Extended Matrix Effect (VARSTORE, SCROLL_WHEEL, BREATHING, single, RGB, RGB-none)
842 * 00 3f 0000 00 0a 03 0d 010103 0200ff00ff0000 | SET Extended Matrix Effect (VARSTORE, SCROLL_WHEEL, BREATHING, dual, RGB, RGB)
843 * 00 3f 0000 00 0a 03 0d 010103 03000000000000 | SET Extended Matrix Effect (VARSTORE, SCROLL_WHEEL, BREATHING, random, RGB-none, RGB-none)
844 */
845struct razer_report razer_chroma_mouse_extended_matrix_effect_breathing_random(unsigned char variable_storage, unsigned char led_id)
846{
847 struct razer_report report = razer_chroma_mouse_extended_matrix_effect_base(0x0A, variable_storage, led_id, 0x03);
848
849 report.arguments[3] = 0x03;
850
851 return report;
852}
853struct razer_report razer_chroma_mouse_extended_matrix_effect_breathing_single(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1)
854{
855 struct razer_report report = razer_chroma_mouse_extended_matrix_effect_base(0x0A, variable_storage, led_id, 0x03);
856
857 report.arguments[3] = 0x01;
858
859 report.arguments[4] = rgb1->r;
860 report.arguments[5] = rgb1->g;
861 report.arguments[6] = rgb1->b;
862
863 return report;
864}
865struct razer_report razer_chroma_mouse_extended_matrix_effect_breathing_dual(unsigned char variable_storage, unsigned char led_id, struct razer_rgb *rgb1, struct razer_rgb *rgb2)
866{
867 struct razer_report report = razer_chroma_mouse_extended_matrix_effect_base(0x0A, variable_storage, led_id, 0x03);
868
869 report.arguments[3] = 0x02;
870
871 report.arguments[4] = rgb1->r;
872 report.arguments[5] = rgb1->g;
873 report.arguments[6] = rgb1->b;
874
875 report.arguments[7] = rgb2->r;
876 report.arguments[8] = rgb2->g;
877 report.arguments[9] = rgb2->b;
878
879 return report;
880}
881
882
883
884
885/*
886 * Misc Functions
887 */
888/**
889 * Toggled whether F1-12 act as F1-12 or if they act as the function options (without Fn pressed)
890 *
891 * If 0 should mean that the F-keys work as normal F-keys
892 * If 1 should mean that the F-keys act as if the FN key is held
893 */
894struct razer_report razer_chroma_misc_fn_key_toggle(unsigned char state)
895{
896 struct razer_report report = get_razer_report(0x02, 0x06, 0x02);
897 report.arguments[0] = 0x00; // ?? Variable storage maybe
898 report.arguments[1] = clamp_u8(state, 0x00, 0x01); // State
899
900 return report;
901}
902
903/**
904 * Set the brightness of an LED on the device
905 *
906 * Status Trans Packet Proto DataSize Class CMD Args
907 * ? TODO fill this
908 */
909struct razer_report razer_chroma_misc_set_blade_brightness(unsigned char brightness)
910{
911 struct razer_report report = get_razer_report(0x0E, 0x04, 0x02);
912 report.arguments[0] = 0x01;
913 report.arguments[1] = brightness;
914
915 return report;
916}
917
918/**
919 * Get the brightness of an LED on the device
920 *
921 * Status Trans Packet Proto DataSize Class CMD Args
922 * ? TODO fill this
923 */
924struct razer_report razer_chroma_misc_get_blade_brightness(void)
925{
926 struct razer_report report = get_razer_report(0x0E, 0x84, 0x02);
927 report.arguments[0] = 0x01;
928
929 return report;
930}
931
932/**
933 * Sets custom frame for the firefly
934 */
935struct razer_report razer_chroma_misc_one_row_set_custom_frame(unsigned char start_col, unsigned char stop_col, unsigned char *rgb_data) // TODO recheck custom frame hex
936{
937 struct razer_report report = get_razer_report(0x03, 0x0C, 0x32);
938 size_t row_length = (size_t) (((stop_col + 1) - start_col) * 3);
939 int index = 2 + (start_col * 3);
940
941 report.arguments[0] = start_col;
942 report.arguments[1] = stop_col;
943
944 memcpy(&report.arguments[index], rgb_data, row_length);
945
946 return report;
947}
948
949/**
950 * Trigger reactive on Firefly
951 */
952struct razer_report razer_chroma_misc_matrix_reactive_trigger(void)
953{
954 struct razer_report report = get_razer_report(0x03, 0x0A, 0x05);
955 report.arguments[0] = 0x02; // Effect ID
956 report.arguments[1] = 0; // this speed triggers reactive
957 report.arguments[2] = 0;
958 report.arguments[3] = 0;
959 report.arguments[4] = 0;
960
961 return report;
962}
963
964/**
965 * Gets battery level
966 *
967 * 0->255 is in arg[1]
968 */
969struct razer_report razer_chroma_misc_get_battery_level(void)
970{
971 return get_razer_report(0x07, 0x80, 0x02);
972}
973
974/**
975 * Gets charging status
976 *
977 * 0->1 is in arg[1]
978 */
979struct razer_report razer_chroma_misc_get_charging_status(void)
980{
981 return get_razer_report(0x07, 0x84, 0x02);
982}
983
984/**
985 * Set the charging effect, think if I remember correctly, it's either static colour, or "whatever the mouse was last on"
986 */
987struct razer_report razer_chroma_misc_set_dock_charge_type(unsigned char charge_type)
988{
989 struct razer_report report = get_razer_report(0x03, 0x10, 0x01);
990 report.arguments[0] = clamp_u8(charge_type, 0x00, 0x01);
991
992 return report;
993}
994
995/**
996 * Get the polling rate from the device
997 *
998 * Identifier is in arg[0]
999 *
1000 * 0x01 = 1000Hz
1001 * 0x02 = 500Hz
1002 * 0x08 = 125Hz
1003 */
1004struct razer_report razer_chroma_misc_get_polling_rate(void)
1005{
1006 return get_razer_report(0x00, 0x85, 0x01);
1007}
1008
1009/**
1010 * Set the polling rate of the device
1011 *
1012 * 0x01 = 1000Hz
1013 * 0x02 = 500Hz
1014 * 0x08 = 125Hz
1015 */
1016struct razer_report razer_chroma_misc_set_polling_rate(unsigned short polling_rate)
1017{
1018 struct razer_report report = get_razer_report(0x00, 0x05, 0x01);
1019
1020 switch(polling_rate) {
1021 case 1000:
1022 report.arguments[0] = 0x01;
1023 break;
1024 case 500:
1025 report.arguments[0] = 0x02;
1026 break;
1027 case 125:
1028 report.arguments[0] = 0x08;
1029 break;
1030 default: // 500Hz
1031 report.arguments[0] = 0x02;
1032 break;
1033 }
1034
1035 return report;
1036}
1037
1038/**
1039 * Get brightness of charging dock
1040 */
1041struct razer_report razer_chroma_misc_get_dock_brightness(void)
1042{
1043 return get_razer_report(0x07, 0x82, 0x01);
1044
1045}
1046
1047/**
1048 * Set brightness of charging dock
1049 */
1050struct razer_report razer_chroma_misc_set_dock_brightness(unsigned char brightness)
1051{
1052 struct razer_report report = get_razer_report(0x07, 0x02, 0x01);
1053 report.arguments[0] = brightness;
1054
1055 return report;
1056}
1057
1058/**
1059 * Set the DPI of the device
1060 */
1061struct razer_report razer_chroma_misc_set_dpi_xy(unsigned char variable_storage, unsigned short dpi_x,unsigned short dpi_y)
1062{
1063 struct razer_report report = get_razer_report(0x04, 0x05, 0x07);
1064
1065 // Keep the DPI within bounds
1066 dpi_x = clamp_u16(dpi_x, 128, 16000);
1067 dpi_y = clamp_u16(dpi_y, 128, 16000);
1068
1069 report.arguments[0] = VARSTORE;
1070
1071 report.arguments[1] = (dpi_x >> 8) & 0x00FF;
1072 report.arguments[2] = dpi_x & 0x00FF;
1073 report.arguments[3] = (dpi_y >> 8) & 0x00FF;
1074 report.arguments[4] = dpi_y & 0x00FF;
1075 report.arguments[5] = 0x00;
1076 report.arguments[6] = 0x00;
1077
1078 return report;
1079}
1080
1081/**
1082 * Get the DPI of the device
1083 */
1084struct razer_report razer_chroma_misc_get_dpi_xy(unsigned char variable_storage)
1085{
1086 struct razer_report report = get_razer_report(0x04, 0x85, 0x07);
1087
1088 report.arguments[0] = VARSTORE;
1089
1090 return report;
1091}
1092
1093/**
1094 * Set the DPI of the device (Some stupid turd scaled 5600 dpi into a single byte)
1095 */
1096struct razer_report razer_chroma_misc_set_dpi_xy_byte(unsigned char dpi_x,unsigned char dpi_y)
1097{
1098 struct razer_report report = get_razer_report(0x04, 0x01, 0x03);
1099
1100 report.arguments[0] = dpi_x;
1101 report.arguments[1] = dpi_y;
1102 report.arguments[2] = 0x00;
1103
1104 return report;
1105}
1106
1107/**
1108 * Get the DPI of the device (Some stupid turd scaled 5600 dpi into a single byte)
1109 */
1110struct razer_report razer_chroma_misc_get_dpi_xy_byte(void)
1111{
1112 struct razer_report report = get_razer_report(0x04, 0x81, 0x03);
1113
1114 return report;
1115}
1116
1117/**
1118 * Set device idle time
1119 *
1120 * Device will go into powersave after this time.
1121 *
1122 * Idle time is in seconds, must be between 60sec-900sec
1123 */
1124struct razer_report razer_chroma_misc_set_idle_time(unsigned short idle_time)
1125{
1126 struct razer_report report = get_razer_report(0x07, 0x03, 0x02);
1127
1128 // Keep the idle time within bounds
1129 idle_time = clamp_u16(idle_time, 60, 900);
1130
1131 report.arguments[0] = (idle_time >> 8) & 0x00FF;
1132 report.arguments[1] = idle_time & 0x00FF;
1133
1134 return report;
1135}
1136
1137/**
1138 * Set low battery threshold
1139 *
1140 * 0x3F = 25%
1141 * 0x26 = 15%
1142 * 0x0C = 5%
1143 */
1144struct razer_report razer_chroma_misc_set_low_battery_threshold(unsigned char battery_threshold)
1145{
1146 struct razer_report report = get_razer_report(0x07, 0x01, 0x01);
1147
1148 // Keep the idle time within bounds
1149 battery_threshold = clamp_u8(battery_threshold, 0x0C, 0x3F);
1150
1151 report.arguments[0] = battery_threshold;
1152
1153 return report;
1154}
1155
1156struct razer_report razer_chroma_misc_set_orochi2011_led(unsigned char led_bitfield)
1157{
1158 struct razer_report report = {0};
1159 memcpy(&report, &orochi2011_led, sizeof(orochi2011_led));
1160
1161 // Keep the idle time within bounds
1162 report.arguments[1] = led_bitfield;
1163
1164 return report;
1165}
1166
1167struct razer_report razer_chroma_misc_set_orochi2011_poll_dpi(unsigned short poll_rate, unsigned char dpi_x, unsigned char dpi_y)
1168{
1169 struct razer_report report = {0};
1170 memcpy(&report, &orochi2011_dpi, sizeof(orochi2011_dpi));
1171
1172 switch(poll_rate) {
1173 case 1000:
1174 poll_rate = 0x01;
1175 break;
1176 case 500:
1177 poll_rate = 0x02;
1178 break;
1179 case 125:
1180 poll_rate = 0x08;
1181 break;
1182 default: // 500Hz
1183 poll_rate = 0x02;
1184 break;
1185 }
1186
1187 report.arguments[1] = poll_rate;
1188
1189 report.arguments[3] = clamp_u8(dpi_x, 0x15, 0x9C);
1190 report.arguments[4] = clamp_u8(dpi_y, 0x15, 0x9C);
1191
1192 return report;
1193}
1194
1195/**
1196 * Set the Naga Trinity to "Static" effect
1197 */
1198struct razer_report razer_naga_trinity_effect_static(struct razer_rgb *rgb)
1199{
1200 struct razer_report report = get_razer_report(0x0f, 0x03, 0x0e);
1201
1202 report.arguments[0] = 0x00; // Variable storage
1203 report.arguments[1] = 0x00; // LED ID
1204 report.arguments[2] = 0x00; // Unknown
1205 report.arguments[3] = 0x00; // Unknown
1206 report.arguments[4] = 0x02; // Effect ID
1207 report.arguments[5] = rgb->r; // RGB 3x
1208 report.arguments[6] = rgb->g;
1209 report.arguments[7] = rgb->b;
1210 report.arguments[8] = rgb->r;
1211 report.arguments[9] = rgb->g;
1212 report.arguments[10] = rgb->b;
1213 report.arguments[11] = rgb->r;
1214 report.arguments[12] = rgb->g;
1215 report.arguments[13] = rgb->b;
1216 report.transaction_id.id = 0x1f;
1217
1218 return report;
1219}
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235