Converting the /dev/ttyUSB to com port to use it with Wine in Linux

4

2

I have some software which runs on Windows. I installed Wine and ran it in Linux. It works fine but the issue is it communicates with a serial port. Therefore the only option I can choose are com1, com2, …

But my device on the Linux machine is actually located at the /dev/ttyUSBn location. How do I use the above software in Linux Ubuntu?

I have tried ln -s /dev/ttyUSBn COM1 in the ~/.wine/dosdevices/. It does not appear to work.

Sab

Posted 2013-07-14T02:38:08.193

Reputation: 367

Answers

3

Symlinks should work; however, they must be located in ~/.wine/dosdevices/, not in any random directory. The WineHQ article also shows the names in lower-case.

4.3.1. Serial and Parallel Ports

Serial and parallel port configuration is very similar to drive configuration - simply create a symbolic link in ~/.wine/dosdevices with the name of the device. Windows serial ports follow a naming convention of the word "com" followed by a number, such as com1, com2, etc. Similarly, parallel ports use "lpt" followed by a number, such as lpt1. You should link these directly to the corresponding Unix devices, such as /dev/ttyS0 and /dev/lp0. For example, to configure one serial port and one parallel port, run the following commands:

ln -s /dev/ttyS0 com1
ln -s /dev/lp0 lpt1

user1686

Posted 2013-07-14T02:38:08.193

Reputation: 283 655

1Yes. Thats definitely where I put it. I also tried changing the permissions of the com files and also added the registry edits according to the wiki. I still have no luck – Sab – 2013-07-14T03:47:04.623

1

Starting from Wine 2.8, the simple symlink-editing method of configuration doesn't work. One has to configure COM ports by editing Wine registry. From Wine User's Guide/Other Things to Configure/Serial and Parallel Ports:

To override Wine's default device mapping, run wine regedit and create string entries in HKEY_LOCAL_MACHINE\Software\Wine\Ports where the entry name is the Windows device name and the entry value is the path to the Unix device. Continuing with the above example, to make COM1 the first USB-attached serial port, create an entry with the name COM1 and the value /dev/ttyUSB0. You might also want to create an entry named COM5 with no value to remove the COM5 device which is now a duplicate of COM1. After editing the registry, shut down Wine with wineserver -k and the next time Wine runs a program, your changes will take effect.

Ruslan

Posted 2013-07-14T02:38:08.193

Reputation: 1 168

-1

In some cases, MS software using GetCommConfig() under Wine needs a registry key explictly set if the automatic detection feature described in https://wiki.winehq.org/Wine_User%27s_Guide#Serial_and_Parallel_Ports doesn't automatically detect your port.

Try setting a registry key in ~/.wine/system.reg like this:

...
[Hardware\\Devicemap\\Serialcomm] 1231984861
"Serial0"="COM1"
...

It worked for me with my ln -s /dev/tty.usbmodemFD121 ~/.wine/dosdevices/COM1 device.

Grafblade

Posted 2013-07-14T02:38:08.193

Reputation: 11

(1) Answers should not ask questions.  (2) Where are you getting this?  I can’t find Devicemap or Serialcomm at the Useful Registry Keys page that you linked to.

– Scott – 2017-02-12T23:26:23.133

I needed a ~/.wine/system.reg hardware key like this per https://github.com/tomojitakasu/RTKLIB/issues/359#issuecomment-350054880

– Dave X – 2017-12-07T18:37:14.237