public inbox for speakup@linux-speakup.org
 help / color / mirror / Atom feed
From: Okash Khawaja <okash.khawaja@gmail.com>
To: samuel.thibault@ens-lyon.org
Cc: speakup@linux-speakup.org
Subject: [patch 6/6] staging: speakup: Migrate acntsa, bns, dectlk and txprt to ttyio
Date: Sat, 25 Feb 2017 19:30:31 +0000	[thread overview]
Message-ID: <20170225193031.GA4525@sanghar> (raw)
In-Reply-To: <20170225192842.GA4519@sanghar>

This changes the above four synths to TTY-based comms. They were chosen as a
first pass because their serial comms are straightforward, i.e. they don't use
serial input and don't do internal port knocking. This also moves
spk_serial_synth_probe() into serialio.c in order to segregate those functions
which directly use serial comms into serialio.c.

Signed-off-by: Okash Khawaja <okash.khawaja@gmail.com>

Index: linux-stable/drivers/staging/speakup/speakup_acntsa.c
===================================================================
--- linux-stable.orig/drivers/staging/speakup/speakup_acntsa.c
+++ linux-stable/drivers/staging/speakup/speakup_acntsa.c
@@ -100,9 +100,9 @@
 	.checkval = SYNTH_CHECK,
 	.vars = vars,
 	.probe = synth_probe,
-	.release = spk_serial_release,
-	.serial_out = spk_serial_out,
-	.synth_immediate = spk_synth_immediate,
+	.release = spk_ttyio_release,
+	.serial_out = spk_ttyio_out,
+	.synth_immediate = spk_ttyio_immediate,
 	.catch_up = spk_do_catch_up,
 	.flush = spk_synth_flush,
 	.is_alive = spk_synth_is_alive_restart,
@@ -125,9 +125,9 @@
 {
 	int failed;
 
-	failed = spk_serial_synth_probe(synth);
+	failed = spk_ttyio_synth_probe(synth);
 	if (failed == 0) {
-		spk_synth_immediate(synth, "\033=R\r");
+		synth->synth_immediate(synth, "\033=R\r");
 		mdelay(100);
 	}
 	synth->alive = !failed;
Index: linux-stable/drivers/staging/speakup/speakup_bns.c
===================================================================
--- linux-stable.orig/drivers/staging/speakup/speakup_bns.c
+++ linux-stable/drivers/staging/speakup/speakup_bns.c
@@ -96,10 +96,10 @@
 	.startup = SYNTH_START,
 	.checkval = SYNTH_CHECK,
 	.vars = vars,
-	.probe = spk_serial_synth_probe,
-	.release = spk_serial_release,
-	.serial_out = spk_serial_out,
-	.synth_immediate = spk_synth_immediate,
+	.probe = spk_ttyio_synth_probe,
+	.release = spk_ttyio_release,
+	.serial_out = spk_ttyio_out,
+	.synth_immediate = spk_ttyio_immediate,
 	.catch_up = spk_do_catch_up,
 	.flush = spk_synth_flush,
 	.is_alive = spk_synth_is_alive_restart,
Index: linux-stable/drivers/staging/speakup/speakup_txprt.c
===================================================================
--- linux-stable.orig/drivers/staging/speakup/speakup_txprt.c
+++ linux-stable/drivers/staging/speakup/speakup_txprt.c
@@ -95,10 +95,10 @@
 	.startup = SYNTH_START,
 	.checkval = SYNTH_CHECK,
 	.vars = vars,
-	.probe = spk_serial_synth_probe,
-	.release = spk_serial_release,
-	.serial_out = spk_serial_out,
-	.synth_immediate = spk_synth_immediate,
+	.probe = spk_ttyio_synth_probe,
+	.release = spk_ttyio_release,
+	.serial_out = spk_ttyio_out,
+	.synth_immediate = spk_ttyio_immediate,
 	.catch_up = spk_do_catch_up,
 	.flush = spk_synth_flush,
 	.is_alive = spk_synth_is_alive_restart,
Index: linux-stable/drivers/staging/speakup/speakup_dectlk.c
===================================================================
--- linux-stable.orig/drivers/staging/speakup/speakup_dectlk.c
+++ linux-stable/drivers/staging/speakup/speakup_dectlk.c
@@ -130,10 +130,10 @@
 	.vars = vars,
 	.default_pitch = ap_defaults,
 	.default_vol = g5_defaults,
-	.probe = spk_serial_synth_probe,
-	.serial_out = spk_serial_out,
-	.release = spk_serial_release,
-	.synth_immediate = spk_synth_immediate,
+	.probe = spk_ttyio_synth_probe,
+	.serial_out = spk_ttyio_out,
+	.release = spk_ttyio_release,
+	.synth_immediate = spk_ttyio_immediate,
 	.catch_up = do_catch_up,
 	.flush = synth_flush,
 	.is_alive = spk_synth_is_alive_restart,
Index: linux-stable/drivers/staging/speakup/serialio.c
===================================================================
--- linux-stable.orig/drivers/staging/speakup/serialio.c
+++ linux-stable/drivers/staging/speakup/serialio.c
@@ -181,6 +181,36 @@
 	return 1;
 }
 
+int spk_serial_synth_probe(struct spk_synth *synth)
+{
+	const struct old_serial_port *ser;
+	int failed = 0;
+
+	if ((synth->ser >= SPK_LO_TTY) && (synth->ser <= SPK_HI_TTY)) {
+		ser = spk_serial_init(synth->ser);
+		if (ser == NULL) {
+			failed = -1;
+		} else {
+			outb_p(0, ser->port);
+			mdelay(1);
+			outb_p('\r', ser->port);
+		}
+	} else {
+		failed = -1;
+		pr_warn("ttyS%i is an invalid port\n", synth->ser);
+	}
+	if (failed) {
+		pr_info("%s: not found\n", synth->long_name);
+		return -ENODEV;
+	}
+	pr_info("%s: ttyS%i, Driver Version %s\n",
+		synth->long_name, synth->ser, synth->version);
+	synth->alive = 1;
+	return 0;
+}
+EXPORT_SYMBOL_GPL(spk_serial_synth_probe);
+
+
 unsigned char spk_serial_in(void)
 {
 	int tmout = SPK_SERIAL_TIMEOUT;
Index: linux-stable/drivers/staging/speakup/synth.c
===================================================================
--- linux-stable.orig/drivers/staging/speakup/synth.c
+++ linux-stable/drivers/staging/speakup/synth.c
@@ -44,35 +44,6 @@
 
 static int do_synth_init(struct spk_synth *in_synth);
 
-int spk_serial_synth_probe(struct spk_synth *synth)
-{
-	const struct old_serial_port *ser;
-	int failed = 0;
-
-	if ((synth->ser >= SPK_LO_TTY) && (synth->ser <= SPK_HI_TTY)) {
-		ser = spk_serial_init(synth->ser);
-		if (ser == NULL) {
-			failed = -1;
-		} else {
-			outb_p(0, ser->port);
-			mdelay(1);
-			outb_p('\r', ser->port);
-		}
-	} else {
-		failed = -1;
-		pr_warn("ttyS%i is an invalid port\n", synth->ser);
-	}
-	if (failed) {
-		pr_info("%s: not found\n", synth->long_name);
-		return -ENODEV;
-	}
-	pr_info("%s: ttyS%i, Driver Version %s\n",
-		synth->long_name, synth->ser, synth->version);
-	synth->alive = 1;
-	return 0;
-}
-EXPORT_SYMBOL_GPL(spk_serial_synth_probe);
-
 /*
  * Main loop of the progression thread: keep eating from the buffer
  * and push to the serial port, waiting as needed

  reply	other threads:[~ UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
 [patch 0/6] staging: speakup: Introduce TTY-based comms Okash Khawaja
 ` [patch 1/6] tty_port: allow a port to be opened with a tty that has no file handle Okash Khawaja
   ` Samuel Thibault
     ` Samuel Thibault
       ` John Covici
         ` Samuel Thibault
       ` Okash Khawaja
         ` Samuel Thibault
           ` Okash Khawaja
             ` Samuel Thibault
               ` Okash Khawaja
                 ` Samuel Thibault
                   ` Okash Khawaja
     [not found]   ` <20170225192358.GA4499@sanghar>
     ` [patch 3/6] staging: speakup: refactor spk_stop_serial_interrupt Okash Khawaja
       ` [patch 4/6] staging: speakup: Add spk_ttyio Okash Khawaja
         ` [patch 5/6] staging: speakup: Make speakup_dummy use ttyio Okash Khawaja
           ` Okash Khawaja [this message]
             ` [patch 6/6] staging: speakup: Migrate acntsa, bns, dectlk and txprt to ttyio Samuel Thibault
             ` Samuel Thibault
               ` Samuel Thibault
                 ` Samuel Thibault
                   ` Okash Khawaja
                     ` Samuel Thibault
                       ` Okash Khawaja
                 ` Okash Khawaja
                   ` Samuel Thibault
                     ` Okash Khawaja
                       ` Samuel Thibault
             ` Samuel Thibault
             ` Samuel Thibault
               ` Okash Khawaja
                 ` Samuel Thibault
                   ` Okash Khawaja
                     ` Samuel Thibault
             ` Samuel Thibault
             ` Samuel Thibault
         ` [patch 4/6] staging: speakup: Add spk_ttyio Samuel Thibault
         ` Samuel Thibault
       ` [patch 3/6] staging: speakup: refactor spk_stop_serial_interrupt Samuel Thibault
         ` Okash Khawaja
           ` Samuel Thibault
     ` [patch 2/6] staging: speakup: Add serial_out method Samuel Thibault
     ` Samuel Thibault
       ` Okash Khawaja
         ` Samuel Thibault
 ` [patch 0/6] staging: speakup: Introduce TTY-based comms Trevor Astrope
   ` Okash Khawaja
 ` Samuel Thibault
   ` Samuel Thibault
 ` Samuel Thibault
 ` Read this first :) " Samuel Thibault
   ` Okash Khawaja
     ` Samuel Thibault

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170225193031.GA4525@sanghar \
    --to=okash.khawaja@gmail.com \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=speakup@linux-speakup.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).