linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: CH340/341: cannot open twice
       [not found] <trinity-deaddc67-9f42-4260-9032-d3eb30b7e8f1-1442696993994@3capp-mailcom-lxa06>
@ 2015-09-19 22:10 ` Johan Hovold
       [not found]   ` <trinity-efc5f19e-b3a1-4cc7-b944-04deb6368aca-1442710334176@3capp-mailcom-lxa02>
  0 siblings, 1 reply; 2+ messages in thread
From: Johan Hovold @ 2015-09-19 22:10 UTC (permalink / raw)
  To: C. SB; +Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA

On Sat, Sep 19, 2015 at 11:09:54PM +0200, C. SB wrote:
> Hi,
> I'm having a strange issue with a CH340 usb-serial IC : I can only
> use/open it once. Here's what I try:

> The only solution is to unplug+replug the IC; any code using open()
> will fail with the same error.
> 
> lsusb output:
> Bus 002 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
> 
> I tried only on kernels 4.0.6 and 4.1.6, system is archlinux x86-64.
> 
> Am I alone having this problem ?

I'm afraid not. There has been a couple of reports of problem with this
device. The reported problems have looked like hardware issues, but it
now seems like support for these devices is simply lacking in the
driver.

Could you try the vendor driver and see if that makes the device work so
that we'd know for sure?

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: CH340/341: cannot open twice
       [not found]   ` <trinity-efc5f19e-b3a1-4cc7-b944-04deb6368aca-1442710334176@3capp-mailcom-lxa02>
@ 2015-09-20 20:56     ` Johan Hovold
  0 siblings, 0 replies; 2+ messages in thread
From: Johan Hovold @ 2015-09-20 20:56 UTC (permalink / raw)
  To: C. SB
  Cc: linux-serial-u79uwXL29TY76Z2rM5mHXA,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Karl Palsson, Peter Stuge

[ Please keep everyone on CC including the usb list when responding. ]

On Sun, Sep 20, 2015 at 02:52:14AM +0200, C. SB wrote:

> > device. The reported problems have looked like hardware issues,
> Probably not my case - the device works OK on a winXP box

That's good to know.

> > Could you try the vendor driver and see if that makes the device work so
> > that we'd know for sure?
> Well, it was quite a job to get the driver to compile on linux 4.1.6, and
> I had to kludge a replacement for the deprecated interruptible_sleep_on()
> mechanism. I still can't believe it works (I have no kernel/module experience)
> but apart from an inexplicable 1-2 second delay when close()-ing
> the port, it works in my application (write+read with timeout; TXD-RXD
> connected together in a loopback)
> 
> The mfg driver I used was downloaded from WCH at some point. A copy is visible
> on https://github.com/karlp/ch341-linux/blob/master/drivers/CH341SER_LINUX/ch34x.c
> And my patch to get it to compile is quite simple:
> http://pastebin.ca/3167353
> (not sure what the diff/patch guidelines are on this list, I preferred to link)
> 
> Note : I probably violate many rules of kernel coding with my use of
> wait_event_interruptible(). Consider this a highly unstable, incompetent patch.

Thanks for verifying that. I've added Karl on CC that I think has some
preliminary code for adding support for newer ch341 devices, and Peter
who has also run into some similar issues.

Hopefully someone with access to these devices can figure out what is
missing in the mainline driver so that they get proper support.

Thanks,
Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-20 20:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <trinity-deaddc67-9f42-4260-9032-d3eb30b7e8f1-1442696993994@3capp-mailcom-lxa06>
2015-09-19 22:10 ` CH340/341: cannot open twice Johan Hovold
     [not found]   ` <trinity-efc5f19e-b3a1-4cc7-b944-04deb6368aca-1442710334176@3capp-mailcom-lxa02>
2015-09-20 20:56     ` Johan Hovold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).