Re: [PATCH v2 1/8] tty: add a poll() callback in struct tty_operations

2017-06-15 Thread Tal Shorer
On Wed, Jun 14, 2017 at 4:33 PM, Alan Cox wrote: >> That would cut it, but TIOCPKT is too coupled with having a linked tty. >> I could make acm behave like a pty (accept TIOCPKT and issue the >> ctrl_status bits), but for that I need n_tty to know that packet does >> not always mean a linked tty i

Re: [PATCH v2 1/8] tty: add a poll() callback in struct tty_operations

2017-06-14 Thread Tal Shorer
On Wed, Jun 14, 2017 at 11:20 AM, Tal Shorer wrote: > On Wed, Jun 14, 2017 at 4:15 AM, Alan Cox wrote: >> On Tue, 13 Jun 2017 09:52:07 +0300 >> Tal Shorer wrote: >> >>> If a tty driver wants to notify the user of some exceptional event, >>> such as a usb c

Re: [PATCH v2 1/8] tty: add a poll() callback in struct tty_operations

2017-06-14 Thread Tal Shorer
On Wed, Jun 14, 2017 at 4:15 AM, Alan Cox wrote: > On Tue, 13 Jun 2017 09:52:07 +0300 > Tal Shorer wrote: > >> If a tty driver wants to notify the user of some exceptional event, >> such as a usb cdc acm device set_line_coding event, it needs a way to >> modify the

Re: [PATCH v2 6/8] usb: gadget: f_acm: add an ioctl to get the current line coding

2017-06-13 Thread Tal Shorer
On Tue, Jun 13, 2017 at 12:19 PM, Greg KH wrote: > On Tue, Jun 13, 2017 at 09:52:12AM +0300, Tal Shorer wrote: >> The user can issue USB_F_GET_LINE_CODING to get the current line coding >> as set by the host (or the default if unset yet). >> >> Signed-off-by: Tal Shore

[PATCH v2 2/8] usb: gadget: u_serial: propagate poll() to the next layer

2017-06-12 Thread Tal Shorer
In order for a serial function to add flags to the poll() mask of their tty files, propagate the poll() callback to the next layer so it can return a mask if it sees fit to do so. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/u_serial.c | 16 drivers/usb/gadget

[PATCH v2 3/8] usb: gadget: f_acm: validate set_line_coding requests

2017-06-12 Thread Tal Shorer
We shouldn't accept malformed set_line_coding requests. All values were taken from table 17 (section 6.3.11) of the cdc1.2 spec available at http://www.usb.org/developers/docs/devclass_docs/ The table is in the file PTSN120.pdf. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/f_

[PATCH v2 1/8] tty: add a poll() callback in struct tty_operations

2017-06-12 Thread Tal Shorer
will be called in n_tty_poll(). Signed-off-by: Tal Shorer --- drivers/tty/n_tty.c| 2 ++ include/linux/tty_driver.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index bdf0e6e..7af8c29 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty

[PATCH v2 6/8] usb: gadget: f_acm: add an ioctl to get the current line coding

2017-06-12 Thread Tal Shorer
The user can issue USB_F_GET_LINE_CODING to get the current line coding as set by the host (or the default if unset yet). Signed-off-by: Tal Shorer --- Documentation/ioctl/ioctl-number.txt | 1 + drivers/usb/gadget/function/f_acm.c | 19 +++ include/uapi/linux/usb/f_acm.h

[PATCH v2 8/8] usb: gadget: u_serial: remove port_line_config from struct gserial

2017-06-12 Thread Tal Shorer
, the initialized never-used values were invalid, with bDataBits and bCharFormat having each other's value. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/u_serial.c | 22 ++ drivers/usb/gadget/function/u_serial.h | 3 --- 2 files changed, 2 insertions(+), 23

[PATCH v2 5/8] usb: gadget: f_acm: initialize port_line_coding when creating an instance

2017-06-12 Thread Tal Shorer
Initialize acm->port_line_coding with something that makes sense so that we can return a valid line coding if the host requests GetLineCoding before requesting SetLineCoding Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/f_acm.c | 6 ++ 1 file changed, 6 insertions(+) diff --

[PATCH v2 4/8] usb: gadget: u_serial: propagate ioctl() to the next layer

2017-06-12 Thread Tal Shorer
In order for a serial function to implement its own ioctl() calls, propagate the ioctl() callback to the next layer so it can handle it if it sees fit to do so. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/u_serial.c | 15 +++ drivers/usb/gadget/function/u_serial.h | 1

[PATCH v2 7/8] usb: gadget: f_acm: notify the user on SetLineCoding

2017-06-12 Thread Tal Shorer
Notify the user with a POLLPRI event when the host issues a SetLineCoding request so that they can act upon it, for example by configuring the line coding on a real serial port. The event is cleared when the user reads the line coding using USB_F_ACM_GET_LINE_CODING ioctl() Signed-off-by: Tal

[PATCH v2 0/8] Allow f_acm gadgets to notify the user about SetLineCoding requests

2017-06-12 Thread Tal Shorer
se to have there (and had a REVISIT comment at every turn), it was never used and it was initialized with invalid values. Changes from v1: - patch 5 was messed up, which made patch 6 also messed up. fixed both of these. Tal Shorer (8): tty: add a poll() callback in struct tty_operations usb: ga

Re: [PATCH 6/8] usb: gadget: f_acm: add an ioctl to get the current line coding

2017-06-12 Thread Tal Shorer
On Mon, Jun 12, 2017 at 9:02 PM, Tal Shorer wrote: > On Mon, Jun 12, 2017 at 8:26 PM, Tal Shorer wrote: >> The user can issue USB_F_GET_LINE_CODING to get the current line coding >> as set by the host (or the default if unset yet). >> >> Signed-off-by: Tal Sho

Re: [PATCH 6/8] usb: gadget: f_acm: add an ioctl to get the current line coding

2017-06-12 Thread Tal Shorer
On Mon, Jun 12, 2017 at 8:26 PM, Tal Shorer wrote: > The user can issue USB_F_GET_LINE_CODING to get the current line coding > as set by the host (or the default if unset yet). > > Signed-off-by: Tal Shorer > --- > @@ -764,10 +783,10 @@ static struct usb_function *acm

[PATCH 1/8] tty: add a poll() callback in struct tty_operations

2017-06-12 Thread Tal Shorer
will be called in n_tty_poll(). Signed-off-by: Tal Shorer --- drivers/tty/n_tty.c| 2 ++ include/linux/tty_driver.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index bdf0e6e..7af8c29 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty

[PATCH 5/8] usb: gadget: f_acm: initialize port_line_coding when creating an instance

2017-06-12 Thread Tal Shorer
Initialize acm->port_line_coding with something that makes sense so that we can return a valid line coding if the host requests GetLineCoding before requesting SetLineCoding Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/f_acm.c | 6 ++ 1 file changed, 6 insertions(+) diff --

[PATCH 2/8] usb: gadget: u_serial: propagate poll() to the next layer

2017-06-12 Thread Tal Shorer
In order for a serial function to add flags to the poll() mask of their tty files, propagate the poll() callback to the next layer so it can return a mask if it sees fit to do so. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/u_serial.c | 16 drivers/usb/gadget

[PATCH 7/8] usb: gadget: f_acm: notify the user on SetLineCoding

2017-06-12 Thread Tal Shorer
Notify the user with a POLLPRI event when the host issues a SetLineCoding request so that they can act upon it, for example by configuring the line coding on a real serial port. The event is cleared when the user reads the line coding using USB_F_ACM_GET_LINE_CODING ioctl() Signed-off-by: Tal

[PATCH 3/8] usb: gadget: f_acm: validate set_line_coding requests

2017-06-12 Thread Tal Shorer
We shouldn't accept malformed set_line_coding requests. All values were taken from table 17 (section 6.3.11) of the cdc1.2 spec available at http://www.usb.org/developers/docs/devclass_docs/ The table is in the file PTSN120.pdf. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/f_

[PATCH 4/8] usb: gadget: u_serial: propagate ioctl() to the next layer

2017-06-12 Thread Tal Shorer
In order for a serial function to implement its own ioctl() calls, propagate the ioctl() callback to the next layer so it can handle it if it sees fit to do so. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/u_serial.c | 15 +++ drivers/usb/gadget/function/u_serial.h | 1

[PATCH 6/8] usb: gadget: f_acm: add an ioctl to get the current line coding

2017-06-12 Thread Tal Shorer
The user can issue USB_F_GET_LINE_CODING to get the current line coding as set by the host (or the default if unset yet). Signed-off-by: Tal Shorer --- Documentation/ioctl/ioctl-number.txt | 1 + drivers/usb/gadget/function/f_acm.c | 27 +++ include/uapi/linux/usb

[PATCH 8/8] usb: gadget: u_serial: remove port_line_config from struct gserial

2017-06-12 Thread Tal Shorer
, the initialized never-used values were invalid, with bDataBits and bCharFormat having each other's value. Signed-off-by: Tal Shorer --- drivers/usb/gadget/function/u_serial.c | 22 ++ drivers/usb/gadget/function/u_serial.h | 3 --- 2 files changed, 2 insertions(+), 23

[PATCH 0/8] Allow f_acm gadgets to notify the user about SetLineCoding requests

2017-06-12 Thread Tal Shorer
se to have there (and had a REVISIT comment at every turn), it was never used and it was initialized with invalid values. Tal Shorer (8): tty: add a poll() callback in struct tty_operations usb: gadget: u_serial: propagate poll() to the next layer usb: gadget: f_acm: validate set_line_codi