Received: by 2002:a05:6358:795:b0:dc:4c66:fc3e with SMTP id n21csp751849rwj; Sat, 29 Oct 2022 10:13:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5JzoCwUSoyKbg7yvmlI+DG0gR3VmF4/3LNm9Vv5ZyjDM3ETdKVCOmiFqTWpIuNyjn2Iv/v X-Received: by 2002:a17:907:a428:b0:78d:9fab:84fb with SMTP id sg40-20020a170907a42800b0078d9fab84fbmr4447818ejc.694.1667063585207; Sat, 29 Oct 2022 10:13:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667063585; cv=none; d=google.com; s=arc-20160816; b=XFaEL2gQMYR2Y5T5zJiCXLSqmmgwhmQe7NG5okPI54ugvoDbqO0osl6BPiRToIsE4s QNYsZGqXpvwkmPjOOob1dpKXN+7A/0LwVO/X5kqJ/zdfRlsFMpt5KwEXzaFBXEeSw1g2 fp4TxOqpiurdYeMZ4NtvnKToU4z3L8gcsH5tUm0Oere7u5a0HmQrkWQPBsQ8TZkOx5Mz E3ANCdpFCAnRrjy0zCjLJY4Vuam5XQbRNiORxvjoowHpPEdkYER82TAM8kbG0UQO6Krp Z6DCzVYqyy+EHcErM6U1b/pzlJEhn8gZp+N9RD58geez+Ec56eDV5Qk/Lbh1pbUlqLR8 nuhQ== 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=pSxCGUJ2fS47/D5KQNutWHx6IqYinz5fCVnWfoUaNh4=; b=EHHgmSEfl2eUUTGr2YSI0okqyexT+yeQe+/dKHRMWG38JFWHMjji7iXFjsUY8jWc2g Z/RJfoF5qo7IX9pZaddaasSlBToBdHFd/jDnkj4x9mylkWZnuB366Z+OJezLzsMJziA4 MnN2/7zz1jS53I28iR6uB4yrh8uO/9jnU/td9C6nvhmEQDKQrTbuQCVuyNdq2HFv9m2t 5gJ7lTTLV1/gY+MD01XSJN+d/J6fpQlxO7kHF3/lRV+EapYmxdPdsQEOTfxGiWloTewb My7BcbukDI5JW6GRh1fLLmNS+SXyuhDj0EqfWQHnXqXW2ANHENmIvpmZ91Fsjgx3sJIB Xvqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=NNB+j7ov; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nb15-20020a1709071c8f00b00780805b99ccsi2675598ejc.648.2022.10.29.10.12.36; Sat, 29 Oct 2022 10:13:05 -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=NNB+j7ov; 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 S229637AbiJ2Qau (ORCPT + 99 others); Sat, 29 Oct 2022 12:30:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbiJ2Qaq (ORCPT ); Sat, 29 Oct 2022 12:30:46 -0400 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C5F849B6A for ; Sat, 29 Oct 2022 09:30:44 -0700 (PDT) Received: by mail-wm1-x335.google.com with SMTP id v130-20020a1cac88000000b003bcde03bd44so8299470wme.5 for ; Sat, 29 Oct 2022 09:30:44 -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=pSxCGUJ2fS47/D5KQNutWHx6IqYinz5fCVnWfoUaNh4=; b=NNB+j7ovS20wgFCS3LKpn7ZIfvCQH882G1PISCxKthqgKtxL6MewW7kolSgbo8N5xv rpQaKMBLpl/ypz9W2fj5OQ4syq/tJs6IoJXV+yvwektecUpkD4W4sA3CDjA+pBmyKdt8 EDiWBNlz+UChXA/VlSYvFR430I10m4sk26DuM3005yoaXdeXDdySOAPxL1BxEniT+nM/ +qzhVyR4E+qVoKlYWp7wXpNSPBZ8oZKeELGgqScgz7tlpKKv0y0bydg9fgAo3itHdy0Q 4U14xQ0YfaShKP9SZ8LXiYTQLHh6wVBKDeBbJDFc3AAZkkf/Q1EGTjgMbTJ1hhRz3Llf StxA== 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=pSxCGUJ2fS47/D5KQNutWHx6IqYinz5fCVnWfoUaNh4=; b=hHJWam1/QzyAWww2no10GrraaWik3kZ2U0MHukzmPk0shP3K+BIASrGGZ7REnxiwsU w7XzbAkh9jMoDmrFJm/dIIAqXNd2lj7yYPau2omF/Fb7cGoBxjpCtT36OeT5dcUD7IIC It8vu9wzjZeGNBEhIFIOsoN/Pu4V19YCs+LxxUVLz9Xfm3tnU8W+ueiBFX5YE9cB/mwb hrG+cyWieHeV6dI9A+VWse9XqClz/RKJy/r+CKFLVev5jL9Ab2RbQsziCz6QRuAsbXvc o20s2jOjb4phmdlxnGIzzkQOaJuIBA1kpfyl/IJa2yAPeKbw03dWeeSHI5D9/p/GHXAC TTSA== X-Gm-Message-State: ACrzQf1y6t2IkqL8Ytw8azB8bn8+KF4hoCjGLBw8hZ01ZzqVRepLtOhJ FThlBHN6Llu2slGrZrk2Hhs= X-Received: by 2002:a05:600c:1e26:b0:3cf:5238:13fc with SMTP id ay38-20020a05600c1e2600b003cf523813fcmr9321919wmb.151.1667061043217; Sat, 29 Oct 2022 09:30:43 -0700 (PDT) Received: from localhost.localdomain ([111.88.98.191]) by smtp.gmail.com with ESMTPSA id cc6-20020a5d5c06000000b002364835caacsm1860417wrb.112.2022.10.29.09.30.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 09:30:42 -0700 (PDT) From: Osama Muhammad To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Osama Muhammad , Samuel Thibault Subject: [PATCH] Accessiblity: speakup_txprt: specifying the default driver parameters among the module params Date: Sat, 29 Oct 2022 21:30:33 +0500 Message-Id: <20221029163033.18337-1-osmtendev@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 This is an enhancement which allows to specify the default driver parameters among the module parameters. Adding default variables to the speakup_txprt 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_txprt.c | 45 +++++++++++++++---- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/accessibility/speakup/speakup_txprt.c b/drivers/accessibility/speakup/speakup_txprt.c index 9e781347f7eb..4d0a0d4c41f0 100644 --- a/drivers/accessibility/speakup/speakup_txprt.c +++ b/drivers/accessibility/speakup/speakup_txprt.c @@ -16,14 +16,29 @@ #define SYNTH_CLEAR 0x18 #define PROCSPEECH '\r' /* process speech char */ -static struct var_t vars[] = { - { CAPS_START, .u.s = {"\x05P8" } }, - { CAPS_STOP, .u.s = {"\x05P5" } }, - { RATE, .u.n = {"\x05R%d", 5, 0, 9, 0, 0, NULL } }, - { PITCH, .u.n = {"\x05P%d", 5, 0, 9, 0, 0, NULL } }, - { VOL, .u.n = {"\x05V%d", 5, 0, 9, 0, 0, NULL } }, - { TONE, .u.n = {"\x05T%c", 12, 0, 25, 61, 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, + DIRECT_ID, V_LAST_VAR_ID, + NB_ID +}; + + + + + +static struct var_t vars[NB_ID] = { + [CAPS_START_ID] = { CAPS_START, .u.s = {"\x05P8" } }, + [CAPS_STOP_ID] = { CAPS_STOP, .u.s = {"\x05P5" } }, + [RATE_ID] = { RATE, .u.n = {"\x05R%d", 5, 0, 9, 0, 0, NULL } }, + [PITCH_ID] = { PITCH, .u.n = {"\x05P%d", 5, 0, 9, 0, 0, NULL } }, + [VOL_ID] = { VOL, .u.n = {"\x05V%d", 5, 0, 9, 0, 0, NULL } }, + [TONE_ID] = { TONE, .u.n = {"\x05T%c", 12, 0, 25, 61, 0, NULL } }, + [DIRECT_ID] = { DIRECT, .u.n = {NULL, 0, 0, 1, 0, 0, NULL } }, V_LAST_VAR }; @@ -112,10 +127,24 @@ static struct spk_synth synth_txprt = { module_param_named(ser, synth_txprt.ser, int, 0444); module_param_named(dev, synth_txprt.dev_name, charp, 0444); module_param_named(start, synth_txprt.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(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(direct, "Set the direct variable on load."); + + module_spk_synth(synth_txprt); -- 2.25.1