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

Accessiblity: speakup_soft: 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_soft 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-2-osmtendev@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

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

+42 -15
+42 -15
drivers/accessibility/speakup/speakup_soft.c
··· 33 33 static int init_pos; 34 34 static int misc_registered; 35 35 36 - static struct var_t vars[] = { 37 - /* DIRECT is put first so that module_param_named can access it easily */ 38 - { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 39 36 40 - { CAPS_START, .u.s = {"\x01+3p" } }, 41 - { CAPS_STOP, .u.s = {"\x01-3p" } }, 42 - { PAUSE, .u.n = {"\x01P" } }, 43 - { RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } }, 44 - { PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } }, 45 - { INFLECTION, .u.n = {"\x01%dr", 5, 0, 9, 0, 0, NULL } }, 46 - { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, 47 - { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, 48 - { PUNCT, .u.n = {"\x01%db", 0, 0, 3, 0, 0, NULL } }, 49 - { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } }, 50 - { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } }, 37 + enum default_vars_id { 38 + DIRECT_ID = 0, CAPS_START_ID, CAPS_STOP_ID, 39 + PAUSE_ID, RATE_ID, PITCH_ID, INFLECTION_ID, 40 + VOL_ID, TONE_ID, PUNCT_ID, VOICE_ID, 41 + FREQUENCY_ID, V_LAST_VAR_ID, 42 + NB_ID 43 + }; 44 + 45 + 46 + static struct var_t vars[NB_ID] = { 47 + 48 + [DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 49 + [CAPS_START_ID] = { CAPS_START, .u.s = {"\x01+3p" } }, 50 + [CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x01-3p" } }, 51 + [PAUSE_ID] = { PAUSE, .u.n = {"\x01P" } }, 52 + [RATE_ID] = { RATE, .u.n = {"\x01%ds", 2, 0, 9, 0, 0, NULL } }, 53 + [PITCH_ID] = { PITCH, .u.n = {"\x01%dp", 5, 0, 9, 0, 0, NULL } }, 54 + [INFLECTION_ID] = { INFLECTION, .u.n = {"\x01%dr", 5, 0, 9, 0, 0, NULL } }, 55 + [VOL_ID] = { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, 56 + [TONE_ID] = { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, 57 + [PUNCT_ID] = { PUNCT, .u.n = {"\x01%db", 0, 0, 3, 0, 0, NULL } }, 58 + [VOICE_ID] = { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } }, 59 + [FREQUENCY_ID] = { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } }, 51 60 V_LAST_VAR 52 61 }; 53 62 ··· 460 451 } 461 452 462 453 module_param_named(start, synth_soft.startup, short, 0444); 463 - module_param_named(direct, vars[0].u.n.default_val, int, 0444); 454 + module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444); 455 + module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444); 456 + module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444); 457 + module_param_named(inflection, vars[INFLECTION_ID].u.n.default_val, int, 0444); 458 + module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444); 459 + module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444); 460 + module_param_named(punct, vars[PUNCT_ID].u.n.default_val, int, 0444); 461 + module_param_named(voice, vars[VOICE_ID].u.n.default_val, int, 0444); 462 + module_param_named(frequency, vars[FREQUENCY_ID].u.n.default_val, int, 0444); 463 + 464 + 464 465 465 466 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); 466 467 MODULE_PARM_DESC(direct, "Set the direct variable on load."); 468 + MODULE_PARM_DESC(rate, "Sets the rate of the synthesizer."); 469 + MODULE_PARM_DESC(pitch, "Sets the pitch of the synthesizer."); 470 + MODULE_PARM_DESC(inflection, "Sets the inflection of the synthesizer."); 471 + MODULE_PARM_DESC(vol, "Sets the volume of the speech synthesizer."); 472 + MODULE_PARM_DESC(tone, "Sets the tone of the speech synthesizer."); 473 + MODULE_PARM_DESC(punct, "Sets the amount of punctuation spoken by the synthesizer."); 474 + MODULE_PARM_DESC(voice, "Sets the voice used by the synthesizer."); 475 + MODULE_PARM_DESC(frequency, "Sets the frequency of speech synthesizer."); 467 476 468 477 module_spk_synth(synth_soft); 469 478