DirectSoft 5 Serial communications Issue's

Questions about Wine on Linux
Locked
samuraimarc
Level 1
Level 1
Posts: 7
Joined: Mon May 21, 2012 3:10 pm

DirectSoft 5 Serial communications Issue's

Post by samuraimarc »

Hello all,
I'm trying to run Automation Direct's DirectSoft 5 PLC software under WINE.
Here's what I'm running:

Lenovo ThinkPad T61 Laptop
Linux Distro: Debian Squeeze 6.05
Wine v1.01
Direct Logic 05 #D0-05DR
Serial Communication

I am aware of the compatibility list for DirectSoft 5 and Automation Direct software. I am capable of running the software in virtual box but that just brings me back to the frustration of window’s.

I can successfully run the software in wine if I adjust the DS500.ini COM*ENABLE= to 0’s. I have tried linking the ttyS0 to com2 (symbolically) with the COM2ENABLE=1 in the .ini and the program hangs. I've also tried Wine v1.4 and have the same issues.
Link code:

Code: Select all

ln -s /dev/ttyS0 /~/.wine/dosdevices/com2
I have also changed the permissions of ttyS0 to 0644 with:

Code: Select all

chmod 0644 /dev/ttyS0
And the program starts, and runs but will not communicate with the PLC. I am running OP-WINEDIT Optimate configuration software just fine in wine with com2 linked to ttyS0.

Can anybody throw me a bone on what else I could try?
Thanks in Advance.
Martin Gregorie

DirectSoft 5 Serial communications Issue's

Post by Martin Gregorie »

On Mon, 2012-05-21 at 15:19 -0500, samuraimarc wrote:
Hello all,
I'm trying to run Automation Direct's DirectSoft 5 PLC software under WINE.
Here's what I'm running:

Lenovo ThinkPad T61 Laptop
Linux Distro: Debian Squeeze 6.05
Wine v1.01
Direct Logic 05 #D0-05DR
Serial Communication
That's very old version of Wine. Have you tried using a more recent
version?
I am aware of the compatibility list for DirectSoft 5 and Automation Direct software. I am capable of running the software in virtual box but that just brings me back to the frustration of windows.

I can successfully run the software in wine if I adjust the DS500.ini COM*ENABLE= to 0s. I have tried linking the ttyS0 to com2 (symbolically) with the COM2ENABLE=1 in the .ini and the program hangs. I've also tried Wine v1.4 and have the same issues.
Link code:


Code:
ln -s /dev/ttyS0 /~/.wine/dosdevices/com2
Questions:
1) what happens if you change the access permissions but don't create
the symlink?

2) what does the command "setserial /dev/ttyS0" show you?
On my system it shows:
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
so you should see something similar.

I'm able to access all 5 serial ports on my system (Fedora 16, Wine
1.5.2) with the aid of UDEV local rule that sets /dev/tty[A-Z]*
permissions to 0666 without using any symlinks. In any case this may
work better:

ln -s /dev/ttyS0 ~/.wine/dosdevices/COM1:


Martin
samuraimarc
Level 1
Level 1
Posts: 7
Joined: Mon May 21, 2012 3:10 pm

Re: DirectSoft 5 Serial communications Issue's

Post by samuraimarc »

That's very old version of Wine. Have you tried using a more recent
version?
I tried v1.4 with the same results
1) what happens if you change the access permissions but don't create
the symlink?
I have not tried this, with out the symlink what do I tell it to connect to with no com*
2) what does the command "setserial /dev/ttyS0" show you?
On my system it shows:
/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
so you should see something similar.
I get: /dev/ttyS0. UART: 16550A. Port: 0x8010, IRQ: 16

I failed to mention that I'm using a pcmcia card with 2 serial ports on it.

Code: Select all

dmesg | grep tty
Gives me:
[ 7.663918] 0000:16:00.0: ttyS0 at I/O 0x8010 (irq = 16) is a 16550A
[ 7.664392] 0000:16:00.0: ttyS1 at I/O 0x8018 (irq = 16) is a 16550A
ln -s /dev/ttyS0 ~/.wine/dosdevices/COM1:
I've tried all sorts of COM* com* with no effect, or are you talking about the colon on the end?

Thanks,
Marc
samuraimarc
Level 1
Level 1
Posts: 7
Joined: Mon May 21, 2012 3:10 pm

Re: DirectSoft 5 Serial communications Issue's

Post by samuraimarc »

I'm able to access all 5 serial ports on my system (Fedora 16, Wine
1.5.2) with the aid of UDEV local rule that sets /dev/tty[A-Z]*
permissions to 0666 without using any symlinks.
I am unfamiliar with UDEV. How did you use it? I went over the man page but not sure where to start.
I changed the permissions to 0666 and ran Csmain. It didn’t like that, I got a failure message.
ln -s /dev/ttyS0 ~/.wine/dosdevices/COM1:
I switched back to 0644 and used the above code. It doesn’t matter what COM* I use I can get Csmain up and running and go to add a link and it can’t open the port like it’s busy. I get the same message in VirtualBox when I forget to shutdown Rslinx for AB PLC’s.
Hope this is useful.
Martin Gregorie

DirectSoft 5 Serial communications Issue's

Post by Martin Gregorie »

On Mon, 2012-05-21 at 16:33 -0500, samuraimarc wrote:
I have not tried this, with out the symlink what do I tell it to
connect to with no com*
My system finds all my serial ports without using symlinks. My one
serial port Windows app, which downloads logs from a flight recorder,
shows a menu of all the ports it finds and allows me to select the one I
have the flight recorder connected to.

I should add that /dev/ttyS0 (which appears as COM1) is on the mother
boarfd and the other four, /dev/ttyS[1234] (which appear as COM2 to
COM5) are on a multi-port adapter card and all five of them are reported
by setserial as 16550A UARTS. I also have a pFranc USB serial adapter
which has never worked with Wine, regardless of permissions or use of
the symlink. I have never owned or tried a PCMCIA serial card.

BTW, don't forget that the device files (/dev/ttyS[01]) will be
destroyed when the PCMCIA card is removed and recreated when its plugged
in, so you probably need to use UDEV local rules to give it the
appropriate access permissions. That's likely to be much easier to
manage than scripting it, which will require you to use sudo and to
supply your password. See here for details:
http://www.libelle-systems.com/free/win ... ccess.html
ln -s /dev/ttyS0 ~/.wine/dosdevices/COM1:
I've tried all sorts of COM* com* with no effect, or are you talking
about the colon on the end?
Yes.


Martin
Martin Gregorie

DirectSoft 5 Serial communications Issue's

Post by Martin Gregorie »

On Mon, 2012-05-21 at 17:24 -0500, samuraimarc wrote:
I'm able to access all 5 serial ports on my system (Fedora 16, Wine
1.5.2) with the aid of UDEV local rule that sets /dev/tty[A-Z]*
permissions to 0666 without using any symlinks.
Details are here:
http://www.libelle-systems.com/free/win ... ccess.html
I switched back to 0644 and used the above code. It doesnt matter what
COM* I use I can get Csmain up and running and go to add a link and it
cant open the port like its busy. I get the same message in
VirtualBox when I forget to shutdown Rslinx for AB PLCs.
Hope this is useful.
What, exactly, is the error message?

If your app claims the port is busy it could be either an access
permission problem or that some other program is using it. setserial
reports "Device or resource busy" if the device is in use and "No such
file or directory" if the device file doesn't exist. It may be worth
running this dual command:

ls -l /dev/ttyS*; sudo lsof | grep 'ttyS.'

immediately before and after trying your Wine app.


Martin
samuraimarc
Level 1
Level 1
Posts: 7
Joined: Mon May 21, 2012 3:10 pm

Re: DirectSoft 5 Serial communications Issue's

Post by samuraimarc »

What, exactly, is the error message?
COMM ERROR!
"Error connecting to PLC!

Error: Cannot access the comm port. The port may not be present or another app my be using it. Ext Error. "
If your app claims the port is busy it could be either an access
permission problem or that some other program is using it. setserial
reports "Device or resource busy" if the device is in use and "No such
file or directory" if the device file doesn't exist. It may be worth
running this dual command:

ls -l /dev/ttyS*; sudo lsof | grep 'ttyS.'

immediately before and after trying your Wine app.
I tried this and get the same results before and after

Code: Select all

root@interfor-debain:/home/electrician# ls -l /dev/ttyS*; lsof | grep 'ttyS.'
crw-r--r-- 1 root dialout 4, 64 May 22 12:59 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 May 22 12:59 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 May 21 13:41 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 May 21 13:41 /dev/ttyS3
samuraimarc
Level 1
Level 1
Posts: 7
Joined: Mon May 21, 2012 3:10 pm

Post by samuraimarc »

I also ran the setserial command:

Code: Select all

root@interfor-debain:/home/electrician# setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x8010, IRQ: 16
	Baud_base: 115200, close_delay: 50, divisor: 0
	closing_wait: 3000
	Flags: spd_normal skip_test
According to the link you posted this is what it should look like.
I do recall I had to write a rule to run the android sdk, rule 51 in udev. Although it was a cut and paste I kind of got the idea. I might need to do something similar for each PLC which could prove to not be worth the effort. But until that’s the case I'll keep trying this.
I'm back to wine v1.4 and trying to put together v1.5.4 (unstable) to try. I'm only 3 months into linux so still a bit of a learning curve here. :?
Thanks,
Marc.
Martin Gregorie

DirectSoft 5 Serial communications Issue's

Post by Martin Gregorie »

On Tue, 2012-05-22 at 15:48 -0500, samuraimarc wrote:
I also ran the setserial command:

Code:
root@interfor-debain:/home/electrician# setserial -a /dev/ttyS0
/dev/ttyS0, Line 0, UART: 16550A, Port: 0x8010, IRQ: 16
Baud_base: 115200, close_delay: 50, divisor: 0
closing_wait: 3000
Flags: spd_normal skip_test
That all looks fair enough.
I do recall I had to write a rule to run the android sdk, rule 51 in
udev. Although it was a cut and paste I kind of got the idea. I might
need to do something similar for each PLC which could prove to not be
worth the effort.
If all PLCs connect via serial ports whose names match /dev/ttyS*, the
rule I sent you the link for should work for all of them. Hint: If you
want to see what is happening in real-time, open a terminal window and
run the command "sudo tail -f /var/log/messages" and then plug the
PVMCIA card into the computer. You'll see a number of messages appear as
the card is recognised and uDEV configures drivers, etc., and reports
the device name(s) that are assigned. Ctrl-C exits from 'tail' when
you're done.
I'm only 3 months into linux so still a bit of a learning curve here.
If you've used other OSen at the command line level, you may find "Linux
in a Nutshell" helpful because the text in the online manpages is very
(too?) concise. Otherwise you may prefer a rather thicker book on Linux
system administration. This is IMO an over fancy term: many
knowledgeable Linux users and all fully competent Linux programmers have
skills that are reserved for sysadmins on other non-UNIX type systems.
Its not that this is esoteric knowledge, rather that its all stuff
that's very useful to know and all applicable with simple tools like the
command line and a text editor. Did you know that almost all Linux
configuration data lives in simple text files and can be changed with a
standard text editor such as vi, vim, nano or gedit?


Martin
samuraimarc
Level 1
Level 1
Posts: 7
Joined: Mon May 21, 2012 3:10 pm

Re: DirectSoft 5 Serial communications Issue's

Post by samuraimarc »

If all PLCs connect via serial ports whose names match /dev/ttyS*, the
rule I sent you the link for should work for all of them. Hint: If you
want to see what is happening in real-time, open a terminal window and
run the command "sudo tail -f /var/log/messages" and then plug the
PVMCIA card into the computer. You'll see a number of messages appear as
the card is recognised and uDEV configures drivers, etc., and reports
the device name(s) that are assigned. Ctrl-C exits from 'tail' when
you're done.
The rule didn't make a differance. I get the usual system error message from wine which is:

Code: Select all

Unhandled exception: page fault on write access to 0x00000005 in 32-bit code (0x7bc498e7).
Register dump:
 CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
 EIP:7bc498e7 ESP:0033f448 EBP:0033f4a0 EFLAGS:00010202(  R- --  I   - - - )
 EAX:0000004b EBX:7bca5acc ECX:00409000 EDX:00000001
 ESI:00409ae0 EDI:00000028
Stack dump:
0x0033f448:  0033f490 00000064 0033f4c0 7b82a70a
0x0033f458:  00000064 001b0058 00000000 00000000
0x0033f468:  0033f4a2 00000006 00000000 00409000
0x0033f478:  004120a0 00000000 00000002 ff002198
0x0033f488:  00000000 00000006 00409014 ffffffff
0x0033f498:  00000028 7c36281a 0033f4e0 7c3627e4
Backtrace:
=>0 0x7bc498e7 RtlAllocateHeap+0xa7() in ntdll (0x0033f4a0)
  1 0x7c3627e4 in msvcr71 (+0x27e3) (0x0033f4e0)
0x7bc498e7 RtlAllocateHeap+0xa7 in ntdll: movl	%eax,0x4(%edx)
Modules:
Module	Address			Debug info	Name (93 modules)
PE	  340000-  34e000	Deferred        utils50
PE	  3e0000-  3f3000	Deferred        protoccm
PE	  400000-  409000	Deferred        csmain
PE	  630000-  70d000	Deferred        comrc50
PE	  710000-  768000	Deferred        csrsc
PE	  880000-  8ae000	Deferred        commserv
PE	  ab0000-  acc000	Deferred        devasync
PE	  ad0000-  ae4000	Deferred        devether
PE	  af0000-  b04000	Deferred        hei32_3
PE	10000000-10067000	Deferred        host71a
PE	67800000-6796a000	Deferred        heixtp86
ELF	7b800000-7b8f6000	Deferred        kernel32<elf>
  \-PE	7b810000-7b8f6000	\               kernel32
ELF	7bc00000-7bcc2000	Dwarf           ntdll<elf>
  \-PE	7bc10000-7bcc2000	\               ntdll
ELF	7bf00000-7bf03000	Deferred        <wine-loader>
PE	7c140000-7c246000	Deferred        mfc71
PE	7c360000-7c3b6000	Export          msvcr71
ELF	7df4c000-7df60000	Deferred        libresolv.so.2
ELF	7df60000-7df91000	Deferred        ws2_32<elf>
  \-PE	7df70000-7df91000	\               ws2_32
ELF	7df91000-7dfe9000	Deferred        riched20<elf>
  \-PE	7dfa0000-7dfe9000	\               riched20
ELF	7dfe9000-7e00f000	Deferred        libm.so.6
ELF	7e0b3000-7e0d4000	Deferred        iphlpapi<elf>
  \-PE	7e0c0000-7e0d4000	\               iphlpapi
ELF	7e11b000-7e135000	Deferred        wsock32<elf>
  \-PE	7e120000-7e135000	\               wsock32
ELF	7e135000-7e154000	Deferred        tapi32<elf>
  \-PE	7e140000-7e154000	\               tapi32
ELF	7e159000-7e16c000	Deferred        riched32<elf>
  \-PE	7e160000-7e16c000	\               riched32
ELF	7e16c000-7e17f000	Deferred        msimg32<elf>
  \-PE	7e170000-7e17f000	\               msimg32
ELF	7e17f000-7e1b2000	Deferred        uxtheme<elf>
  \-PE	7e190000-7e1b2000	\               uxtheme
ELF	7e1c8000-7e1d1000	Deferred        libxcursor.so.1
ELF	7e1f5000-7e21b000	Deferred        libexpat.so.1
ELF	7e21b000-7e24a000	Deferred        libfontconfig.so.1
ELF	7e24a000-7e24f000	Deferred        libxfixes.so.3
ELF	7e24f000-7e256000	Deferred        libxrandr.so.2
ELF	7e256000-7e25f000	Deferred        libxrender.so.1
ELF	7e25f000-7e264000	Deferred        libxxf86vm.so.1
ELF	7e264000-7e285000	Deferred        imm32<elf>
  \-PE	7e270000-7e285000	\               imm32
ELF	7e285000-7e29e000	Deferred        libxcb.so.1
ELF	7e29e000-7e3bb000	Deferred        libx11.so.6
ELF	7e3bb000-7e3d2000	Deferred        libice.so.6
ELF	7e3ef000-7e481000	Deferred        winex11<elf>
  \-PE	7e400000-7e481000	\               winex11
ELF	7e481000-7e495000	Deferred        libz.so.1
ELF	7e495000-7e50d000	Deferred        libfreetype.so.6
ELF	7e50e000-7e511000	Deferred        libxcomposite.so.1
ELF	7e511000-7e514000	Deferred        libxinerama.so.1
ELF	7e514000-7e523000	Deferred        libxext.so.6
ELF	7e52a000-7e551000	Deferred        msacm32<elf>
  \-PE	7e530000-7e551000	\               msacm32
ELF	7e551000-7e5fd000	Deferred        winmm<elf>
  \-PE	7e560000-7e5fd000	\               winmm
ELF	7e5fd000-7e80c000	Deferred        shell32<elf>
  \-PE	7e610000-7e80c000	\               shell32
ELF	7e80c000-7e901000	Deferred        comctl32<elf>
  \-PE	7e810000-7e901000	\               comctl32
ELF	7e901000-7e977000	Deferred        rpcrt4<elf>
  \-PE	7e910000-7e977000	\               rpcrt4
ELF	7e977000-7ea7d000	Deferred        ole32<elf>
  \-PE	7e990000-7ea7d000	\               ole32
ELF	7ea7d000-7eb71000	Deferred        oleaut32<elf>
  \-PE	7ea90000-7eb71000	\               oleaut32
ELF	7eb71000-7ebdb000	Deferred        shlwapi<elf>
  \-PE	7eb80000-7ebdb000	\               shlwapi
ELF	7ebdb000-7ed1a000	Deferred        user32<elf>
  \-PE	7ebf0000-7ed1a000	\               user32
ELF	7ed1a000-7ed7a000	Deferred        advapi32<elf>
  \-PE	7ed30000-7ed7a000	\               advapi32
ELF	7ed7a000-7ee39000	Deferred        gdi32<elf>
  \-PE	7ed90000-7ee39000	\               gdi32
ELF	7ee39000-7ee45000	Deferred        libnss_files.so.2
ELF	7ee45000-7ee4f000	Deferred        libnss_nis.so.2
ELF	7ee4f000-7ee66000	Deferred        libnsl.so.1
ELF	7ee66000-7ee6e000	Deferred        libnss_compat.so.2
ELF	7ee6e000-7ee73000	Deferred        libxdmcp.so.6
ELF	7ee73000-7ee8b000	Deferred        version<elf>
  \-PE	7ee80000-7ee8b000	\               version
ELF	f7422000-f7425000	Deferred        libxau.so.6
ELF	f7426000-f742a000	Deferred        libdl.so.2
ELF	f742a000-f7571000	Deferred        libc.so.6
ELF	f7572000-f758b000	Deferred        libpthread.so.0
ELF	f758c000-f7590000	Deferred        libuuid.so.1
ELF	f75a0000-f75a8000	Deferred        libsm.so.6
ELF	f75a8000-f76e9000	Dwarf           libwine.so.1
ELF	f76eb000-f7709000	Deferred        ld-linux.so.2
ELF	f7709000-f770a000	Deferred        [vdso].so
Threads:
process  tid      prio (all id:s are in hex)
0000000e services.exe
	0000001f    0
	0000001e    0
	0000001a    0
	00000018    0
	00000017    0
	00000015    0
	00000010    0
	0000000f    0
00000012 winedevice.exe
	00000019    0
	00000014    0
	00000013    0
0000001b plugplay.exe
	00000020    0
	0000001d    0
	0000001c    0
00000021 explorer.exe
	00000022    0
00000023 (D) C:\DirectSOFT5\Bin\Csmain.exe
	00000026    0
	00000025    0
	00000024    0 <==
System information:
    Wine build: wine-1.4
    Platform: i386
    Host system: Linux
    Host version: 2.6.32-5-amd64
If you've used other OSen at the command line level, you may find "Linux
in a Nutshell" helpful because the text in the online manpages is very
(too?) concise. Otherwise you may prefer a rather thicker book on Linux
system administration. This is IMO an over fancy term: many
knowledgeable Linux users and all fully competent Linux programmers have
skills that are reserved for sysadmins on other non-UNIX type systems.
Its not that this is esoteric knowledge, rather that its all stuff
that's very useful to know and all applicable with simple tools like the
command line and a text editor. Did you know that almost all Linux
configuration data lives in simple text files and can be changed with a
standard text editor such as vi, vim, nano or gedit?
Yeah I've been looking at other books, I've got linux for dummies which got mind numbing pretty quick and linux server hacks 1&2.
I had a little bout with vi when I first started because I didn't know how to use gedit in root and needed to edit some files, but it was good to learn that funky navigation vi offers.

It weird that CSmain will only come up with 0644 permissions and if I us DSlaunch the manager never goes away like it does in windoze. This is probably attached to the the comm error I'm struggling with. I'm really starting to think that I'm missing a .dll or something since this is the only thing that won't work in wine. Like I said in the first post I've got no trouble with the optimate software ot X-CTU which is for Xbee firmware programming. Could it be a license conflict between the copy in virtualbox and wine?

Marc
Martin Gregorie

DirectSoft 5 Serial communications Issue's

Post by Martin Gregorie »

On Tue, 2012-05-22 at 18:09 -0500, samuraimarc wrote:
The rule didn't make a differance. I get the usual system error message from
wine which is:

Code:
Unhandled exception: page fault on write access to 0x00000005 in 32-bit code
(0x7bc498e7).
I have one program that did that and fixed it by adding the lines:

# Sets a value required by WINE in DOS emulation mode.
vm.mmap_min_addr = 0

to the end of /etc/sysctl.conf - I don't know it it will help you, but
may be worth a try.
Yeah I've been looking at other books, I've got linux for dummies which got mind numbing pretty quick and linux server hacks 1&2.
I had a little bout with vi when I first started because I didn't know how to use gedit in root and needed to edit some files, but it was good to learn that funky navigation vi offers.
Its always worth knowing the basics of 'vi' or 'vim', which is an
enhanced version. because it can be vital in recovering a totally borked
system. Thats because vi is capable of running, even when the display
won't support cursor movements, i.e. on a 'glass teletype' screen which
has linefeeds, tabs, backspaces and that's about it, and none of the
arrow keys work either. AFAIK there are no other editors (except the
rather fearsome 'ed' and 'sed') that can work with so little graphical
support.
It weird that CSmain will only come up with 0644 permissions and if I
Could it be honouring a readonly bit in the device file? IIRC
DOS/Windows only uses the 'archive' and 'readonly' permission bits and I
don't remember which Linux permission bits they map onto? Are you using
my rule with the bits set to 0666 or 0644?


Martin
samuraimarc
Level 1
Level 1
Posts: 7
Joined: Mon May 21, 2012 3:10 pm

Re: DirectSoft 5 Serial communications Issue's

Post by samuraimarc »

# Sets a value required by WINE in DOS emulation mode.
vm.mmap_min_addr = 0to the end of /etc/sysctl.conf - I don't know it it will help you, but
may be worth a try.
I'll definatly give it a try.
Could it be honouring a readonly bit in the device file? IIRC
DOS/Windows only uses the 'archive' and 'readonly' permission bits and I
don't remember which Linux permission bits they map onto? Are you using
my rule with the bits set to 0666 or 0644?
I'm running 0644 when I run 0666 I get the long listed error in my last post if I use Csmain. If I use DSlaunch i get the startup screen then it locks.

Marc
Locked