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?
Mike
On Fri, 2005-08-05 at 14:28 +0900, Mike McCormack wrote:
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?
Yes, that's right. And yes, pl2303 does have mechanisms to set DCB info. However, AFAIK there's no way to set this information from userspace. Greg Kroah-Hartman told me that the usbserial drivers must be modified to work with tcgetattr/tcsetattr. pl2303 doesn't acknowledge any ioctl that would allow this to be set either. Honestly, I wasn't sure this was 100% correct either, but it does work. If you have a better way of doing this, please let me know. ;-)
I'm also pretty sure that all serial ports are ttys in Linux, so your if(isatty()) check will always succeed.
Sure, it probably would. I did this only to be safe. pilot-link and many others do it, so I thought I would do it too to be thorough. And besides, what if the comm symlink we were looking at wasn't a tty, but some other kind of device? (user setup error) In that case the comm functions would go crazy without any kind of sanity checking on the given port node.
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?
I didn't write my own program, but I know that Windows programs don't have a problem with this device. I did quite a bit of testing of Palm Desktop on both Windows and WINE, and Hotsync worked well with this device on windows, so I know we're not getting an error here. I think the problem I'm trying to solve here is related to usbserial drivers specifically. Why exactly this is I really can't say. Thanks for the feedback. :)
Mike
James