dot Net Application use serial Port over socat (TCP/IP)

Questions about Wine on Linux
Locked
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

Hello,

i use an dotNet App, with socat (ttyUSB0 oder TCP/IP). The App cannot open the Com Connection. I mapped it to a File called /home/username/.com3 in "wine regedit Ports".
But it doesen't work.

Have anyone a Solution for me?
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

The dotnet App use System.IO.Ports, how can i import these?
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by jkfloris »

Make sure the user has the necessary permissions to use ttyUSB0. Often, the user must be a member of the dialout group.
I mapped it to a File called /home/username/.com3 in "wine regedit Ports".
As a check, what is the output of:

Code: Select all

wine reg query 'HKEY_LOCAL_MACHINE\Software\Wine\Ports' /s
# and
ls -asl ~/.wine/dosdevices
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

Morning,

1. wine reg query 'HKEY_LOCAL_MACHINE\Software\Wine\Ports' /s
HKEY_LOCAL_MACHINE\Software\Wine\Ports
COM3 REG_SZ /home/vdi1/.com3

2. ls -asl ~/.wine/dosdevices
lrwxrwxrwx 1 vdi1 vdi1 10 13. Sep 11:53 c: -> ../drive_c
0 lrwxrwxrwx 1 vdi1 vdi1 10 28. Sep 07:52 com1 -> /dev/ttyS0
0 lrwxrwxrwx 1 vdi1 vdi1 10 28. Sep 07:52 com2 -> /dev/ttyS1
0 lrwxrwxrwx 1 vdi1 vdi1 17 28. Sep 07:52 com3 -> /home/vdi1/.com3
0 lrwxrwxrwx 1 vdi1 vdi1 10 26. Sep 12:48 com4 -> /dev/ttyS1
0 lrwxrwxrwx 1 vdi1 vdi1 10 21. Sep 15:00 com5 -> /dev/ttyS3
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

This is the error Message from the dotnet App.
serpa-wine-com-error.png
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by jkfloris »

hulk0815 wrote: Wed Sep 27, 2023 7:16 am The dotnet App use System.IO.Ports, how can i import these?
Have you tried installing the Windows .Net Framework with winetricks?

Code: Select all

winetricks -q dotnet48
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

Hello,

sure, the Application runs, but when he contact the Com port comes the error message.

When i use putty.exe (for Windows) under wine, and connect to the Comport runs normaly.

I think the com port mapping over socat was ok.

The dotnet app found the COM port, but when it try to .open then comes the error.
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

Anyone an Tip or Solution for me?
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by jkfloris »

Do you have a (legal) link to the program?
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

Hi,

yes i have an test for you, i upload these in a few Days.

Thanks.
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

HI,

here is the Link to download the dotNet TestApp.
https://secure.docraid.com/shareid=938B ... DKVZAEE3E0

The Link is activated to Sunday.

Regards
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by jkfloris »

Thank you for the test application.
I think the problem is in "socat". Could you check this with setserial?
Does this return a valid value:

Code: Select all

setserial -g /home/vdi1/.com3
Additionally, you can enable the "comm" debug channel in wine to see what is going wrong.

Code: Select all

WINEDEBUG="+comm" wine SpikeComport.exe
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

Good Morning,

the result from setserial is: Cannot get serial info: Inappropriate ioctl for device

Have you an idea for socat or anything else?
jkfloris
Level 12
Level 12
Posts: 3141
Joined: Thu Aug 14, 2014 10:10 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by jkfloris »

I was afraid this would happen. "System.IO.Ports" uses the same way as "setserial" to use the COM port, which unfortunately does not work via socat.
If the device is connected via USB, you can try to remove socat and make /dev/ttyUSB0 point directly to a COM port in Wine. (In the test application, this had to be COM8).

Unfortunately, I don't know any other solution than socat for the TCP/IP to serial connection.
hulk0815
Level 2
Level 2
Posts: 10
Joined: Wed Sep 27, 2023 3:47 am

Re: dot Net Application use serial Port over socat (TCP/IP)

Post by hulk0815 »

Ok, i woud like to use Linux TS (xrdp), and there is no com port mapping included.
Locked