Members of this list may recall a question I asked regarding the CP2102 serial
adapter a couple of weeks ago. For the curious, my original message is attached
to this one. At the time, I was rather frustrated at the "go away and figure it
out for yourself" response, but, in the end, I'm glad I then did exactly that.
The answer turns out to be that current Linux support for this particular set
of serial adapters, i.e. the cp210x driver, is rather inadequate. For my
particular problem, the driver initializes the adapter by configuring its flow
control to keep DTR and RTS low, and then using a manual operation to force
both of them high. The difference between our code then, and Linux's code, is
that we were forcing DTR and RTS high before configuring the flow control
settings the same way the driver does, which caused the adapter to honour the
instruction to keep both lines low.
The fact is, as I see it, that the cp210x driver is doing things incorrectly.
What it should do is not use those manual operations at all, and configure the
adapter's flow control settings to keep both DTR and RTS high. That's the
proper way to persistently maintain their desired state without any risk of
them honouring the initially configured and incorrect instruction to keep them
low. That's what our code now does, and it works very well.
In addition, the test for setting termios's CRTSCTS bit is only half right, and
there's no support at all for other forms of flow control (like input and/or
output XON-XOFF) even though the user gets no error at all if he requests any
of them.
So, in the end, I'm sorry I showed so much frustration at this list's response,
am glad that I did my own research, and, even though I like Linux a great deal,
am still glad we have our own code which, on all platforms, will work correctly
in a portable way.
--
Dave Mielke | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario | http://Mielke.cc/bible/
EMail: dave@xxxxxxxxx | Canada K2A 1H7 | http://FamilyRadio.com/
--- Begin Message ---
- Subject: CP2102 mystery - ttyUSB0 vs usbfsbrltty/Projects/BrailleMemo/usbmon-ttyUSB0
- From: Dave Mielke <dave@xxxxxxxxx>
- Date: Fri, 6 Dec 2013 11:37:34 -0500
- User-agent: Mutt/1.5.21 (2010-09-15)
I'm using kernel 3.11.4-101.fc18.x86_64 on a 64-bit Fedora 19 system.
I'd very much appreciate a bit of help from someone who understands the CP2102
serial adapter support. When I access it through /dev/ttyUSB0, it works fine.
When, however, I access it through usbfs, it doesn't seem to be working. When I
study the usbmon output for both methods, they look to be effectively the same.
I've attached the two usbmon traces to this message (as usbmon-ttyUSB0 and
usbmon-usbfs).
The first output packet to endpoint 1 (FF,FF,11,00,00,00) probes the device.
When ttyUSB0 is being used, there's an immediate response of the single byte
0X10. This is correct. When usbfs is being used, the probe is resent several
times, with no response, and then the code gives up. All of the control setup
for the CP2102 completes without any errors. The usbfs code even includes a set
of queries to ensure that the serial configuration is correct - it is. The
correct settings are: 9600 baud, 1 stop bit, 8 data bits, no parity, no flow
control.
In case it matters, urb->signr is set (to SIGRTMIN). We rely in receipt of this
signal to know that the URB is ready to be reaped. This is working very well
for many devices. Is there a possibility, though, that the kernel support for
the CP2102 doesn't work this way?
I'd sure appreciate any help on this issue as I've been staring at it for a
couple of weeks now and haven't been able to spot the problem.
--
Dave Mielke | 2213 Fox Crescent | The Bible is the very Word of God.
Phone: 1-613-726-0014 | Ottawa, Ontario | http://Mielke.cc/bible/
EMail: dave@xxxxxxxxx | Canada K2A 1H7 | http://FamilyRadio.com/
ffff8801138a0540 3905511537 S Co:5:065:0 s 41 00 0001 0000 0000 0
ffff8801138a0540 3905511739 C Co:5:065:0 0 0
ffff8801138a0540 3905511804 S Ci:5:065:0 s c1 1d 0000 0000 0004 4 <
ffff8801138a0540 3905513729 C Ci:5:065:0 0 4 = 00c20100
ffff8801138a0540 3905513780 S Ci:5:065:0 s c1 04 0000 0000 0002 2 <
ffff8801138a0540 3905515728 C Ci:5:065:0 0 2 = 0008
ffff8801138a0540 3905515780 S Ci:5:065:0 s c1 14 0000 0000 0010 16 <
ffff8801138a0540 3905517728 C Ci:5:065:0 0 16 = 00000000 00000000 00000000 00000000
ffff8801138a0540 3905517788 S Co:5:065:0 s 41 1e 0000 0000 0004 4 = 00c20100
ffff8801138a0540 3905519728 C Co:5:065:0 0 4 >
ffff8801f1357b40 3905519788 S Bi:5:065:1 -115 256 <
ffff8801f1357480 3905519806 S Bi:5:065:1 -115 256 <
ffff8801138a0540 3905519814 S Co:5:065:0 s 41 07 0303 0000 0000 0
ffff8801138a0540 3905521728 C Co:5:065:0 0 0
ffff8801138a0540 3905521922 S Co:5:065:0 s 41 1e 0000 0000 0004 4 = 80250000
ffff8801138a0540 3905523729 C Co:5:065:0 0 4 >
ffff8801f1357f00 3905523925 S Bo:5:065:1 -115 6 = ffff1100 0000
ffff8801f1357f00 3905524727 C Bo:5:065:1 0 6 >
ffff8801f1357b40 3905533742 C Bi:5:065:1 0 1 = 10
ffff8801f1357b40 3905533769 S Bi:5:065:1 -115 256 <
ffff8801f1357f00 3905534088 S Bo:5:065:1 -115 8 = ffff2000 02000000
ffff8801f1357f00 3905534742 C Bo:5:065:1 0 8 >
ffff8801f1357480 3905545744 C Bi:5:065:1 0 1 = 01
ffff8801f1357480 3905545767 S Bi:5:065:1 -115 256 <
ffff8801f1357f00 3905720408 S Bo:5:065:1 -115 22 = ffff3100 1000d0f4 f07c7cbe 00460a42 8c84e200 e42c
ffff8801f1357f00 3905720748 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3909722839 S Bo:5:065:1 -115 22 = ffff3100 100084e2 00626026 44b80000 00000000 0000
ffff8801f1357f00 3909723834 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3913727391 S Bo:5:065:1 -115 22 = ffff3100 1000e4a4 a46c2c00 11000000 00000000 0000
ffff8801f1357f00 3913727920 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3915801255 S Bo:5:065:1 -115 22 = ffff3100 1000e4a4 a46c2c00 0a110000 00000000 0000
ffff8801f1357f00 3915801953 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3915968840 S Bo:5:065:1 -115 22 = ffff3100 1000e4a4 a46c2c00 0a281100 00000000 0000
ffff8801f1357f00 3915969971 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3916120839 S Bo:5:065:1 -115 22 = ffff3100 1000e4a4 a46c2c00 0a286811 00000000 0000
ffff8801f1357f00 3916120966 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3916198389 S Bo:5:065:1 -115 22 = ffff3100 1000e4a4 a46c2c00 0a28686c 11000000 0000
ffff8801f1357f00 3916198964 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3916258345 S Bo:5:065:1 -115 22 = ffff3100 1000e4a4 a46c2c00 0a28686c e8110000 0000
ffff8801f1357f00 3916258963 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3916463844 S Bo:5:065:1 -115 22 = ffff3100 10001100 00000000 00000000 00000000 0000
ffff8801f1357f00 3916463973 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3916471390 S Bo:5:065:1 -115 22 = ffff3100 1000d0f4 f07c7cbe 00686ca4 e8e8848c 0000
ffff8801f1357f00 3916471964 C Bo:5:065:1 0 22 >
ffff8801f1357f00 3916497807 S Bo:5:065:1 -115 6 = ffff2800 0000
ffff8801f1357f00 3916497977 C Bo:5:065:1 0 6 >
ffff8801c67743c0 3916505997 S Co:5:065:0 s 41 1e 0000 0000 0004 4 = 00c20100
ffff8801c67743c0 3916506983 C Co:5:065:0 0 4 >
ffff8801c67743c0 3916507047 S Co:5:065:0 s 41 07 0300 0000 0000 0
ffff8801c67743c0 3916508981 C Co:5:065:0 0 0
ffff8801f1357b40 3916509984 C Bi:5:065:1 -2 0
ffff8801f1357480 3916510984 C Bi:5:065:1 -2 0
ffff8801c67743c0 3916511032 S Co:5:065:0 s 41 00 0000 0000 0000 0
ffff8801c67743c0 3916511988 C Co:5:065:0 0 0
ffff88021c656e40 3933657927 S Ci:5:065:0 s 80 06 0200 0000 00ff 255 <
ffff88021c656e40 3933658348 C Ci:5:065:0 0 32 = 09022000 01010080 32090400 0002ff00 00020705 81024000 00070501 02400000
ffff8801928e4540 3933659354 S Co:5:065:0 s 41 00 0000 0000 0000 0
ffff8801928e4540 3933660341 C Co:5:065:0 0 0
ffff8801928e4540 3933660441 S Co:5:065:0 s 41 00 0001 0000 0000 0
ffff8801928e4540 3933662370 C Co:5:065:0 0 0
ffff8801928e4540 3933662535 S Co:5:065:0 s 41 07 0101 0000 0000 0
ffff8801928e4540 3933664345 C Co:5:065:0 0 0
ffff8801928e4540 3933664459 S Co:5:065:0 s 41 07 0202 0000 0000 0
ffff8801928e4540 3933666342 C Co:5:065:0 0 0
ffff8801928e4540 3933666476 S Co:5:065:0 s 41 1e 0000 0000 0004 4 = 80250000
ffff8801928e4540 3933668358 C Co:5:065:0 0 4 >
ffff8801928e4540 3933668481 S Co:5:065:0 s 41 03 0800 0000 0000 0
ffff8801928e4540 3933670359 C Co:5:065:0 0 0
ffff8801928e4540 3933670483 S Ci:5:065:0 s c1 14 0000 0000 0010 16 <
ffff8801928e4540 3933672360 C Ci:5:065:0 0 16 = 00000000 00000000 00000000 00000000
ffff8801928e4540 3933672572 S Co:5:065:0 s 41 13 0000 0000 0010 16 = 00000000 00000000 00000000 00000000
ffff8801928e4540 3933674359 C Co:5:065:0 0 16 >
ffff8801928e4540 3933674489 S Ci:5:065:0 s c1 1d 0000 0000 0010 16 <
ffff8801928e4540 3933676356 C Ci:5:065:0 0 4 = 80250000
ffff8801928e4540 3933676515 S Ci:5:065:0 s c1 14 0000 0000 0010 16 <
ffff8801928e4540 3933678356 C Ci:5:065:0 0 16 = 00000000 00000000 00000000 00000000
ffff8801928e4540 3933678522 S Ci:5:065:0 s c1 04 0000 0000 0010 16 <
ffff8801928e4540 3933680360 C Ci:5:065:0 0 2 = 0008
ffff8801928e4540 3933680521 S Ci:5:065:0 s c1 08 0000 0000 0010 16 <
ffff8801928e4540 3933682360 C Ci:5:065:0 0 1 = 10
ffff8801928e4d80 3933682635 S Bi:5:065:1 -115 64 <
ffff8801928e4cc0 3933682714 S Ci:5:065:0 s 80 06 0300 0000 00ff 255 <
ffff8801928e4cc0 3933684360 C Ci:5:065:0 0 4 = 04030904
ffff8801928e4cc0 3933684682 S Ci:5:065:0 s 80 06 0301 0409 00ff 255 <
ffff8801928e4cc0 3933686357 C Ci:5:065:0 0 26 = 1a035300 69006c00 69006300 6f006e00 20004c00 61006200 7300
ffff88021c656600 3933686559 S Ci:5:065:0 s 80 06 0302 0409 00ff 255 <
ffff88021c656600 3933688357 C Ci:5:065:0 0 74 = 4a034300 50003200 31003000 32002000 55005300 42002000 74006f00 20005500
ffff88021c656600 3933688702 S Ci:5:065:0 s 80 06 0303 0409 00ff 255 <
ffff88021c656600 3933690359 C Ci:5:065:0 0 10 = 0a033000 30003000 3100
ffff88021c656600 3933690730 S Bo:5:065:1 -115 6 = ffff1100 0000
ffff88021c656600 3933691361 C Bo:5:065:1 0 6 >
ffff88021c656600 3934701695 S Bo:5:065:1 -115 6 = ffff1100 0000
ffff88021c656600 3934702382 C Bo:5:065:1 0 6 >
ffff88014d3ff180 3935711849 S Bo:5:065:1 -115 6 = ffff1100 0000
ffff88014d3ff180 3935712405 C Bo:5:065:1 0 6 >
ffff8801542f9d80 3936721614 S Bo:5:065:1 -115 6 = ffff1100 0000
ffff8801542f9d80 3936722421 C Bo:5:065:1 0 6 >
ffff88014d3ff900 3937731855 S Bo:5:065:1 -115 6 = ffff1100 0000
ffff88014d3ff900 3937732434 C Bo:5:065:1 0 6 >
ffff8801928e4840 3938741846 S Bo:5:065:1 -115 6 = ffff1100 0000
ffff8801928e4840 3938742470 C Bo:5:065:1 0 6 >
ffff8801928e4d80 3939752494 C Bi:5:065:1 -2 0
--- End Message ---