Bug 1235715

Summary: USB serial DB9 adapter with ch340 chip is recognized but not working
Product: [Fedora] Fedora Reporter: Diego <diego.ml>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 24CC: alvin, diego.ml, gansalmon, itamar, jamie.ostrowski, jonathan, kernel-maint, madhu.chinakonda, mchehab
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-04-28 17:27:20 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Output of lsusb -v -d 1a86:7523
none
Real output of lsusb -v -d 1a86:7523 none

Description Diego 2015-06-25 14:47:20 UTC
Description of problem:
I've bought a USB serial adapter which is based on ch340 chipset.
# lsusb -d 1a86:7523
Bus 001 Device 015: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Kernel seems to bring up correctly the driver:
[giu25 16:33] usb 1-1.4.3: new full-speed USB device number 15 using xhci_hcd
[  +0,085072] usb 1-1.4.3: New USB device found, idVendor=1a86, idProduct=7523
[  +0,000004] usb 1-1.4.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[  +0,000002] usb 1-1.4.3: Product: USB2.0-Ser!
[  +0,000716] ch341 1-1.4.3:1.0: ch341-uart converter detected
[  +0,001119] usb 1-1.4.3: ch341-uart converter now attached to ttyUSB0

but opening the device with minicom or screen doesn't produce any input or output. Using an FTDI based adapter works perfectly on the contrary. The same ch340 device works fine on Windows 7 with official driver, so the device isn't broken.

Version-Release number of selected component (if applicable):
# uname -a
Linux localhost.localdomain 4.0.5-200.fc21.x86_64 #1 SMP Mon Jun 8 16:25:02 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

How reproducible:
Always

Steps to Reproduce:
1. plug the adapter
2. ttyUSB0 appers
3. try using the device with minicom or screen

Actual results:
No input / output.

Expected results:
Input / output flows correctly.

Additional info:
The minicom configuration is 15200 8N1 without hardware flow control, with software flow control. Same configuration works with an FTDI adapter.

The exact model I have is this one in the photo ("340" can be read on the blue plastics of the DB9 connector):
http://www.alibaba.com/product-detail/CABLE-USB-2-0-TO-RS232_60100908931.html

Here are some random infos that might be relevant I found in the internet about this chip:
- "official" Linux driver (doesn't build on 4.0):
http://www.wch.cn/download/CH341SER_LINUX_ZIP.html
- workaround somebody has found (will test it when I have time):
https://www.centos.org/forums/viewtopic.php?t=7369#p216174
- never upstreamed patch:
http://marc.info/?l=linux-usb&m=139749449900662&w=2
- datasheet:
http://www.seeedstudio.com/wiki/images/7/7c/CH340DS1_EN.PDF

Comment 1 Diego 2015-06-25 14:49:00 UTC
Created attachment 1043166 [details]
Output of lsusb -v -d 1a86:7523

Comment 2 Diego 2015-06-25 14:50:36 UTC
Created attachment 1043167 [details]
Real output of lsusb -v -d 1a86:7523

Previous attachment was wrong (no "-v" option).

Comment 3 Fedora End Of Life 2015-11-04 11:21:21 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 4 Diego 2015-11-05 10:37:24 UTC
Still is present at least in F22 with 4.2 kernel, so likely on F23 too.

Comment 5 Diego 2016-03-03 16:23:54 UTC
Still applies to F23 with kernel 4.4.2-301.fc23.x86_64

Comment 6 Alvin Austin 2016-07-22 14:10:52 UTC
This still has not been fixed.

Fedora 23:
[1209987.585301] usb 2-1.4: new full-speed USB device number 7 using ehci-pci
[1209987.671459] usb 2-1.4: New USB device found, idVendor=1a86, idProduct=7523
[1209987.671464] usb 2-1.4: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[1209987.671466] usb 2-1.4: Product: USB2.0-Ser!
[1209987.671831] ch341 2-1.4:1.0: ch341-uart converter detected
[1209987.673916] usb 2-1.4: ch341-uart converter now attached to ttyUSB0

# uname -a
Linux fedora23 4.5.7-202.fc23.x86_64 #1 SMP Tue Jun 28 18:22:51 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Still applies to F23 with kernel 4.5.7-202.fc23.x86_64

=====

Fedora 24:
[ 1208.222677] usb 2-1.3: new full-speed USB device number 5 using ehci-pci
[ 1208.309453] usb 2-1.3: New USB device found, idVendor=1a86, 
idProduct=7523
[ 1208.309463] usb 2-1.3: New USB device strings: Mfr=0, Product=2, 
SerialNumber=0
[ 1208.309469] usb 2-1.3: Product: USB2.0-Ser!
[ 1208.351738] usbcore: registered new interface driver ch341
[ 1208.351786] usbserial: USB Serial support registered for ch341-uart
[ 1208.351820] ch341 2-1.3:1.0: ch341-uart converter detected
[ 1208.354803] usb 2-1.3: ch341-uart converter now attached to ttyUSB0
[root@dell:~]# ver
Fedora release 24 (Twenty Four)

Linux fedora24.localdomain 4.6.4-301.fc24.x86_64 #1 SMP Tue Jul 12 11:50:00 
UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

Still applies to F24 with kernel 4.6.4-301.fc24.x86_64

====

There is *some* communication that can be observed (e.g. with Minicom), but the data is corrupted.  If you bridge the RX and TX pins on the adapter, for instance, garbage is echoed back rather than the characters you typed.

Comment 7 Alvin Austin 2016-07-22 17:11:51 UTC
Looking through bugzilla, it seems that Bug 1323328 might be a duplicate of this issue.
https://bugzilla.redhat.com/show_bug.cgi?id=1323328

Comment 8 Laura Abbott 2016-09-23 19:21:51 UTC
*********** MASS BUG UPDATE **************
 
We apologize for the inconvenience.  There is a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 24 kernel bugs.
 
Fedora 24 has now been rebased to 4.7.4-200.fc24.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.
 
If you have moved on to Fedora 25, and are still experiencing this issue, please change the version to Fedora 25.
 
If you experience different issues, please open a new bug report for those.

Comment 9 Alvin Austin 2016-09-25 20:19:43 UTC
This bug still exists with kernels 
4.7.3.200-fc24.x86_64 and 
4.7.4.200-fc24.x86_64

Comment 10 Alvin Austin 2016-10-07 17:48:20 UTC
This bug still exists with kernel 4.7.5.200-fc24.x86_64

Comment 11 Alvin Austin 2016-10-21 15:18:05 UTC
This has not been fixed with the Fedora 25 Beta 1 release.

Kernel 4.8.0-0.rc7.git0.1.fc25.x86_64

USB-Serial Adapter
driver: ch341
idVendor=1a86, idProduct=7523

The chipset is recognized, and the ch341 kernel module is loaded, but the baud rate is not set correctly, and so garbage is sent/received through the usb/serial adapter instead of valid characters (for instance with minicom).

Comment 12 Justin M. Forbes 2017-04-11 15:02:28 UTC
*********** MASS BUG UPDATE **************

We apologize for the inconvenience.  There are a large number of bugs to go through and several of them have gone stale.  Due to this, we are doing a mass bug update across all of the Fedora 24 kernel bugs.

Fedora 25 has now been rebased to 4.10.9-100.fc24.  Please test this kernel update (or newer) and let us know if you issue has been resolved or if it is still present with the newer kernel.

If you have moved on to Fedora 26, and are still experiencing this issue, please change the version to Fedora 26.

If you experience different issues, please open a new bug report for those.

Comment 13 Justin M. Forbes 2017-04-28 17:27:20 UTC
*********** MASS BUG UPDATE **************
This bug is being closed with INSUFFICIENT_DATA as there has not been a response in 2 weeks. If you are still experiencing this issue, please reopen and attach the 
relevant data from the latest kernel you are running and any data that might have been requested previously.

Comment 14 Diego 2017-05-10 09:23:08 UTC
As of kernel-4.10.12-200.fc25.x86_64 this looks closed, after a raft of commits in the upstream kernel:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/log/drivers/usb/serial/ch341.c

I tested it now, and must admit with great pleasure it seems to work as it should. Closed for me since kernel 4.10 or around that.

Comment 15 Alvin Austin 2017-05-10 17:32:38 UTC
Agreed! Works now with Fedora 25 kernel 4.10.13-200.fc25.x86_84.  

Fantastic!! Thanks to all involved in fixing this.