Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1664505 > unrolled thread

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

Started byTal Shorer <tal.shorer@gmail.com>
First post2017-06-13 09:00 +0200
Last post2017-06-13 09:00 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 5/8] usb: gadget: f_acm: initialize port_line_coding when creating an instance Tal Shorer <tal.shorer@gmail.com> - 2017-06-13 09:00 +0200

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

FromTal Shorer <tal.shorer@gmail.com>
Date2017-06-13 09:00 +0200
Subject[PATCH v2 5/8] usb: gadget: f_acm: initialize port_line_coding when creating an instance
Message-ID<tRNXX-4BW-7@gated-at.bofh.it>
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 <tal.shorer@gmail.com>
---
 drivers/usb/gadget/function/f_acm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/usb/gadget/function/f_acm.c b/drivers/usb/gadget/function/f_acm.c
index e023313..188d314 100644
--- a/drivers/usb/gadget/function/f_acm.c
+++ b/drivers/usb/gadget/function/f_acm.c
@@ -763,6 +763,12 @@ static struct usb_function *acm_alloc_func(struct usb_function_instance *fi)
 	acm->port.func.unbind = acm_unbind;
 	acm->port.func.free_func = acm_free_func;
 
+	/* initialize port_line_coding with something that makes sense */
+	acm->port_line_coding.dwDTERate = cpu_to_le32(9600);
+	acm->port_line_coding.bCharFormat = USB_CDC_1_STOP_BITS;
+	acm->port_line_coding.bParityType = USB_CDC_NO_PARITY;
+	acm->port_line_coding.bDataBits = 8;
+
 	return &acm->port.func;
 }
 
-- 
2.7.4

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web