Patch to fix GetCommState "Invalid Argument" errors with Linux usbserial devices

Mike McCormack mike at
Fri Aug 5 00:28:31 CDT 2005

James Liggett wrote:

> This patch fixes an "Invalid Argument" error in GetCommState when a
> program tries to get information about a usbserial device. With this
> patch, Wine provides a "fake" serial device control block to a Windows
> program requesting it, such that the program believes that it's
> interfacing with an actual serial port, since usbserial devices don't
> currently acknowledge traditional DCBs via tcgetattr/tcsetattr. Using
> this patch I was able to synchronize a serial-based Palm PDA with Palm
> Desktop on Wine with a pl2303 USB-serial converter. I'm also told that
> this patch also works with FTDI devices.

Hi James,

I don't think this is quite right.  The pl2303 is a standard USB-serial 
converter, and it should have a selectable baud rate (according to the 
Linux kernel's driver for it).  It has a db-9 connector on one end, and 
a usb connector on the other, right?

I'm also pretty sure that all serial ports are ttys in Linux, so your 
if(isatty()) check will always succeed.

Have you tried writing a small test program that does GetCommState and 
SetCommState on that serial device in Windows?  If it fails to set the 
baud rate perhaps there's an error code returned?


More information about the wine-devel mailing list