Hello, I know that there has been a patch for the Winchiphead CH340/41 USB to serial converter chips on the net, but they have been implemented with only a basic feature and limited baudrates due to the lack of any datasheets. I picked these patches up and added all common baudrates as well as the complete modem control and status handling to be able of using this adapter in nearly all applications. Features still missing: - character length other than 8 bits - parity settings - break control I don't have an USB sniffer, if someone may send me sniffer logs for various settings these features may be added to the driver of course. I am not listening on this mailing list, so please address me directly if there are any questions or comments. The patch is against the 2.6.22.5 kernel, but should work for newer kernels, too. Werner --- linux-2.6.22.5/Documentation/usb/usb-serial.txt 2007-08-23 01:23:54.000000000 +0200 +++ linux-2.6.22.5-cc/Documentation/usb/usb-serial.txt 2007-09-14 14:13:28.000000000 +0200 @@ -428,6 +428,19 @@ See http://www.uuhaus.de/linux/palmconnect.html for up-to-date information on this driver. +Winchiphead CH341 Driver + + This driver is for the Winchiphead CH341 USB-RS232 Converter. This chip + also implements an IEEE 1284 parallel port, I2C and SPI, but that is not + supported by the driver. The protocol was analyzed from the behaviour + of the Windows driver, no datasheet is available at present. + The manufacturer's website: http://www.winchiphead.com/. + For any questions or problems with this driver, please contact + frank <at> kingswood-consulting.co.uk. + Extensions for universal baudrate settings and modem status/control has + been added by werner <at> cornelius-consult.de. + + Generic Serial driver If your device is not one of the above listed devices, compatible with --- linux-2.6.22.5/drivers/usb/serial/Kconfig 2007-08-23 01:23:54.000000000 +0200 +++ ...
Care to just send me a patch against the -mm tree, for these new features? The driver, with the proper attribution from the original author, is already in that tree and will be going into the 2.6.24 release. thanks, greg k-h -
Hello, attached you will find the patch against the 2.6.23-rc6-mm1 Changed fetaures: 1. All baudrates possible (dynamic baudfactor calculation) 2. Added support of modem control and status lines. Still missing (due to lack of an usb sniffer): 1. Break control 2. Parity Werner --- linux-2.6.23-rc6-mm1/drivers/usb/serial/ch341.c 2007-09-21 09:56:56.000000000 +0200 +++ develop/drivers/usb/serial/ch341.c 2007-09-21 10:00:26.000000000 +0200 @@ -1,5 +1,9 @@ /* - * Copyright 2007, Frank A Kingswood <frank@kingswood-consulting.co.uk> + * Copyright 2007, Frank A Kingswood <frank <at> kingswood-consulting.co.uk> + * + * Copyright 2007, Werner Cornelius <werner <at> cornelius-consult.de> + * for changes/extenions regarding universal baud rate capability and modem + * line control/status routines. * * ch341.c implements a serial port driver for the Winchiphead CH341. * @@ -21,327 +25,548 @@ #include <linux/usb/serial.h> #include <linux/serial.h> -#define DEFAULT_BAUD_RATE 2400 +#define DEFAULT_BAUD_RATE 9600 #define DEFAULT_TIMEOUT 1000 +/* flags for IO-Bits */ +#define CH341_BIT_RTS (1 << 6) +#define CH341_BIT_DTR (1 << 5) + +/******************************/ +/* interrupt pipe definitions */ +/******************************/ +/* always 4 interrupt bytes */ +/* first irq byte normally 0x08 */ +/* second irq byte base 0x7d + below */ +/* third irq byte base 0x94 + below */ +/* fourth irq byte normally 0xee */ + +/* second interrupt byte */ +#define CH341_MULT_STAT 0x04 /* multiple status since last interrupt event */ + +/* status returned in third interrupt answer byte, inverted in data from irq */ +#define CH341_BIT_CTS 0x01 +#define CH341_BIT_DSR 0x02 +#define CH341_BIT_RI 0x04 +#define CH341_BIT_DCD 0x08 +#define CH341_BITS_MODEM_STAT 0x0f /* all bits */ + +/*******************************/ +/* baudrate calculation factor */ +/*******************************/ +#define CH341_BAUDBASE_FACTOR 1532620800 +#define ...
Cool. Could you resend with a Signed-off-by: line? Regards Oliver -
You forgot: Please redo the patch such that the formating of the file is not changed Don't put changelog information in a copyright notice, that's not needed. Just put your name there please, with a "real" email address. And we need a "Signed-off-by:" line. thanks, greg k-h -
Am Freitag, 21. September 2007 18:18 schrieb Greg KH: sorry about, but that wasn't an intend. This action has been done by one or more of the apps I am using (editor, mailer...). I assume it is a feature of Kmail, inserting plane text seems to This address was in the original file I got from the net. Perhaps this file I did add one on last request. Was this wrong ? Perhaps I need an Howto about mailing to kernel list. I read the main documentation, but didn't found this amount of request rules in a way that would be sufficient to publish a patch which I just wanted to make useable by the whole community. I will try to verify how I could generate the patch in a way that it might be Werner -
No, I was referring to the fact that you change the email address to Take a look at the files, Documentation/HOWTO and Documentation/SubmittingPatches for how to do this correctly. Those files should help you out. thanks, greg k-h -
Hello, attached you will find the patch against the 2.6.23-rc6-mm1 Changed fetaures: 1. All baudrates possible (dynamic baudfactor calculation) 2. Added support of modem control and status lines. Still missing (due to lack of an usb sniffer): 1. Break control 2. Parity Werner --- linux-2.6.23-rc6-mm1/drivers/usb/serial/ch341.c 2007-09-21 09:56:56.000000000 +0200 +++ develop/drivers/usb/serial/ch341.c 2007-09-21 10:00:26.000000000 +0200 @@ -1,5 +1,9 @@ /* - * Copyright 2007, Frank A Kingswood <frank@kingswood-consulting.co.uk> + * Copyright 2007, Frank A Kingswood <frank <at> kingswood-consulting.co.uk> + * + * Copyright 2007, Werner Cornelius <werner <at> cornelius-consult.de> + * for changes/extenions regarding universal baud rate capability and modem + * line control/status routines. * * ch341.c implements a serial port driver for the Winchiphead CH341. * @@ -21,327 +25,548 @@ #include <linux/usb/serial.h> #include <linux/serial.h> -#define DEFAULT_BAUD_RATE 2400 +#define DEFAULT_BAUD_RATE 9600 #define DEFAULT_TIMEOUT 1000 +/* flags for IO-Bits */ +#define CH341_BIT_RTS (1 << 6) +#define CH341_BIT_DTR (1 << 5) + +/******************************/ +/* interrupt pipe definitions */ +/******************************/ +/* always 4 interrupt bytes */ +/* first irq byte normally 0x08 */ +/* second irq byte base 0x7d + below */ +/* third irq byte base 0x94 + below */ +/* fourth irq byte normally 0xee */ + +/* second interrupt byte */ +#define CH341_MULT_STAT 0x04 /* multiple status since last interrupt event */ + +/* status returned in third interrupt answer byte, inverted in data from irq */ +#define CH341_BIT_CTS 0x01 +#define CH341_BIT_DSR 0x02 +#define CH341_BIT_RI 0x04 +#define CH341_BIT_DCD 0x08 +#define CH341_BITS_MODEM_STAT 0x0f /* all bits */ + +/*******************************/ +/* baudrate calculation factor */ +/*******************************/ +#define CH341_BAUDBASE_FACTOR 1532620800 +#define ...
