[Wine] Help with USB-to-serial cable

Martin Gregorie martin at gregorie.org
Sat Jan 22 18:10:18 CST 2011


On Sat, 2011-01-22 at 15:53 -0600, islandBilly wrote:

> This computer has only USB ports, no serial. I actually have several
> other devices with the same problem -- need to program with USB-serisl
> cables.
>
> I created a sym link to the WINE zone, not the home folder, ie: 
> 
> ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1 
> 
>  Result: my charting software (also running under wine) works fine.
> Now, I must admit that a "gpsInformation" utility program that came
> with it did not work at all, so there must be differences somewhere in
> how these two Windoze programs are set up to look at com ports.
> 
There seems to be no standard Windows API for serial ports with the
result that every program accesses then differently, even two programs
from the same source. Some will work under Wine: some won't.

I've never been able to see my USB <-> serial adapter from Wine And
there's another problem too: the special files /dev/ttyUSB[0-9] are only
created when the USB adapter is plugged in and are destroyed when it is
removed, so the symlink and any changes needed to the default access
permissions will need to be put in place after the device has been
plugged in and recognised and the symlink should be removed before
unplugging it. 

I solved both problems by adding a 6 serial port PCI adapter card to my
system. They are cheap and seem to 'just work', but if you can't do that
here are some things to try:

- I believe that some USB adapters will work but don't know which. 
  Maybe somebody knows a brand and model that does work and will post
  a reply.

- You can sort out the access permissions problem by adding UDEV rules
  to your system. This page may help you do that:
  http://www.libelle-systems.com/free/wine/serial_port_access.html


- If you need the symlink you can run the wine app from a wrapper script
  that looks something like this:

  =========== script starts on the next line ===========
  #!/bin/bash
  export WINEPREFIX=/home/yourlogindir/.wine
  cd ~/$WINEPREFIX/dosdevices
  #
  # For this to work there must be only the one serial adapter
  # plugged into your machine. Otherwise you can't guarantee
  # that the adapter will be called /dev/ttyUSB0
  #
  ln -s /dev/ttyUSB0 COM1:  
  cd /directory containing/your/app
  wine yourapp
  cd ~/$WINEPREFIX/dosdevices
  rm COM1:  
  ========== script ends on the previous line ==========

  you can run the script from the console to test it and then, if you
  want, you can create a launcher which to run it when its icon is
  clicked.  


Martin





More information about the wine-users mailing list