From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by befuddled.reisers.ca (Postfix, from userid 65534) id 2B8031F0816; Mon, 3 Apr 2017 17:02:54 -0400 (EDT) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) by befuddled.reisers.ca (Postfix) with ESMTPS id 325591F07A1 for ; Mon, 3 Apr 2017 17:02:52 -0400 (EDT) Received: by mail-wr0-x235.google.com with SMTP id t20so8103225wra.1 for ; Mon, 03 Apr 2017 14:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=9Wu9Xp9xcdDcSDpL5RUGgKssrQE6unVbln0I2SSZkdw=; b=cSNQYtkBZyoHAGtDWa1wm7PlAgNmEY88W7iySwf+EM7sB7Tdd37gPlYRtZavrfJOTS 4F2L2GYfO1pZZzHVEtAfGkjW9AcPIMh3cu0Aze+6WNXGEqU7ZiCJO7CtyJMfeXTXt3/C 1OguveyzaoCcj+FoofEvGrl5qsYsHHxrK/wnssuzSr58ov0rTU1TFH6Ix2aGAoqIry6H u/TSON+Cwy5lXKJQZaClgI5wVLuK5BONcAmOzPSZhWnenj9rI76tiHbbeojx9tNqFdYp lDaAvgcQhwWgz7nBpASmlyGNpJ+y56C2w68DvEtcOSInRR0xdWzcD0hh5osu2u1voCKU +c9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=9Wu9Xp9xcdDcSDpL5RUGgKssrQE6unVbln0I2SSZkdw=; b=oyfTnEARexU4jX6nQ2OCSk7wLffO74+MEDjNRmubdalSwF0vasqtzoxgBT9ayS7szQ BEJApTNd4nCNJqchh6MW9wGb1Mh3Zgeg4bZ5+2GbgraWVSrqalcllicJPLsQc35JVx+Y Gfa8i3tFBzh5D2F26PhItkS8o2k1zCSBaC5/aes28nRzmJ6w69EdZ9u/QuyTeHfISxym d+ND7C2r+1UpR6P4sg9d74yFsnr5ZPJSwRROz+0kfxihPj9UXyvEwngNaA4Kp7AtGL2u Wrau9B3lYgYNBGdHnU8hDEhxnl7/FEv6eDZF7faZd73o1Cl4BhsqnC4JEdaa8mFlu6NX xecQ== X-Gm-Message-State: AFeK/H1JbMUtZmidUy4UFNBpdyWkT4bX6931vYOVPXeO40fF1aGNkYVGlXju/cZtnCo1HA== X-Received: by 10.28.169.130 with SMTP id s124mr11249725wme.137.1491253369431; Mon, 03 Apr 2017 14:02:49 -0700 (PDT) Received: from sanghar ([2a00:23c4:7320:5e00:224:d6ff:fe76:7136]) by smtp.gmail.com with ESMTPSA id b42sm19697792wra.36.2017.04.03.14.02.48 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Apr 2017 14:02:48 -0700 (PDT) Date: Mon, 3 Apr 2017 22:02:47 +0100 From: Okash Khawaja To: speakup@linux-speakup.org Subject: Re: [patch 0/7] staging: speakup: migrate synths to use TTY-based comms Message-ID: <20170403210247.GA4366@sanghar> References: <20170403202123.194386356@gmail.com> <20170403203925.GA1388@sanghar> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="DocE+STaALJfprDB" Content-Disposition: inline In-Reply-To: <20170403203925.GA1388@sanghar> User-Agent: Mutt/1.7.2 (2016-11-26) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 X-BeenThere: speakup@linux-speakup.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Speakup is a screen review system for Linux." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Apr 2017 21:02:54 -0000 --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Patch correctly re-attached. Sorry about the trouble. On Mon, Apr 03, 2017 at 09:39:25PM +0100, Okash Khawaja wrote: > > > Hi, > > The staging-next tree wasn't working for me, specially the usb modules. > So I took following steps: > > 1. Switch to kernel versio 4.10.0 (I guess others upto 4.10.8 will be > fine) > > 2. Copy drivers/staging/speakup directory from staging-next tree to > overwrite the one in 4.10.0. > > 3. Use the patch I have attached as the first patch instead of the one > in this email series ([patch 1/7] staging: speakup: export > tty_open_by_driver). > > 4. Apply rest of the patches in this patchset. > > That worked for me. As I have mentioned before, apollo and double talk > lt worked fine but I haven't done thorough testing. If you have > questions about applying patches, do let me know. > > Thanks, > Okash --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=01_enable_kernel_access_to_tty_device Index: linux-4.10.1/drivers/tty/tty_io.c =================================================================== --- linux-4.10.1.orig/drivers/tty/tty_io.c +++ linux-4.10.1/drivers/tty/tty_io.c @@ -855,7 +855,7 @@ int tty_hung_up_p(struct file *filp) { - return (filp->f_op == &hung_up_tty_fops); + return (filp && filp->f_op == &hung_up_tty_fops); } EXPORT_SYMBOL(tty_hung_up_p); @@ -1368,7 +1368,10 @@ struct tty_struct *tty; if (driver->ops->lookup) - tty = driver->ops->lookup(driver, file, idx); + if (!file) + tty = ERR_PTR(-EIO); + else + tty = driver->ops->lookup(driver, file, idx); else tty = driver->ttys[idx]; @@ -1986,7 +1989,7 @@ struct tty_driver *console_driver = console_device(index); if (console_driver) { driver = tty_driver_kref_get(console_driver); - if (driver) { + if (driver && filp) { /* Don't let /dev/console block */ filp->f_flags |= O_NONBLOCK; break; @@ -2019,7 +2022,7 @@ * - concurrent tty driver removal w/ lookup * - concurrent tty removal from driver table */ -static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, +struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, struct file *filp) { struct tty_struct *tty; @@ -2064,6 +2067,7 @@ tty_driver_kref_put(driver); return tty; } +EXPORT_SYMBOL(tty_open_by_driver); /** * tty_open - open a tty device Index: linux-4.10.1/drivers/tty/tty_port.c =================================================================== --- linux-4.10.1.orig/drivers/tty/tty_port.c +++ linux-4.10.1/drivers/tty/tty_port.c @@ -335,7 +335,7 @@ * tty_port_block_til_ready - Waiting logic for tty open * @port: the tty port being opened * @tty: the tty device being bound - * @filp: the file pointer of the opener + * @filp: the file pointer of the opener or NULL * * Implement the core POSIX/SuS tty behaviour when opening a tty device. * Handles: @@ -369,7 +369,7 @@ tty_port_set_active(port, 1); return 0; } - if (filp->f_flags & O_NONBLOCK) { + if (filp == NULL || filp->f_flags & O_NONBLOCK) { /* Indicate we are open */ if (C_BAUD(tty)) tty_port_raise_dtr_rts(port); Index: linux-4.10.1/include/linux/tty.h =================================================================== --- linux-4.10.1.orig/include/linux/tty.h +++ linux-4.10.1/include/linux/tty.h @@ -394,6 +394,8 @@ /* tty_io.c */ extern int __init tty_init(void); extern const char *tty_name(const struct tty_struct *tty); +extern struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, + struct file *filp); #else static inline void console_init(void) { } --DocE+STaALJfprDB--