From nobody Tue Apr 7 09:35:47 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 F4179C433FE for ; Thu, 13 Oct 2022 22:30:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229723AbiJMWaj (ORCPT ); Thu, 13 Oct 2022 18:30:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229712AbiJMWaf (ORCPT ); Thu, 13 Oct 2022 18:30:35 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85866B4896 for ; Thu, 13 Oct 2022 15:30:32 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id a10so4916285wrm.12 for ; Thu, 13 Oct 2022 15:30:32 -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=r5ZR8B8hCF/pTH1ojliEiamiosQgM2tbHPaSGX3EZv0=; b=FlEUzUFlAqkR/iyG2/VoHfkkEplVk3NsxdUKDl0ufOhGZyzzb73/pFsPmdvkOGypap SoBVWe9V3t9c/mebH/fII9yIJjj6DDxpQq4caeYtsHyIPy6Onwbj7JHxEkOxrT0+wABb 3+ytlMJmWBCWDLP3A6VMLdhFYX9rzmdPoCw0UNgM8cFaQ/ogkP0OoytXn4iXq983VTC5 tg+59D96Y7k4/wEtSVQxvkJsO6X/dXB1dM/GjAzHTQTI3J6d1GmBGmE6WVIATkIT7H38 vZICipvyoAZZKoD68pV6zlqdEcDzv2pypJlUgOBva0vFN0GhVzHTluRwPdL5Gikt3fip hqsA== 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=r5ZR8B8hCF/pTH1ojliEiamiosQgM2tbHPaSGX3EZv0=; b=GecgUm18WRd5MS0XocU+2A7SUqv4BeKr+3NLSz13/0acUEDaYqLqDgUkfAusL7cQdO YvbAn4JQFPh4ygdEZ7E1b/arVr8vKkovybyKXPLxiRBHsqIwI6d6K+hdb++q3vsKuuV1 0ItMkfizlOJU9yJrV9WbPg9ACkF2BCma5oZ2J781jDk20ZZoGcCTpurvmyMPBNVwwEVA L2mi5z26T09Z3gEgRK/Wu/GtnjoSTBvaPrryuFo4PLLDhHNtFPyDqvlEdyRjd4LbkFAd qqAPUsKRNGfR1ghDdhxfqRbIiwQ6UDNwDatUuCYshCaUnrIfN67vB/iwloWaGiD/u55g sEUQ== X-Gm-Message-State: ACrzQf20umLIcZVSJDM+YJ/w3g/g24KqkSVM9dAgDEIeREwYrbNzGlM8 KD3LmZf8DTDtliM6qdhqpNa9Add/ZESLAA== X-Google-Smtp-Source: AMsMyM6dlgFRBi+eOqpajjdJMUlQgCoXZai+U/H3ctIOeQOImFNcq/b2Lmdy61s+RP34Wue1V03U0g== X-Received: by 2002:a5d:64a3:0:b0:231:f82e:9a57 with SMTP id m3-20020a5d64a3000000b00231f82e9a57mr1364226wrp.492.1665700230758; Thu, 13 Oct 2022 15:30:30 -0700 (PDT) Received: from localhost.localdomain ([111.88.122.94]) by smtp.gmail.com with ESMTPSA id i3-20020adfaac3000000b0022e62529888sm564281wrc.67.2022.10.13.15.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Oct 2022 15:30:29 -0700 (PDT) From: Osama Muhammad To: samuel.thibault@ens-lyon.org Cc: gregkh@linuxfoundation.org, speakup@linux-speakup.org, linux-kernel@vger.kernel.org, Osama Muhammad Subject: [PATCH v2] Accessiblity: speakup: specifying the default driver parameters among the module params Date: Fri, 14 Oct 2022 03:30:24 +0500 Message-Id: <20221013223024.22708-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 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 --- 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. --- drivers/accessibility/speakup/speakup_soft.c | 57 ++++++++++++++------ 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/drivers/accessibility/speakup/speakup_soft.c b/drivers/accessi= bility/speakup/speakup_soft.c index 28c8f60370cf..5d8e2c1e7f4c 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 { + +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 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 } }, + [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