From nobody Wed Apr 8 04:55:31 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 664A8C433FE for ; Sat, 22 Oct 2022 14:56:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbiJVO4w (ORCPT ); Sat, 22 Oct 2022 10:56:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229682AbiJVO4u (ORCPT ); Sat, 22 Oct 2022 10:56:50 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2DC818E1B for ; Sat, 22 Oct 2022 07:56:48 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id o4so840638wrq.6 for ; Sat, 22 Oct 2022 07:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/tXvrHCsrelCqwHQuBkqjhcR6QAT/KqaZfHhYAbPR28=; b=faAyIpeB74juxp0oI0CEdLXKe789kz5oYbZyPN3v+rV0UzHJlNcAqgGN/8CMehGZZP J6jyDmLHjYuo5wpu+OckOop70PaC6RPM8c7438G2ugEC/Pb9c5SmVf5fdLoMVSKn4mCk y3kPscaIRSPLHXExm6YZU5UBGeWcs/uJcg/mxYHcHteJWB15pl2TaUVZwYIAlv2MyP7l muMB+Y/05JoS74PvnXz3sGAVOH4HexKsHpuGfeeNfF2FOTMKh2mBFb1JG+nmkCwtlLyV kcywv4qB/3H/Zm7gWHvj4FDesJcjTfAY8oM3+vYMI2c/+O3wjOVSfpCgOxTzXFh9qMXw fO+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/tXvrHCsrelCqwHQuBkqjhcR6QAT/KqaZfHhYAbPR28=; b=A1e4EZ4ptiPjwuQaFnLprBeDg2i+XNml/GjumdTs/VBO9B0gPiseh+fgnaQW9O1KoK XMgEOMOjCPMPGEDiN0CePri6pQMdudyh0gugqt0IsGGWpJWJLQGYjEBykeKrPo8z6uHu d8SKr4JhXC9P9p4jcRUq1n036yc6lN/1pgiLTlkjwxEOjK8DyABuSX+BBiTZAI+9Ih8T 9bocfGcdqDg/H5FM5MVuDjNT0sZdiB/7B0XaL2pl6VH8cCbO+4WpIoo6IImtbwGJGrCT SmjbdR19HCJYyAC7F4FAsEkRD7VDAmQKqrpixhUwbIaH5bQHLnOrCd2aTseICvSM+cnR NVUQ== X-Gm-Message-State: ACrzQf0uN7XsikO7AMINEYNgxBWW/uoWQ9u4+bBRCWTSYDKzu6O8likI fU+DJS/ROnDj2T+XMnYCm5M= X-Google-Smtp-Source: AMsMyM7lw3r7i526KBmAk73UWpUtks688vXES7ZIp+RG8FvUccbsyfTSCqVsFw4igjST24KzkKFqZw== X-Received: by 2002:a05:6000:713:b0:232:bd2e:8620 with SMTP id bs19-20020a056000071300b00232bd2e8620mr15894482wrb.139.1666450607491; Sat, 22 Oct 2022 07:56:47 -0700 (PDT) Received: from localhost.localdomain ([117.102.55.205]) by smtp.gmail.com with ESMTPSA id s2-20020adfea82000000b002364835caacsm6213512wrm.112.2022.10.22.07.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Oct 2022 07:56:47 -0700 (PDT) From: Osama Muhammad To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Osama Muhammad , Samuel Thibault Subject: [PATCH v4] Accessiblity: speakup_soft: specifying the default driver parameters among the module params Date: Sat, 22 Oct 2022 19:49:49 +0500 Message-Id: <20221022144949.24473-1-osmtendev@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This is an enhancement which allows to specify the default driver parameters among the module parameters. Adding a 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 Reviewed-by: Samuel Thibault --- Changes since v3: - Patch reviewed by maintainer. =09 Changes since v2: - Removed an unnecessary comment. Changes since v1: - Added NB_ID as the last member of enum default_vars_id. - Added NB_ID as the size of array vars. - Made sure that that the enteries in vars are in correct order. =09 --- drivers/accessibility/speakup/speakup_soft.c | 59 ++++++++++++++------ 1 file changed, 43 insertions(+), 16 deletions(-) diff --git a/drivers/accessibility/speakup/speakup_soft.c b/drivers/accessi= bility/speakup/speakup_soft.c index 28c8f60370cf..6d446824677b 100644 --- a/drivers/accessibility/speakup/speakup_soft.c +++ b/drivers/accessibility/speakup/speakup_soft.c @@ -33,21 +33,30 @@ static struct miscdevice synth_device, synthu_device; static int init_pos; static int misc_registered; =20 -static struct var_t vars[] =3D { - /* DIRECT is put first so that module_param_named can access it easily */ - { DIRECT, .u.n =3D {NULL, 0, 0, 1, 0, 0, NULL } }, - - { CAPS_START, .u.s =3D {"\x01+3p" } }, - { CAPS_STOP, .u.s =3D {"\x01-3p" } }, - { PAUSE, .u.n =3D {"\x01P" } }, - { RATE, .u.n =3D {"\x01%ds", 2, 0, 9, 0, 0, NULL } }, - { PITCH, .u.n =3D {"\x01%dp", 5, 0, 9, 0, 0, NULL } }, - { INFLECTION, .u.n =3D {"\x01%dr", 5, 0, 9, 0, 0, NULL } }, - { VOL, .u.n =3D {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, - { TONE, .u.n =3D {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, - { PUNCT, .u.n =3D {"\x01%db", 0, 0, 3, 0, 0, NULL } }, - { VOICE, .u.n =3D {"\x01%do", 0, 0, 7, 0, 0, NULL } }, - { FREQUENCY, .u.n =3D {"\x01%df", 5, 0, 9, 0, 0, NULL } }, + +enum default_vars_id { + DIRECT_ID =3D 0, CAPS_START_ID, CAPS_STOP_ID, + PAUSE_ID, RATE_ID, PITCH_ID, INFLECTION_ID, + VOL_ID, TONE_ID, PUNCT_ID, VOICE_ID, + FREQUENCY_ID, V_LAST_VAR_ID, + NB_ID +}; + + +static struct var_t vars[NB_ID] =3D { + + [DIRECT_ID] =3D { DIRECT, .u.n =3D {NULL, 0, 0, 1, 0, 0, NULL } }, + [CAPS_START_ID] =3D { CAPS_START, .u.s =3D {"\x01+3p" } }, + [CAPS_STOP_ID] =3D { CAPS_STOP, .u.s =3D {"\x01-3p" } }, + [PAUSE_ID] =3D { PAUSE, .u.n =3D {"\x01P" } }, + [RATE_ID] =3D { RATE, .u.n =3D {"\x01%ds", 2, 0, 9, 0, 0, NULL } }, + [PITCH_ID] =3D { PITCH, .u.n =3D {"\x01%dp", 5, 0, 9, 0, 0, NULL } }, + [INFLECTION_ID] =3D { INFLECTION, .u.n =3D {"\x01%dr", 5, 0, 9, 0, 0, NU= LL } }, + [VOL_ID] =3D { VOL, .u.n =3D {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, + [TONE_ID] =3D { TONE, .u.n =3D {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, + [PUNCT_ID] =3D { PUNCT, .u.n =3D {"\x01%db", 0, 0, 3, 0, 0, NULL } }, + [VOICE_ID] =3D { VOICE, .u.n =3D {"\x01%do", 0, 0, 7, 0, 0, NULL } }, + [FREQUENCY_ID] =3D { FREQUENCY, .u.n =3D {"\x01%df", 5, 0, 9, 0, 0, NULL= } }, V_LAST_VAR }; =20 @@ -451,10 +460,28 @@ static int softsynth_adjust(struct spk_synth *synth, = struct st_var_header *var) } =20 module_param_named(start, synth_soft.startup, short, 0444); -module_param_named(direct, vars[0].u.n.default_val, int, 0444); +module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444); +module_param_named(rate, vars[RATE_ID].u.n.default_val, int, 0444); +module_param_named(pitch, vars[PITCH_ID].u.n.default_val, int, 0444); +module_param_named(inflection, vars[INFLECTION_ID].u.n.default_val, int, 0= 444); +module_param_named(vol, vars[VOL_ID].u.n.default_val, int, 0444); +module_param_named(tone, vars[TONE_ID].u.n.default_val, int, 0444); +module_param_named(punct, vars[PUNCT_ID].u.n.default_val, int, 0444); +module_param_named(voice, vars[VOICE_ID].u.n.default_val, int, 0444); +module_param_named(frequency, vars[FREQUENCY_ID].u.n.default_val, int, 044= 4); + + =20 MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); MODULE_PARM_DESC(direct, "Set the direct variable on load."); +MODULE_PARM_DESC(rate, "Sets the rate of the synthesizer."); +MODULE_PARM_DESC(pitch, "Sets the pitch of the synthesizer."); +MODULE_PARM_DESC(inflection, "Sets the inflection of the synthesizer."); +MODULE_PARM_DESC(vol, "Sets the volume of the speech synthesizer."); +MODULE_PARM_DESC(tone, "Sets the tone of the speech synthesizer."); +MODULE_PARM_DESC(punct, "Sets the amount of punctuation spoken by the synt= hesizer."); +MODULE_PARM_DESC(voice, "Sets the voice used by the synthesizer."); +MODULE_PARM_DESC(frequency, "Sets the frequency of speech synthesizer."); =20 module_spk_synth(synth_soft); =20 --=20 2.25.1