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

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

authored by

Osama Muhammad and committed by
Greg Kroah-Hartman
95892c4e d5dab7ff

+28 -8
+28 -8
drivers/accessibility/speakup/speakup_bns.c
··· 16 16 #define SYNTH_CLEAR 0x18 17 17 #define PROCSPEECH '\r' 18 18 19 - static struct var_t vars[] = { 20 - { CAPS_START, .u.s = {"\x05\x31\x32P" } }, 21 - { CAPS_STOP, .u.s = {"\x05\x38P" } }, 22 - { RATE, .u.n = {"\x05%dE", 8, 1, 16, 0, 0, NULL } }, 23 - { PITCH, .u.n = {"\x05%dP", 8, 0, 16, 0, 0, NULL } }, 24 - { VOL, .u.n = {"\x05%dV", 8, 0, 16, 0, 0, NULL } }, 25 - { TONE, .u.n = {"\x05%dT", 8, 0, 16, 0, 0, NULL } }, 26 - { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 19 + 20 + enum default_vars_id { 21 + CAPS_START_ID = 0, CAPS_STOP_ID, 22 + RATE_ID, PITCH_ID, 23 + VOL_ID, TONE_ID, 24 + DIRECT_ID, V_LAST_VAR_ID, 25 + NB_ID 26 + }; 27 + 28 + static struct var_t vars[NB_ID] = { 29 + [CAPS_START_ID] = { CAPS_START, .u.s = {"\x05\x31\x32P" } }, 30 + [CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x05\x38P" } }, 31 + [RATE_ID] = { RATE, .u.n = {"\x05%dE", 8, 1, 16, 0, 0, NULL } }, 32 + [PITCH_ID] = { PITCH, .u.n = {"\x05%dP", 8, 0, 16, 0, 0, NULL } }, 33 + [VOL_ID] = { VOL, .u.n = {"\x05%dV", 8, 0, 16, 0, 0, NULL } }, 34 + [TONE_ID] = { TONE, .u.n = {"\x05%dT", 8, 0, 16, 0, 0, NULL } }, 35 + [DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, 27 36 V_LAST_VAR 28 37 }; 29 38 ··· 122 113 module_param_named(ser, synth_bns.ser, int, 0444); 123 114 module_param_named(dev, synth_bns.dev_name, charp, 0444); 124 115 module_param_named(start, synth_bns.startup, short, 0444); 116 + module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444); 117 + module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444); 118 + module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444); 119 + module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444); 120 + module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444); 121 + 125 122 126 123 MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); 127 124 MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); 128 125 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); 126 + MODULE_PARM_DESC(rate, "Set the rate variable on load."); 127 + MODULE_PARM_DESC(pitch, "Set the pitch variable on load."); 128 + MODULE_PARM_DESC(vol, "Set the vol variable on load."); 129 + MODULE_PARM_DESC(tone, "Set the tone variable on load."); 130 + MODULE_PARM_DESC(direct, "Set the direct variable on load."); 129 131 130 132 module_spk_synth(synth_bns); 131 133