fizzctl 0.2.1__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: fizzctl
3
- Version: 0.2.1
3
+ Version: 0.3.0
4
4
  Summary: Control a Redragon K617 Fizz keyboard on Linux: solid colors, 22 firmware-native RGB effects, per-key painting, live animations, and Cfg.ini keymap restore — no vendor software required
5
5
  Keywords: redragon,k617,fizz,rgb,keyboard,backlight,led,hid,linux
6
6
  Author: Ayoub Dya
@@ -59,6 +59,8 @@ the trigger did not pick it up.
59
59
  | `key` | Paint a single key | yes |
60
60
  | `paint` | Paint multiple keys at once | yes |
61
61
  | `keymap` | Write the keymap from a Cfg.ini | yes |
62
+ | `macro` | Bind a key that types text on press | yes |
63
+ | `restore` | Reset to the factory keymap, lighting and macros | yes |
62
64
  | `animate` | Host-streamed animation (volatile) | no |
63
65
 
64
66
  ## Examples
@@ -80,6 +82,35 @@ Apply the full keymap (bindings, lighting zones, function keys) from a
80
82
  fizzctl keymap Cfg.ini
81
83
  ```
82
84
 
85
+ - A `keymap` write keeps your current effect/color/brightness and any macros
86
+ you have bound.
87
+ - `fizzctl restore` does the opposite: it resets the keyboard to factory
88
+ state by writing the packaged stock keymap and lighting and wiping every
89
+ macro.
90
+
91
+ ### Macros
92
+
93
+ Bind a key to a macro that types text. Each macro gets its own slot (up to
94
+ 8), and previously bound macros are kept — the device's current keymap is
95
+ read and reused as the base, and your lighting is untouched:
96
+
97
+ ```bash
98
+ fizzctl macro --key CapsLock rgb # type "rgb" each press
99
+ fizzctl macro --key LAlt --delay-ms 50 --cycles 3 hello
100
+ fizzctl macro --key 2 --until-released aaaa
101
+ ```
102
+
103
+ Options: `--delay-ms` (default 30) is the delay between typed events,
104
+ `--cycles` (default 1) plays the macro that many times per press, and
105
+ `--until-released` types in a loop until the key is let go. Macros and their
106
+ bindings are remembered in a local state file (`$XDG_STATE_HOME/fizzctl/`)
107
+ so later macro/keymap writes never drop them. To undo:
108
+
109
+ ```bash
110
+ fizzctl macro --remove-all # unbind every macro, keep keymap + lighting
111
+ fizzctl restore # full factory reset (keymap, lighting, macros)
112
+ ```
113
+
83
114
  ### Set the whole board to one color
84
115
 
85
116
  ```bash
@@ -152,11 +183,11 @@ fizzctl-dev list
152
183
 
153
184
  ## How the RGB paths work
154
185
 
155
- **Flash writes** (`rgb`, `key`, `paint`, `effect`, `keymap`) send a 4-5 frame
156
- burst through the vendor HID interface (`258a:0049`, interface 1, usage page
157
- `0xFF00`). The sequence ends with a `5AA5` magic commit that writes to flash.
158
- Colors persist across reboots. Keys not listed in a `key` or `paint` canvas
159
- turn off.
186
+ **Flash writes** (`rgb`, `key`, `paint`, `effect`, `keymap`, `macro`,
187
+ `restore`) send a burst through the vendor HID interface (`258a:0049`,
188
+ interface 1, usage page `0xFF00`). The sequence ends with a `5AA5` magic
189
+ commit that writes to flash. Colors persist across reboots. Keys not listed
190
+ in a `key` or `paint` canvas turn off.
160
191
 
161
192
  **Animations** (`animate`) stream 382-byte per-key reports at the requested
162
193
  frame rate with no flash commit. They are host-side only and lost on
@@ -39,6 +39,8 @@ the trigger did not pick it up.
39
39
  | `key` | Paint a single key | yes |
40
40
  | `paint` | Paint multiple keys at once | yes |
41
41
  | `keymap` | Write the keymap from a Cfg.ini | yes |
42
+ | `macro` | Bind a key that types text on press | yes |
43
+ | `restore` | Reset to the factory keymap, lighting and macros | yes |
42
44
  | `animate` | Host-streamed animation (volatile) | no |
43
45
 
44
46
  ## Examples
@@ -60,6 +62,35 @@ Apply the full keymap (bindings, lighting zones, function keys) from a
60
62
  fizzctl keymap Cfg.ini
61
63
  ```
62
64
 
65
+ - A `keymap` write keeps your current effect/color/brightness and any macros
66
+ you have bound.
67
+ - `fizzctl restore` does the opposite: it resets the keyboard to factory
68
+ state by writing the packaged stock keymap and lighting and wiping every
69
+ macro.
70
+
71
+ ### Macros
72
+
73
+ Bind a key to a macro that types text. Each macro gets its own slot (up to
74
+ 8), and previously bound macros are kept — the device's current keymap is
75
+ read and reused as the base, and your lighting is untouched:
76
+
77
+ ```bash
78
+ fizzctl macro --key CapsLock rgb # type "rgb" each press
79
+ fizzctl macro --key LAlt --delay-ms 50 --cycles 3 hello
80
+ fizzctl macro --key 2 --until-released aaaa
81
+ ```
82
+
83
+ Options: `--delay-ms` (default 30) is the delay between typed events,
84
+ `--cycles` (default 1) plays the macro that many times per press, and
85
+ `--until-released` types in a loop until the key is let go. Macros and their
86
+ bindings are remembered in a local state file (`$XDG_STATE_HOME/fizzctl/`)
87
+ so later macro/keymap writes never drop them. To undo:
88
+
89
+ ```bash
90
+ fizzctl macro --remove-all # unbind every macro, keep keymap + lighting
91
+ fizzctl restore # full factory reset (keymap, lighting, macros)
92
+ ```
93
+
63
94
  ### Set the whole board to one color
64
95
 
65
96
  ```bash
@@ -132,11 +163,11 @@ fizzctl-dev list
132
163
 
133
164
  ## How the RGB paths work
134
165
 
135
- **Flash writes** (`rgb`, `key`, `paint`, `effect`, `keymap`) send a 4-5 frame
136
- burst through the vendor HID interface (`258a:0049`, interface 1, usage page
137
- `0xFF00`). The sequence ends with a `5AA5` magic commit that writes to flash.
138
- Colors persist across reboots. Keys not listed in a `key` or `paint` canvas
139
- turn off.
166
+ **Flash writes** (`rgb`, `key`, `paint`, `effect`, `keymap`, `macro`,
167
+ `restore`) send a burst through the vendor HID interface (`258a:0049`,
168
+ interface 1, usage page `0xFF00`). The sequence ends with a `5AA5` magic
169
+ commit that writes to flash. Colors persist across reboots. Keys not listed
170
+ in a `key` or `paint` canvas turn off.
140
171
 
141
172
  **Animations** (`animate`) stream 382-byte per-key reports at the requested
142
173
  frame rate with no flash commit. They are host-side only and lost on
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fizzctl"
3
- version = "0.2.1"
3
+ version = "0.3.0"
4
4
  description = "Control a Redragon K617 Fizz keyboard on Linux: solid colors, 22 firmware-native RGB effects, per-key painting, live animations, and Cfg.ini keymap restore — no vendor software required"
5
5
  readme = "README.md"
6
6
  keywords = [
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "fizzctl"
3
- version = "0.2.1"
3
+ version = "0.3.0"
4
4
  description = "Control a Redragon K617 Fizz keyboard on Linux: solid colors, 22 firmware-native RGB effects, per-key painting, live animations, and Cfg.ini keymap restore — no vendor software required"
5
5
  readme = "README.md"
6
6
  license = { text = "MIT" }
@@ -7,4 +7,4 @@ by :func:`main_dev` via the ``fizzctl-dev`` console script.
7
7
  from .cli import main, main_dev
8
8
 
9
9
  __all__ = ["main", "main_dev"]
10
- __version__ = "0.2.0"
10
+ __version__ = "0.3.0"
@@ -6,6 +6,9 @@ All constants come from USB captures of the OEM software:
6
6
  * FW_TEMPLATE — the 5-frame effect template: shared MODE and ROUTING,
7
7
  a distinct CANVAS, and five byte overrides of CONST_EXEC.
8
8
  * RGB_EXEC / RGB_SEC — the whole-board solid-color variant.
9
+ * CONST_KEYMAP — a clean 1032-byte 06 04 d4 keymap block (no macro
10
+ bindings), captured from the device. The macro command uses it as the
11
+ default base; KeymapEncoder can rebuild the same block from a Cfg.ini.
9
12
  """
10
13
 
11
14
 
@@ -209,6 +212,42 @@ FW_TEMPLATE = [
209
212
  _patch(CONST_EXEC, EXEC_DIFFS),
210
213
  ]
211
214
 
215
+ CONST_KEYMAP = bytes.fromhex(
216
+ "0604d4004000000000000000020000000200000d02000014060000e1060000e0"
217
+ "00000000020000010200000e020000150000001d0200001e0000000002000002"
218
+ "0200000f020000160000001b0200001f00000000020000030200001002000017"
219
+ "0000000600000000000000000200000400000015000000090000001900000000"
220
+ "0000000002000005000000170000000a00000005020000200000000002000006"
221
+ "0000001c0000000b00000011000000000000000002000007000000180000000d"
222
+ "0200001a0000000000000000020000080000000c0000000e0200001b20000000"
223
+ "0000000002000009000000120000000f0200001c00000050000000000200000a"
224
+ "02000011020000180200001d00000000000000000200000b0200001202000019"
225
+ "0000000000000000000000000200000c02000013000000000000000000000051"
226
+ "000000000000002a0000003100000028000000520000004f0000000000000000"
227
+ "0000000000000000000000000000000000000000000000000000000000000000"
228
+ "0000000000000000000000000000000000000000000000000000000000000000"
229
+ "0000000000000000000000000000000000000000000000000000000000000000"
230
+ "0000000000000000000000000000000000000000000000000000000000000000"
231
+ "0000000000000000000000000000000000000000000000000000000000000000"
232
+ "000000000000000000000000000000000000000000000000000000290000001e"
233
+ "0000001f00000020000000210000002200000023000000240000002500000026"
234
+ "000000270000002d0000002e0000002b000000140000001a0000000800000013"
235
+ "0000002f00000030000000390000000400000016000000070000003300000034"
236
+ "00000010000000360000003700000038060000e3060000e20000002c00000000"
237
+ "0000000000000000000000000000000000000000000000000000000000000000"
238
+ "000000000000000000000000000000000000000000000000000000350000003a"
239
+ "0000003b0000003c0000003d0000003e0000003f000000400000004100000042"
240
+ "000000430000004400000045040000cd040000ea00000052040000e900000046"
241
+ "000000490000004c040000e200000050000000510000004f0000004a0000004d"
242
+ "0c0003000d0003000000004b0000004e0e0000010b0003000e00000700000000"
243
+ "0000000000000000000000000000000000000000000000000000000000000000"
244
+ "0000000000000000000000000000000000000000000000000000000000000000"
245
+ "0000000000000000000000000000000000000000000000000000000000000000"
246
+ "0000000000000000000000000000000000000000000000000000000000000000"
247
+ "0000000000000000000000000000000000000000000000000000000000000000"
248
+ "0000000000000000"
249
+ )
250
+
212
251
  RGB_SEC = bytes.fromhex(
213
252
  "ffffffffff000000000000000000000000000000ffffffffff00000000000000"
214
253
  "00000000000000000000ffffff00ff000000000000000000000000000000ff00"