RE: [PATCH] USB: serial: ch341: fix wrong baud rate setting calculation

2019-06-28 Thread Jonathan Olds
18.8% 200 1984127 0.8% 500 2985075 40.3% Measurements and working as a libre/open office document can be found at https://jontio.github.io/linux_kernel_work/ch43x_tests.ods Signed-off-by: Jonathan Olds --- drivers/usb/serial/ch341.c | 46 ++++++ 1 file chan

Re: [PATCH] USB: serial: ch341: fix wrong baud rate setting calculation

2019-06-20 Thread Johan Hovold
mit message with further details from your other mail. > Signed-off-by: jontio You need to sign off with your full name. It should also match the From line (author). > --- > drivers/usb/serial/ch341.c | 45 ++ > 1 file changed, 45 insertions(+) > &g

Re: linux/drivers/usb/serial/ch341.c calculates some baud rates wrong

2019-06-20 Thread Johan Hovold
uot;[PATCH] USB: serial: ch341: fix wrong baud rate setting calculation" > https://lore.kernel.org/linux-usb/20190608051309.4689-1-jon...@i4free.co.nz/ > ). Good job, looks like you got most things right from the start, but I'll comment on the patch directly. > I've measured the

Re: linux/drivers/usb/serial/ch341.c calculates some baud rates wrong

2019-06-13 Thread Greg KH
uot;[PATCH] USB: serial: ch341: fix wrong baud rate setting calculation"). The > Get_maintainers.pl file didn't work for me I got... > > ../../../scripts/get_maintainer.pl > 0001-USB-serial-ch341-fix-wrong-baud-rate-setting-calcula.patch > ../../../scripts/get_maintainer.pl:

RE: linux/drivers/usb/serial/ch341.c calculates some baud rates wrong

2019-06-13 Thread Jonathan Olds
Hi Johan, Thanks for the info. I followed https://nickdesaulniers.github.io/blog/2017/05/16/submitting-your-first-patc h-to-the-linux-kernel-and-responding-to-feedback/ and made a proposal patch ("[PATCH] USB: serial: ch341: fix wrong baud rate setting calculation"). The Get_maintaine

RE: linux/drivers/usb/serial/ch341.c calculates some baud rates wrong

2019-06-09 Thread Jonathan Olds
Hi Johan, Thanks for the info. I followed https://nickdesaulniers.github.io/blog/2017/05/16/submitting-your-first-patc h-to-the-linux-kernel-and-responding-to-feedback/ and made a proposal patch ("[PATCH] USB: serial: ch341: fix wrong baud rate setting calculation" https://lore.kernel

[PATCH] USB: serial: ch341: fix wrong baud rate setting calculation

2019-06-07 Thread jontio
t any baud rate and can produce a practically arbitrary large error (for example a 40% error for 500) this patch does not address this issue. Signed-off-by: jontio --- drivers/usb/serial/ch341.c | 45 ++ 1 file changed, 45 insertions(+) diff --git a/drivers/u

Re: [PATCH] USB: serial: ch341: type promotion bug in ch341_control_in()

2018-07-04 Thread Johan Hovold
error handling > doesn't work. > > Fixes: 2d5a9c72d0c4 ("USB: serial: ch341: fix control-message error handling") > Signed-off-by: Dan Carpenter Thanks for catching this. Now applied with a stable tag as this could have security implications. Johan -- To unsubscribe

[PATCH] USB: serial: ch341: type promotion bug in ch341_control_in()

2018-07-04 Thread Dan Carpenter
The "r" variable is an int and "bufsize" is an unsigned int so the comparison is type promoted to unsigned. If usb_control_msg() returns a negative that is treated as a high positive value and the error handling doesn't work. Fixes: 2d5a9c72d0c4 ("USB: serial: ch

Re: Patch for drivers/usb/serial/ch341.c enabling parity

2017-04-03 Thread Johan Hovold
On Sun, Apr 02, 2017 at 10:12:38AM -0700, Joe Perches wrote: > On Sun, 2017-04-02 at 18:57 +0200, Leif Neland wrote: > > There is a patch > > https://github.com/karlp/ch341-linux/blob/master/0001-usb-serial-ch341-Add-parity-support.patch > > which enables parity selection fo

Re: Patch for drivers/usb/serial/ch341.c enabling parity

2017-04-02 Thread Fabio Estevam
On Sun, Apr 2, 2017 at 3:00 PM, Leif Neland wrote: > There is a patch > > https://github.com/karlp/ch341-linux/blob/master/0001-usb-serial-ch341-Add-parity-support.patch > > which enables parity selection for the ch341 USB-RS485 adapter. > > From: Karl Palsson > Date: T

Patch for drivers/usb/serial/ch341.c enabling parity

2017-04-02 Thread Leif Neland
There is a patch https://github.com/karlp/ch341-linux/blob/master/0001-usb-serial-ch341-Add-parity-support.patch which enables parity selection for the ch341 USB-RS485 adapter. From: Karl Palsson Date: Tue, 18 Mar 2014 23:33:27 + This adapter is available for cheap on eBay. The patch

Re: Patch for drivers/usb/serial/ch341.c enabling parity

2017-04-02 Thread Joe Perches
On Sun, 2017-04-02 at 18:57 +0200, Leif Neland wrote: > There is a patch > https://github.com/karlp/ch341-linux/blob/master/0001-usb-serial-ch341-Add-parity-support.patch > which enables parity selection for the ch341 USB-RS485 adapter. > > From: Karl Palsson Date: Tue, 18 Ma

Re: [PATCH v2 09/14] USB: serial: ch341: fix control-message error handling

2017-01-16 Thread Johan Hovold
> > Check for short transfers, and make sure to log any transfer errors. > > > > Fixes: 6ce76104781a ("USB: Driver for CH341 USB-serial adaptor") > > Signed-off-by: Johan Hovold > > --- > > As this can also lead to bits of uninitialised heap buff

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2017-01-12 Thread Johan Hovold
> > > interrupts when the modem-status changes (e.g. remote end hangs up -- > > > > there should be debug messages)? > > > > > > Which version(s) would you like tested? > > > > You can use c51087107e88 ("USB: serial: ch341: rename modem-statu

Re: [PATCH v2 09/14] USB: serial: ch341: fix control-message error handling

2017-01-11 Thread Johan Hovold
. > > Fixes: 6ce76104781a ("USB: Driver for CH341 USB-serial adaptor") > Signed-off-by: Johan Hovold > --- As this can also lead to bits of uninitialised heap buffers leaking to user space via the modem-status interface, or to a remote device through break control, I'll CC stable

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2017-01-09 Thread Johan Hovold
be debug messages)? > > > > Which version(s) would you like tested? > > You can use c51087107e88 ("USB: serial: ch341: rename modem-status > register"). As you noticed, I decided to revert to using direct register writes to avoid having the modem-control lines be

[PATCH v2 12/14] USB: serial: ch341: rename modem-status register

2017-01-06 Thread Johan Hovold
Rename the shadow modem-status register currently named "line_status" to the less confusing "msr". Also rename the helper function used to parse the interrupt data. Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 16 1 file changed, 8 insert

[PATCH v2 06/14] USB: serial: ch341: fix line settings after reset-resume

2017-01-06 Thread Johan Hovold
reopened. Fixes: ba781bdf8662 ("USB: serial: ch341: add support for parity, frame length, stop bits") Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch3

[PATCH v2 07/14] USB: serial: ch341: fix baud rate and line-control handling

2017-01-06 Thread Johan Hovold
) something which for example could cause problems in setups where DTR is used to trigger a reset. Fixes: 4e46c410e050 ("USB: serial: ch341: reinitialize chip on reconfiguration") Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 24 +--- 1 file changed, 17

[PATCH v2 08/14] USB: serial: ch341: fix modem-status handling

2017-01-06 Thread Johan Hovold
(reset-resume). Fix this by dropping the redundant reconfiguration of the port at every open, and only read the MSR after the interrupt URB has been submitted. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS") Signed-off-by: Johan Hovold --- drivers/usb/serial/ch

[PATCH v2 13/14] USB: serial: ch341: rename LCR variable in set_termios

2017-01-06 Thread Johan Hovold
Rename the line-control-register variable in set_termios to "lcr" and use u8 type to match the shadow register. Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/usb/serial

[PATCH v2 11/14] USB: serial: ch341: rename shadow modem-control register

2017-01-06 Thread Johan Hovold
Rename the shadow modem-control register currently named "line_control" to the less confusing "mcr". Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/usb/seri

[PATCH v2 05/14] USB: serial: ch341: fix resume after reset

2017-01-06 Thread Johan Hovold
Fix reset-resume handling which failed to resubmit the read and interrupt URBs, thereby leaving a port that was open before suspend in a broken state until closed and reopened. Fixes: 1ded7ea47b88 ("USB: ch341 serial: fix port number changed after resume") Fixes: 2bfd1c96a9fb ("USB

[PATCH v2 03/14] USB: serial: ch341: fix modem-control and B0 handling

2017-01-06 Thread Johan Hovold
The modem-control signals are managed by the tty-layer during open and should not be asserted prematurely when set_termios is called from driver open. Also make sure that the signals are asserted only when changing speed from B0. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DT

[PATCH v2 02/14] USB: serial: ch341: fix open and resume after B0

2017-01-06 Thread Johan Hovold
The private baud_rate variable is used to configure the port at open and reset-resume and must never be set to (and left at) zero or reset-resume and all further open attempts will fail. Fixes: aa91def41a7b ("USB: ch341: set tty baud speed according to tty struct") Fixes: 664d5df92e88

[PATCH v2 10/14] USB: serial: ch341: clean up control debug messages

2017-01-06 Thread Johan Hovold
Clean up the control-transfer debug messages by dropping redundant information and unnecessary casts. Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c

[PATCH v2 04/14] USB: serial: ch341: fix open error handling

2017-01-06 Thread Johan Hovold
Make sure to stop the interrupt URB before returning on errors during open. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS") Cc: stable Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletion

[PATCH v2 09/14] USB: serial: ch341: fix control-message error handling

2017-01-06 Thread Johan Hovold
A short control transfer would currently fail to be detected, something which could lead to stale buffer data being used as valid input. Check for short transfers, and make sure to log any transfer errors. Fixes: 6ce76104781a ("USB: Driver for CH341 USB-serial adaptor") Signed-off

[PATCH v2 14/14] USB: serial: ch341: change initial line-control settings

2017-01-06 Thread Johan Hovold
Some CH340 devices appear unable to change the initial LCR settings, so set a sane 8N1 default during probe to enable basic support for such devices. Also drop a redundant LCR read during device initialisation. Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 14 +- 1

[PATCH v2 01/14] USB: serial: ch341: fix initial modem-control state

2017-01-06 Thread Johan Hovold
DTR and RTS will be asserted by the tty-layer when the port is opened and deasserted on close (if HUPCL is set). Make sure the initial state is not-asserted before the port is first opened as well. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS") Cc: stable Sig

[PATCH v2 00/14] USB: serial: ch341: fixes and improved CH340 support

2017-01-06 Thread Johan Hovold
This series fixes a number of problems with the ch341 driver, and adds support for a class of CH340 devices which does not seem to support changing the intial line settings (and does not support using the init vendor command to do so either). I noticed that using the init command to update the

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Johan Hovold
, and if the > > modem-control signals (DTR/RTS) are asserted at open? Do you get any > > interrupts when the modem-status changes (e.g. remote end hangs up -- > > there should be debug messages)? > > Which version(s) would you like tested? You can use c51087107e88 ("USB: se

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Russell Senior
On Tue, Dec 20, 2016 at 8:07 AM, Johan Hovold wrote: > Perhaps we should determine what else is working or broken first, > though. > > Russel, could you test if break-signalling works, and if the > modem-control signals (DTR/RTS) are asserted at open? Do you get any > interrupts when the modem-st

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Russell Senior
On Tue, Dec 20, 2016 at 7:52 AM, Johan Hovold wrote: > On Tue, Dec 20, 2016 at 07:31:55AM -0800, Russell Senior wrote: >> Not sure what the complaint about keys is about, I had not seen that >> before. > > Related to module signing, not sure why you only see it with the vendor > driver. Did you a

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Johan Hovold
commit that tries to dump the registers differently > > > (reading together with register 0x25): > > > > > > 3baa1eff4245 ("dbg: ch341: dump registers differently") > > > > 00019-g3baa1ef: > > > > Dec 20 04:30:50 willard kernel: usbcore: registered

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Johan Hovold
could give the attached vendor driver a quick spin just to > > confirm that? It's a rebased version against usb-next. > > > > I've also pushed a commit that tries to dump the registers differently > > (reading together with register 0x25): > > > &g

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Johan Hovold
in jane usb-next with your vendor patch, which I applied in > a local branch: > > 1-gfadd29d: > > Dec 20 07:18:36 willard kernel: PKCS#7 signature not signed with a trusted key > Dec 20 07:18:36 willard kernel: ch341: module verification failed: > signature and/or required

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Russell Senior
9d: Dec 20 07:18:36 willard kernel: PKCS#7 signature not signed with a trusted key Dec 20 07:18:36 willard kernel: ch341: module verification failed: signature and/or required key missing - tainting kernel Dec 20 07:18:36 willard kernel: usbcore: registered new interface driver ch341 Dec 20 07:18

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Russell Senior
rebased version against usb-next. > > I've also pushed a commit that tries to dump the registers differently > (reading together with register 0x25): > > 3baa1eff4245 ("dbg: ch341: dump registers differently") 00019-g3baa1ef: Dec 20 04:30:50 willard kernel:

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Johan Hovold
On Mon, Dec 19, 2016 at 02:12:05PM -0800, Russell Senior wrote: > >> Apart from the two additional tests mentioned above, can you also > >> provide a log from when connecting the device using the following commit > >> that I just pushed to the ch341 branch: > >

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-20 Thread Johan Hovold
. > > > >> Starting with 00013-gc510871: > >> > >> In 8-bit mode, interoperates correctly with pl2303. Switching to > >> 5-bit mode on both sides (I get unicode boxes of indeterminate > >> values). Switching back to 8-bit mode on both sides, I g

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-19 Thread Russell Senior
>> Apart from the two additional tests mentioned above, can you also >> provide a log from when connecting the device using the following commit >> that I just pushed to the ch341 branch: >> >> f341ee36198d ("dbg: ch341: add register dumps to probe&

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-19 Thread Russell Senior
correctly with pl2303. Switching to >> 5-bit mode on both sides (I get unicode boxes of indeterminate >> values). Switching back to 8-bit mode on both sides, I get correct >> text out both sides. Switching just the ch341 side back to 5-bit >> mode, I get 0xff's out

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-19 Thread Johan Hovold
f indeterminate > values). Switching back to 8-bit mode on both sides, I get correct > text out both sides. Switching just the ch341 side back to 5-bit > mode, I get 0xff's out on the pl2303 side (still in 8-bit mode). This > would seem to imply that byte-size changes are work

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-17 Thread Russell Senior
the ch341 side back to 5-bit mode, I get 0xff's out on the pl2303 side (still in 8-bit mode). This would seem to imply that byte-size changes are working on this version. Changing baud rate also works. 00014-g79e475a: dmesg shows on insert: [ 1430.504116] usb 6-2: new full-speed USB d

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Johan Hovold
. It's against my usb-next branch. > > I'll send you a couple of diagnostics patches as well shortly. I ended up pushing a new branch, ch341 to my tree git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial.git which contains the full series as well as four debug patc

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Johan Hovold
On Fri, Dec 16, 2016 at 08:04:18AM -0800, Russell Senior wrote: > Sorry, I got distracted. I'm back now. Do you want me to test your > 13 patch series? And what is that on top of? Yes, please. It's against my usb-next branch. I'll send you a couple of diagnostics patches as well shortly. Than

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Russell Senior
, Johan Hovold wrote: >> > The ch341 driver is based on reverse-engineering and contains some bits >> > which appear to be redundant and some which appear incompatible which >> > certain devices. >> > >> > Specifically, some CH340 devices seem unable to change

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Johan Hovold
On Fri, Dec 16, 2016 at 01:19:05PM +, Aidan Thornton wrote: > On Wed, Dec 14, 2016 at 3:28 PM, Johan Hovold wrote: > > The ch341 driver is based on reverse-engineering and contains some bits > > which appear to be redundant and some which appear incompatible which >

Re: [PATCH 10/13] USB: serial: ch341: fix baud rate and line-control handling

2016-12-16 Thread Johan Hovold
On Fri, Dec 16, 2016 at 12:39:45PM +, Aidan Thornton wrote: > On Thu, Dec 15, 2016 at 3:58 PM, Johan Hovold wrote: > > On Wed, Dec 14, 2016 at 04:28:07PM +0100, Johan Hovold wrote: > >> Some CH341 devices appear to require the use of the init vendor command > >> to

Re: [PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-16 Thread Aidan Thornton
On Wed, Dec 14, 2016 at 3:28 PM, Johan Hovold wrote: > The ch341 driver is based on reverse-engineering and contains some bits > which appear to be redundant and some which appear incompatible which > certain devices. > > Specifically, some CH340 devices seem unable to change t

Re: [PATCH 10/13] USB: serial: ch341: fix baud rate and line-control handling

2016-12-16 Thread Aidan Thornton
On Thu, Dec 15, 2016 at 3:58 PM, Johan Hovold wrote: > On Wed, Dec 14, 2016 at 04:28:07PM +0100, Johan Hovold wrote: >> Some CH341 devices appear to require the use of the init vendor command >> to set the baud rate and line-control register. Specifically, while >> using di

Re: [PATCH 10/13] USB: serial: ch341: fix baud rate and line-control handling

2016-12-15 Thread Johan Hovold
On Wed, Dec 14, 2016 at 04:28:07PM +0100, Johan Hovold wrote: > Some CH341 devices appear to require the use of the init vendor command > to set the baud rate and line-control register. Specifically, while > using direct register updates for speed and LCR seem to update those > settin

[PATCH 04/13] USB: serial: ch341: fix open error handling

2016-12-14 Thread Johan Hovold
Make sure to stop the interrupt URB before returning on errors during open. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS") Cc: stable Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletion

[PATCH 09/13] USB: serial: ch341: fix line settings after reset-resume

2016-12-14 Thread Johan Hovold
reopened. Fixes: ba781bdf8662 ("USB: serial: ch341: add support for parity, frame length, stop bits") Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/

Re: ch341

2016-12-14 Thread Johan Hovold
etting the divisors and lcr > > directly for all CH340 devices, while using the new method for CH341 > > only (which requires it). > > > > Just want to make sure that keeping a common init sequence would still > > work first. > > > > Note that I don't

[PATCH 12/13] USB: serial: ch341: rename shadow modem-control register

2016-12-14 Thread Johan Hovold
Rename the shadow modem-control register currently named "line_control" to the less confusing "mcr". Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/usb/seri

[PATCH 08/13] USB: serial: ch341: fix control-message error handling

2016-12-14 Thread Johan Hovold
A short control transfer would currently fail to be detected, something which could lead to stale buffer data being used as valid input. Check for short transfers, and make sure to log any transfer errors. Fixes: 6ce76104781a ("USB: Driver for CH341 USB-serial adaptor") Signed-off

[PATCH 05/13] USB: serial: ch341: fix resume after reset

2016-12-14 Thread Johan Hovold
Fix reset-resume handling which failed to resubmit the read and interrupt URBs, thereby leaving a port that was open before suspend in a broken state until closed and reopened. Fixes: 1ded7ea47b88 ("USB: ch341 serial: fix port number changed after resume") Fixes: 2bfd1c96a9fb ("USB

[PATCH 10/13] USB: serial: ch341: fix baud rate and line-control handling

2016-12-14 Thread Johan Hovold
Some CH341 devices appear to require the use of the init vendor command to set the baud rate and line-control register. Specifically, while using direct register updates for speed and LCR seem to update those settings correctly, not using the init command causes received data to be buffered until

[PATCH 11/13] USB: serial: ch341: clean up control debug messages

2016-12-14 Thread Johan Hovold
Clean up the control-transfer debug messages by dropping redundant information and unnecessary casts. Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/usb/serial/ch341.c b/drivers/usb/serial/ch341.c

[PATCH 07/13] USB: serial: ch341: fix modem-status handling

2016-12-14 Thread Johan Hovold
(reset-resume). Fix this by dropping the redundant reconfiguration of the port at every open, and only read the MSR after the interrupt URB has been submitted. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS") Signed-off-by: Johan Hovold --- drivers/usb/serial/ch

[PATCH 06/13] USB: serial: ch341: fix initial line settings

2016-12-14 Thread Johan Hovold
The ch341 driver is based on reverse-engineering and contains some bits which appear to be redundant and some which appear incompatible which certain devices. Specifically, some CH340 devices seem unable to change the initial line settings, which have so far been set to 5N1. Let's use a

[PATCH 13/13] USB: serial: ch341: rename modem-status register

2016-12-14 Thread Johan Hovold
Rename the shadow modem-status register currently named "line_status" to the less confusing "msr". Also rename the helper function used to parse the interrupt data. Signed-off-by: Johan Hovold --- drivers/usb/serial/ch341.c | 16 1 file changed, 8 insert

[PATCH 01/13] USB: serial: ch341: fix initial modem-control state

2016-12-14 Thread Johan Hovold
DTR and RST will be asserted by the tty-layer when the port is opened and deasserted on close (if HUPCL is set). Make sure the initial state is not-asserted before the port is first opened as well. Fixes: 6ce76104781a ("USB: Driver for CH341 USB-serial adaptor") Cc: stable Signed-off

[PATCH 03/13] USB: serial: ch341: fix modem-control and B0 handling

2016-12-14 Thread Johan Hovold
The modem-control signals are managed by the tty-layer during open and should not be asserted prematurely when set_termios is called from driver open. Also make sure that the signals are asserted only when changing speed from B0. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DT

[PATCH 00/13] USB: serial: ch341: fixes and improved CH340 support

2016-12-14 Thread Johan Hovold
This series fixes a number of problems with the ch341 driver, and adds support for a class of CH340 devices which does not seem to support the new method of configuring the line settings (using the init vendor command). These patches have been verified against CH340G and CH341A, but I need help

[PATCH 02/13] USB: serial: ch341: fix open and resume after B0

2016-12-14 Thread Johan Hovold
The private baud_rate variable is used to configure the port at open and reset-resume, which means it must never be set to (and left at) zero or reset-resume and all further open attempts will fail. Fixes: 664d5df92e88 ("USB: usb-serial ch341: support for DTR/RTS/CTS") Cc: stable Sig

Re: ch341

2016-12-12 Thread Russell Senior
t;> normal. I type an 'a' and I get and 'a' back. Likewise, I type an >> >> >> 'A' and I get an 'A' back. I used a saved .minicom.dfl file to >> >> >> configure the port. >> >> > >> >> > O

Re: ch341

2016-12-12 Thread Johan Hovold
> >> > > >> > Ok, so that seems to confirm the suspicion that changing settings after > >> > the initial configuration is failing (even though the device does indeed > >> > support 5-bit mode). > >> > > >> > Could you try to ve

Re: ch341

2016-12-12 Thread Johan Hovold
On Mon, Dec 12, 2016 at 10:55:14AM -0500, Alan Stern wrote: > On Mon, 12 Dec 2016, Johan Hovold wrote: > > > Ok, so that seems to confirm the suspicion that changing settings after > > the initial configuration is failing (even though the device does indeed > > support 5-bit mode). > > Perhaps is

Re: ch341

2016-12-12 Thread Russell Senior
'A' back. I used a saved .minicom.dfl file to >> >> configure the port. >> > >> > Ok, so that seems to confirm the suspicion that changing settings after >> > the initial configuration is failing (even though the device does indeed >> > su

Re: ch341

2016-12-12 Thread Alan Stern
On Mon, 12 Dec 2016, Johan Hovold wrote: > Ok, so that seems to confirm the suspicion that changing settings after > the initial configuration is failing (even though the device does indeed > support 5-bit mode). Perhaps issuing a USB device reset before trying to change the settings will help.

Re: ch341

2016-12-12 Thread Johan Hovold
o confirm the suspicion that changing settings after > > the initial configuration is failing (even though the device does indeed > > support 5-bit mode). > > > > Could you try to verify if that applies to the baud rate as well? That > > is, can you switch between say

Re: ch341

2016-12-12 Thread Russell Senior
try to verify if that applies to the baud rate as well? That > is, can you switch between say 9600 and 115200 after opening the port > and verify that against the pl2303? > > Still using usb-linus with the first LCR write removed. I can change the baud rate on the ch341 and make it not wo

Re: ch341

2016-12-12 Thread Johan Hovold
On Mon, Dec 12, 2016 at 07:09:34AM -0800, Russell Senior wrote: > On Mon, Dec 12, 2016 at 1:54 AM, Johan Hovold wrote: > > > Ok, so maybe your device simply does not support changing the line > > settings more than once. That is, the initial settings chosen are used > > until re-connected. This w

Re: ch341

2016-12-12 Thread Russell Senior
On Mon, Dec 12, 2016 at 1:54 AM, Johan Hovold wrote: > Ok, so maybe your device simply does not support changing the line > settings more than once. That is, the initial settings chosen are used > until re-connected. This would seem to be in accordance with a comment > found in one of the out-of-

Re: ch341

2016-12-12 Thread Johan Hovold
On Mon, Dec 12, 2016 at 04:36:54AM -0800, Russell Senior wrote: > On Mon, Dec 12, 2016 at 1:54 AM, Johan Hovold wrote: > > > If you connect the ch340 you have in loopback mode, with the removed > > initial LCR write that fixed the 5-bit behaviour, can you get that > > behaviour back by setting 5-

Re: ch341

2016-12-12 Thread Russell Senior
On Mon, Dec 12, 2016 at 1:54 AM, Johan Hovold wrote: > If you connect the ch340 you have in loopback mode, with the removed > initial LCR write that fixed the 5-bit behaviour, can you get that > behaviour back by setting 5-bit word size after opening the port? (This > was what I was going for wit

Re: ch341

2016-12-12 Thread Russell Senior
On Mon, Dec 12, 2016 at 1:48 AM, Johan Hovold wrote: > What exactly did you mean by "the baudrate change" above? If you revert > to setting the divisors directly (rather than using SERIAL_INIT), we > should be back to how things work in 4.9 (which you can get to work with > the pl2303 by removing

Re: ch341

2016-12-12 Thread Johan Hovold
patch in loopback seems to work with minicom > regardless of wordsize. More so even than I would guess at 5N1: a -> > a, A -> A. Trying to talk with a pl2303, 8N1 on both sides works. > 7E1 works sending from ch341 to pl2303, but not pl2303 to ch341 (text > is garbled on recept

Re: ch341

2016-12-12 Thread Johan Hovold
On Fri, Dec 09, 2016 at 07:14:02AM -0800, Russell Senior wrote: > >> Okay, I built your usb-linus > >> > >> 46490c347df406b3368680dd911620e52dc7bfa4 > >> > >> with the line: > >> > >>r = ch341_control_out(dev, 0x9a, 0x2518, 0x0050); > >> > >> commented out. More precisely: > > > >> Loopback wo

Re: ch341

2016-12-09 Thread Russell Senior
o do. The >> usb-linus + previous patch in loopback seems to work with >> minicom regardless of wordsize. More so even than I would guess >> at 5N1: a -> a, A -> A. Trying to talk with a pl2303, 8N1 on >> both sides works. 7E1 works sending from ch341 to pl2303, but >>

Re: ch341

2016-12-09 Thread Karl Palsson
g the word size is supposed to do. The > usb-linus + previous patch in loopback seems to work with > minicom regardless of wordsize. More so even than I would guess > at 5N1: a -> a, A -> A. Trying to talk with a pl2303, 8N1 on > both sides works. 7E1 works sending from ch341 to pl

Re: ch341

2016-12-09 Thread Russell Senior
han I would guess at 5N1: a -> a, A -> A. Trying to talk with a pl2303, 8N1 on both sides works. 7E1 works sending from ch341 to pl2303, but not pl2303 to ch341 (text is garbled on reception). 6N1 is garbled in both directions, but differently. Russell -- To unsubscribe from this list: send the

Re: ch341

2016-12-09 Thread Russell Senior
>> Okay, I built your usb-linus >> >> 46490c347df406b3368680dd911620e52dc7bfa4 >> >> with the line: >> >>r = ch341_control_out(dev, 0x9a, 0x2518, 0x0050); >> >> commented out. More precisely: > >> Loopback works, and also interoperates with pl2303 (through a null >> modem adapter). > > Interes

Re: ch341

2016-12-09 Thread Johan Hovold
On Fri, Dec 09, 2016 at 10:21:32AM +, Aidan Thornton wrote: > On Fri, Dec 9, 2016 at 3:26 AM, Russell Senior > wrote: > > On Thu, Dec 8, 2016 at 10:02 AM, Johan Hovold wrote: > >> On Thu, Dec 08, 2016 at 04:41:44AM -0800, Russell Senior wrote: > >>> > "Johan" == Johan Hovold writes: > >

Re: ch341

2016-12-09 Thread Johan Hovold
which previously did not work, but hopefully we can find a combination that works for all (unless we can reliably determine the device-type during probe). Can you try the below patch on top of my usb-next branch? I fear that your device does not support the new way of the setting the divisor, but

Re: ch341

2016-12-09 Thread Aidan Thornton
ttps://lkml.kernel.org/r/CAKdnbx7GTH3K7eGtQ==wh=kb74ea_egpii0h8hxxokljnhh...@mail.gmail.com >> >> The weird part is I appear to have the same device, and it works fine >> without that change. >> >> Could you try and just commenting out that register write in a mainline &g

Re: ch341

2016-12-08 Thread Russell Senior
ge. > > Could you try and just commenting out that register write in a mainline > kernel (or my usb-linus branch) to make sure the changes in -next did > not cause the issues you still see when connected to a pl2303. Okay, I built your usb-linus 46490c347df406b3368680dd911620e52dc7bfa4 w

Re: ch341

2016-12-08 Thread Johan Hovold
re you using minicom on both ends with 115200 8N1 which appears to work reliably, by the way? > Johan> What is the lsusb -v output for you device? And what chip version > Johan> is reported when connect the device if you enable dynamic > Johan> debugging on usb-next (e.g. u

Re: ch341

2016-12-08 Thread Russell Senior
but it didn't interoperate with my pl2303. Sending anything from the ch341 arrives at the pl2303 as 0x00, sending anything from the pl2303 arrives at the ch341 as 0xff. Again, this is with GNU screen, started as: "screen /dev/ttyUSB${n} 115200" where ${n} is 0 or 1, depending on

Re: ch341

2016-12-08 Thread Russell Senior
not) but could you try Johan> the below patch on top of usb-next as well? [...] Your patch seems to have fixed it! Yay! Johan> What is the lsusb -v output for you device? And what chip version Johan> is reported when connect the device if you enable dynamic Johan> debugging on usb-n

Re: ch341

2016-12-08 Thread Johan Hovold
On Thu, Dec 08, 2016 at 10:37:28AM +0100, Johan Hovold wrote: > [ +CC: Adain, Grigori, Karl ] > > On Wed, Dec 07, 2016 at 05:51:33PM -0800, Russell Senior wrote: > > I still suspect shoddy hardware. It would be nice to hear someone else > > with the ch341-based hardware to

Re: ch341

2016-12-08 Thread Johan Hovold
e results). This was my first experience > >> with or even awareness of ch341. I have much more experience with > >> pl2303 and somewhat less with ftdi. With these ch341, when I type in > >> an 'a' on one terminal, I get 0x01 out the other terminal. If I type

Re: ch341

2016-12-07 Thread Russell Senior
>>>>> "Johan" == Johan Hovold writes: >> I attach the tty's with GNU screen (but I have also tried microcom >> and minicom with the same results). This was my first experience >> with or even awareness of ch341. I have much more experience with &g

Re: ch341

2016-12-07 Thread Johan Hovold
rial: USB Serial support registered for generic > [822617.638736] usbcore: registered new interface driver ch341 > [822617.638755] usbserial: USB Serial support registered for ch341-uart > [822617.638770] ch341 2-2.3:1.0: ch341-uart converter detected > [822617.640272] usb 2-2.3: ch341-uar

Re: ch341

2016-12-07 Thread Russell Senior
0-Ser! [822617.633618] usbcore: registered new interface driver usbserial [822617.633638] usbcore: registered new interface driver usbserial_generic [822617.633653] usbserial: USB Serial support registered for generic [822617.638736] usbcore: registered new interface driver ch341 [822617.638755] usbs

Re: [PATCH 2/4] USB: ch341: reinitialize chip on reconfiguration

2016-10-26 Thread Aidan Thornton
are out of spec. This isn't a regression on the CH340G - they're exactly >> the same before and after, so far as I can tell - but it might be on the >> CH341 if baud rate setting worked better there before. Grigori might have >> to take a look at that. Sorry for the incon

  1   2   3   >