Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Accessiblity: speakup_apollo: specifying the default driver parameters among the module params

This is an enhancement which allows to specify the default driver
parameters among the module parameters.

Adding default variables to the speakup_apollo module
allows to easily set that at boot, rather than
setting the sys variables after boot.
More details can be found here:
https://github.com/linux-speakup/speakup/issues/7

Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Link: https://lore.kernel.org/r/20221109215108.7933-3-osmtendev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Osama Muhammad and committed by
Greg Kroah-Hartman
5e3e27f0 b9bf2738

+37 -9
+37 -9
drivers/accessibility/speakup/speakup_apollo.c
··· 24 24 25 25 static void do_catch_up(struct spk_synth *synth); 26 26 27 - static struct var_t vars[] = { 28 - { CAPS_START, .u.s = {"cap, " } }, 29 - { CAPS_STOP, .u.s = {"" } }, 30 - { RATE, .u.n = {"@W%d", 6, 1, 9, 0, 0, NULL } }, 31 - { PITCH, .u.n = {"@F%x", 10, 0, 15, 0, 0, NULL } }, 32 - { VOL, .u.n = {"@A%x", 10, 0, 15, 0, 0, NULL } }, 33 - { VOICE, .u.n = {"@V%d", 1, 1, 6, 0, 0, NULL } }, 34 - { LANG, .u.n = {"@=%d,", 1, 1, 4, 0, 0, NULL } }, 35 - { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 27 + 28 + 29 + enum default_vars_id { 30 + CAPS_START_ID = 0, CAPS_STOP_ID, 31 + RATE_ID, PITCH_ID, 32 + VOL_ID, VOICE_ID, LANG_ID, 33 + DIRECT_ID, V_LAST_VAR_ID, 34 + NB_ID 35 + }; 36 + 37 + 38 + 39 + 40 + static struct var_t vars[NB_ID] = { 41 + [CAPS_START_ID] = { CAPS_START, .u.s = {"cap, " } }, 42 + [CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"" } }, 43 + [RATE_ID] = { RATE, .u.n = {"@W%d", 6, 1, 9, 0, 0, NULL } }, 44 + [PITCH_ID] = { PITCH, .u.n = {"@F%x", 10, 0, 15, 0, 0, NULL } }, 45 + [VOL_ID] = { VOL, .u.n = {"@A%x", 10, 0, 15, 0, 0, NULL } }, 46 + [VOICE_ID] = { VOICE, .u.n = {"@V%d", 1, 1, 6, 0, 0, NULL } }, 47 + [LANG_ID] = { LANG, .u.n = {"@=%d,", 1, 1, 4, 0, 0, NULL } }, 48 + [DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 36 49 V_LAST_VAR 37 50 }; 38 51 ··· 206 193 module_param_named(ser, synth_apollo.ser, int, 0444); 207 194 module_param_named(dev, synth_apollo.dev_name, charp, 0444); 208 195 module_param_named(start, synth_apollo.startup, short, 0444); 196 + module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444); 197 + module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444); 198 + module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444); 199 + module_param_named(voice, vars[VOICE_ID].u.n.default_val, int, 0444); 200 + module_param_named(lang, vars[LANG_ID].u.n.default_val, int, 0444); 201 + module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444); 202 + 209 203 210 204 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); 211 205 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); 212 206 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); 207 + MODULE_PARM_DESC(rate, "Set the rate variable on load."); 208 + MODULE_PARM_DESC(pitch, "Set the pitch variable on load."); 209 + MODULE_PARM_DESC(vol, "Set the vol variable on load."); 210 + MODULE_PARM_DESC(voice, "Set the voice variable on load."); 211 + MODULE_PARM_DESC(lang, "Set the lang variable on load."); 212 + MODULE_PARM_DESC(direct, "Set the direct variable on load."); 213 + 214 + 213 215 214 216 module_spk_synth(synth_apollo); 215 217