mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Ahmad Fatoum <ahmad@a3f.at>, barebox@lists.infradead.org
Cc: bst@pengutronix.de
Subject: Re: [PATCH v1 4/4] USB: gadget: ACM: don't announce V.25ter support
Date: Sat, 21 Sep 2019 13:00:37 +0200	[thread overview]
Message-ID: <bd80b9e6-1290-8d48-2104-6a44aef18dad@pengutronix.de> (raw)
In-Reply-To: <ef9d7f48-944c-62e7-2dc0-76b2e97451da@pengutronix.de>

On 9/20/19 10:51 AM, Ahmad Fatoum wrote:
> On 9/20/19 9:58 AM, Ahmad Fatoum wrote:
>> barebox currently announces support for ITU V.25ter AT commands, but
>> doesn't handle them specially when they arrive. Instead they are passed
>> as is to the sole barebox input console, where it may interfere with
>> valid user input.
>> This is especially annoying as ModemManager probes ttyACM devices that
>> announce their AT command support. So even when not using the ttyACM
>> device at all, the other UART ports are affected.
>>
>> Fix this by ceasing to announce USB_CDC_ACM_PROTO_AT_V25TER as function
>> protocol. After applying this patch, I can't see any spurious AT or ~x~
>> symbols on the console anymore.
> 
> I've also looked into the possibility of barebox emulating a USB-Serial
> port and showing up as a ttyUSB device under Linux.
> Apparently the two most popular chips are FTDI's and Prolific's, but both
> have taken steps in the past to make their Windows drivers not work with
> cloned chips[1][2]. I figured the safest to emulate would be the chip
> used safely in these Chinese Arduino Knock-offs because they're so prevalent
> and stumbled upon the CH340. Its drivers are mainline for Linux, but for other
> platforms, they need to be downloaded manually.
> 
> Seeing that the change to 'fix' barebox ttyACM is just two lines, I settled
> for that instead. It might be possible to get rid of the control interface
> descriptor altogether, but I don't know whether it would impact the portability
> across operating systems, so I've opted for this less invasive patch.

Getting rid of the control descriptor makes Linux ttyACM disappear, so I would
stick to this patch.

> Only tested on Linux v5.2 so far.

Tested working as well on Windows 10 Home and macOS Mojave.

> 
> Cheers
> Ahmad
> 
> [1]: https://hackaday.com/2016/02/01/ftdi-drivers-break-fake-chips-again/
> [2]: https://www.eevblog.com/forum/reviews/ftdi-driver-kills-fake-ftdi-ft232/msg534439/#msg534439
> 
>>
>> Cc: <bst@pengutronix.de>
>> Cc: <jlu@pengutronix.de>
>> Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
>> ---
>>  drivers/usb/gadget/f_acm.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/f_acm.c b/drivers/usb/gadget/f_acm.c
>> index cba59b15859b..42a2b03ad291 100644
>> --- a/drivers/usb/gadget/f_acm.c
>> +++ b/drivers/usb/gadget/f_acm.c
>> @@ -104,7 +104,7 @@ acm_iad_descriptor = {
>>  	.bInterfaceCount = 	2,	// control + data
>>  	.bFunctionClass =	USB_CLASS_COMM,
>>  	.bFunctionSubClass =	USB_CDC_SUBCLASS_ACM,
>> -	.bFunctionProtocol =	USB_CDC_ACM_PROTO_AT_V25TER,
>> +	.bFunctionProtocol =	USB_CDC_PROTO_NONE,
>>  	/* .iFunction =		DYNAMIC */
>>  };
>>  
>> @@ -116,7 +116,7 @@ static struct usb_interface_descriptor acm_control_interface_desc = {
>>  	.bNumEndpoints =	1,
>>  	.bInterfaceClass =	USB_CLASS_COMM,
>>  	.bInterfaceSubClass =	USB_CDC_SUBCLASS_ACM,
>> -	.bInterfaceProtocol =	USB_CDC_ACM_PROTO_AT_V25TER,
>> +	.bInterfaceProtocol =	USB_CDC_PROTO_NONE,
>>  	/* .iInterface = DYNAMIC */
>>  };
>>  
>>
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2019-09-21 11:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20  7:58 [PATCH v1 1/4] console: disallow opening for writing when no write method defined Ahmad Fatoum
2019-09-20  7:58 ` [PATCH v1 2/4] input: set console input name as input Ahmad Fatoum
2019-09-20  7:58 ` [PATCH v1 3/4] common: ubsan: ignore shifting one into sign bit Ahmad Fatoum
2019-09-21  7:47   ` Rouven Czerwinski
2019-09-21 10:59     ` Ahmad Fatoum
2019-09-20  7:58 ` [PATCH v1 4/4] USB: gadget: ACM: don't announce V.25ter support Ahmad Fatoum
2019-09-20  8:51   ` Ahmad Fatoum
2019-09-21 11:00     ` Ahmad Fatoum [this message]
2019-09-23  6:59 ` [PATCH v1 1/4] console: disallow opening for writing when no write method defined Sascha Hauer

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=bd80b9e6-1290-8d48-2104-6a44aef18dad@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    --cc=bst@pengutronix.de \
    /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