From patchwork Sat Oct 29 16:29:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Osama Muhammad X-Patchwork-Id: 12745 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1424964wru; Sat, 29 Oct 2022 09:46:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7zBBlco03551UJpB/Nh+vi1/VC479fM/4wk5MqisQw3Y8eFeNYO3wnFTTi5OgsOb4osYvH X-Received: by 2002:a50:eb83:0:b0:462:a2ac:8623 with SMTP id y3-20020a50eb83000000b00462a2ac8623mr5055818edr.360.1667061982074; Sat, 29 Oct 2022 09:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667061982; cv=none; d=google.com; s=arc-20160816; b=Gp8Hp7UEt4JE56H+e3phYlPneYcxTmasQker04y64mFR5a3lIkBIds0+UhEygCAxhI DG+mid19wD1qXXnfg98oFPZCyBfDLoF1axULuhpspDqLa353ll9+qDmIQTYmeXhSLegs CfSdGtdAP5voP8rJOF3v3pV8c6P4w8ZtCxLpz7eNItGxloS9ZeD2wodeXGBxypFsBZH+ eS6xk/IalOUrCLMqQKwprn+feh6hLpjt6Jp2Y8fdZ8A7U/7c838mnI0a1eYx6QHQdXnE ZiZe/LEiugCPhPLU5pQAF1U9r5jnmpceFExHP5XeaWHMhOL18cnT6u/zXmCWdq57W1Hg 1BDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=naPJ1M3MRESguYaKsY0dGxRKs4ndHregyKB6rOGXWB0=; b=rXVVjpauN5eNt+T/fAiLapiFrGDuR/m4EnnNKSPeqb5RxsZSU396C9BcuV3XpBmTi8 +j7asoz0iaQ04V5VcK+e387nCaXtnc1CdgCX2Dzzp2IBUfe8+4KvlKiVs2qIgdrr4mev +x9Fu37M1eVfLNl0NSh3+XRBizVaY9hk3ttq0u7eXxI3kdMN2pozDP0hvdWailIFSdql JEsaDBgszdoUKavs5wPGMa0FTbY2LPeiP6r6EX30cMeN/sxKEje4LfEUfCc74JdToslM LkIuVof8fqJIRPnI3ljPn/surJP0Pcood5v2hnZ2lIOCdPYqRgt/2w/oz+OtP9LTuApN J9BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iRIp0TqQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id qf29-20020a1709077f1d00b007707edd5487si2513554ejc.947.2022.10.29.09.45.58; Sat, 29 Oct 2022 09:46:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iRIp0TqQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbiJ2Q34 (ORCPT + 99 others); Sat, 29 Oct 2022 12:29:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229494AbiJ2Q3w (ORCPT ); Sat, 29 Oct 2022 12:29:52 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87F261903D for ; Sat, 29 Oct 2022 09:29:50 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id z14so10282863wrn.7 for ; Sat, 29 Oct 2022 09:29:50 -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=naPJ1M3MRESguYaKsY0dGxRKs4ndHregyKB6rOGXWB0=; b=iRIp0TqQ2a7nIzesUVtuCO+QYyAWZqwk0+jOL/UdMhoHEH9FDgsTtnIUqJ3pWoDUyi WujkEwlvw94XMT1h9xv2Vx+fIcY1PZ37/6knKsey062xGogSWWbMbKlGp4HkHCg9Uujw aGvZNbt8t9Ra7IyMKwWwVRsZ9UBb0GECv6zLWOQKELviTHF0FftwwKFn8QPL1Zp16N1M qraSVUSrGu6WlIHRRUidTVGJ/hN57+Fe8i7xJfraZT9Tb+JvwzZ1DuUsLtY98J7hLGvf gvslJEL2UrgHOx1OEXtACgK8UYLuWpSAoVFjtMvKv65DzfdOuSmbg3j+yKNOLFj8dc5T XwAQ== 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=naPJ1M3MRESguYaKsY0dGxRKs4ndHregyKB6rOGXWB0=; b=7RJwuFsduRxHAREQCGEvDXKz3E5qTv7nTzyY0Oo+TiBqgkzRIHR4gEUGDHryKibOGx aK4ANU3i9PqcgGeQyM5DuBSNImlATOvBc2rcNaIafUHEUkwPOhcnuaHNtqxWHLTR/M+F BpjMRv8/0O090KX8x9yWhZ77MfVeUMhahhKB0WLPkgV2eyZ9RaB4mEr6O11XvOD8710S msGzI9B/SdOt45K41Uj/6pVhye2nAmyOF0YZ3pIRcJm9++76ycMVdYjz6JAYoECcKKa/ quWnMObyKiP3PjRMEcQN//XK/Z/hkhk05B7xSCqjczjmeuqh3ypIxJqQqZLsufZLDcKN TdKg== X-Gm-Message-State: ACrzQf2Nd3N05i3x5j7/ssm1EIzh3fjj2JcpJZHIfHYMhfxUaGanh33k 6Uy3epWKtnAtNHGALTJqcdk= X-Received: by 2002:adf:ab1d:0:b0:236:6301:c77 with SMTP id q29-20020adfab1d000000b0023663010c77mr2669890wrc.119.1667060989045; Sat, 29 Oct 2022 09:29:49 -0700 (PDT) Received: from localhost.localdomain ([111.88.98.191]) by smtp.gmail.com with ESMTPSA id m11-20020adfa3cb000000b002366e3f1497sm1906007wrb.6.2022.10.29.09.29.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 09:29:48 -0700 (PDT) From: Osama Muhammad To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Osama Muhammad , Samuel Thibault Subject: [PATCH] Accessiblity: speakup_ltlk: specifying the default driver parameters among the module params Date: Sat, 29 Oct 2022 21:29:28 +0500 Message-Id: <20221029162928.18071-1-osmtendev@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748041184814459909?= X-GMAIL-MSGID: =?utf-8?q?1748041184814459909?= This is an enhancement which allows to specify the default driver parameters among the module parameters. Adding default variables to the speakup_ltlk 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 --- drivers/accessibility/speakup/speakup_ltlk.c | 53 ++++++++++++++++---- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/drivers/accessibility/speakup/speakup_ltlk.c b/drivers/accessibility/speakup/speakup_ltlk.c index f885cfaa27c8..1e279ae143bf 100644 --- a/drivers/accessibility/speakup/speakup_ltlk.c +++ b/drivers/accessibility/speakup/speakup_ltlk.c @@ -18,17 +18,28 @@ static int synth_probe(struct spk_synth *synth); -static struct var_t vars[] = { - { CAPS_START, .u.s = {"\x01+35p" } }, - { CAPS_STOP, .u.s = {"\x01-35p" } }, - { RATE, .u.n = {"\x01%ds", 8, 0, 9, 0, 0, NULL } }, - { PITCH, .u.n = {"\x01%dp", 50, 0, 99, 0, 0, NULL } }, - { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, - { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, - { PUNCT, .u.n = {"\x01%db", 7, 0, 15, 0, 0, NULL } }, - { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } }, - { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } }, - { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, + +enum default_vars_id { + CAPS_START_ID = 0, CAPS_STOP_ID, + RATE_ID, PITCH_ID, + VOL_ID, TONE_ID, PUNCT_ID, + VOICE_ID, FREQUENCY_ID, + DIRECT_ID, V_LAST_VAR_ID, + NB_ID +}; + + +static struct var_t vars[NB_ID] = { + [CAPS_START_ID] = { CAPS_START, .u.s = {"\x01+35p" } }, + [CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x01-35p" } }, + [RATE_ID] = { RATE, .u.n = {"\x01%ds", 8, 0, 9, 0, 0, NULL } }, + [PITCH_ID] = { PITCH, .u.n = {"\x01%dp", 50, 0, 99, 0, 0, NULL } }, + [VOL_ID] = { VOL, .u.n = {"\x01%dv", 5, 0, 9, 0, 0, NULL } }, + [TONE_ID] = { TONE, .u.n = {"\x01%dx", 1, 0, 2, 0, 0, NULL } }, + [PUNCT_ID] = { PUNCT, .u.n = {"\x01%db", 7, 0, 15, 0, 0, NULL } }, + [VOICE_ID] = { VOICE, .u.n = {"\x01%do", 0, 0, 7, 0, 0, NULL } }, + [FREQUENCY_ID] = { FREQUENCY, .u.n = {"\x01%df", 5, 0, 9, 0, 0, NULL } }, + [DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, V_LAST_VAR }; @@ -160,10 +171,30 @@ static int synth_probe(struct spk_synth *synth) module_param_named(ser, synth_ltlk.ser, int, 0444); module_param_named(dev, synth_ltlk.dev_name, charp, 0444); module_param_named(start, synth_ltlk.startup, short, 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(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, 0444); +module_param_named(direct, vars[DIRECT_ID].u.n.default_val, int, 0444); + + + MODULE_PARM_DESC(ser, "Set the serial port for the synthesizer (0-based)."); MODULE_PARM_DESC(dev, "Set the device e.g. ttyUSB0, for the synthesizer."); MODULE_PARM_DESC(start, "Start the synthesizer once it is loaded."); +MODULE_PARM_DESC(rate, "Set the rate variable on load."); +MODULE_PARM_DESC(pitch, "Set the pitch variable on load."); +MODULE_PARM_DESC(vol, "Set the vol variable on load."); +MODULE_PARM_DESC(tone, "Set the tone variable on load."); +MODULE_PARM_DESC(punct, "Set the punct variable on load."); +MODULE_PARM_DESC(voice, "Set the voice variable on load."); +MODULE_PARM_DESC(frequency, "Set the frequency variable on load."); +MODULE_PARM_DESC(direct, "Set the direct variable on load."); + module_spk_synth(synth_ltlk);