15

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.

5 Answers 5

15

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.

1
  • 1
    On macOS to get serial port work under Wine 4.x, we need to use both methods explained here, create symbolic link + insert new string value in the Windows registry. Using only one of that will not work.
    – mikikg
    Mar 23, 2020 at 20:04
5

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
2
  • 1
    Yes. 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
    Jul 14, 2013 at 3:47
  • Perhaps update the answer, given Ruslan's answer? Dec 29, 2021 at 4:06
2

it might be caused by a permission issue.

The tty devices are usually readable/writable by a specific group like dialout. Add yourself to that group using the following command finally logout and log back in

gpasswd -a $USER dialout

Honestly, it would probably be better to first check if your user belongs to the dialout group. Use this command to show the groups in which your user is present

groups $USER

If dialout is not there, then test the approach by temporarily changing the permissions of the ttyACMX/ttyUSBX file in /dev folder

sudo chmod 666 /dev/ttyACMX_OR_ttyUSBX

Re run your program using wine and let me know.

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.

2
0

In addition to the links you have created, make sure the user is in the correct user groups. From Wine User's Guide/Other Things to Configure/Serial and Parallel Ports:

Make sure you have the needed rights to access your computer's serial and parallel ports. On Linux, a user must typically be a member of the sys or dialout group to access serial ports

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .