This document covers my attempts to get the Plugwise Source Windows program running under Linux Wine.
SPOILER - it can be made to run, but you cannot communicate with the USB dongle, so it's a 'no go' for now.
First, we'll detail the versions of the components used, as the ability to make this work is likely
to have some dependancies, and may not work the same with different versions. The main components then
are the pwsetup.exe
installer component and wine
. We also use
winetricks
to help configure wine
.
Component | Version |
---|---|
plugwise (pwsetup.exe ) |
2.40 (20180404.555) |
wine | wine-5.0 |
winetricks | 20200412-next |
We undertake this under wine32
. iirc, my attempt at running this under generic wine
, which
I think was wine64
, did not work. I used winetricks
to help configure wine
, as this just
makes the process a lot simpler.
I set my wine
up in a specific config folder for a number of reasons:
- it isolates my experiments and makes it easy to remove them and start over
- it does not pollute my global wine config
- it separates the installation from any other applications I am trying to run under
wine
, and thus removes any potential cross-contamination or inteference.
Here is the script I use to boot up my winetricks
:
WINEPREFIX="$HOME/wine_pw32" WINEARCH=win32 ./winetricks
From experimentation I found you need to install a number of components (DLLs) into wine
in
order to get plugwise to run. Here are the items I installed using winetricks
. I'm not sure
exactly which dotnet
components were needed, but the all the ones in the following list were
installed and I can boot Plugwise. mdac28
and jet40
were also then needed. There are two tables
here - what I installed, and then what my winetricks.log
looks like.
Component installed with winetricks |
---|
dotnet20sp2 |
dotnet11 |
dotnet11sp1 |
dotnet40 |
dotnet48 |
mdac28 |
jet40 |
And here is my winetricks.log
file for reference:
w_workaround_wine_bug-34803
remove_mono
dotnet20sp2
remove_mono
remove_mono
andale
arial
comicsans
courier
georgia
impact
times
trebuchet
verdana
webdings
corefonts
fontfix
dotnet11
dotnet11sp1
remove_mono
remove_mono
winxp
dotnet40
dotnet48
mdac28
mdac27
wsh57
jet40
When installing you will see many warnings on the command line, and have many dialogs to O.K. - I just clicked through them, not even studying the text. It's somewhat annoying, but ultimately, it seems benign, and things end up working.
One last thing you need to do is to ensure you are passing your Plugwise USB stick
through to wine
as a UART. Recent wine
s look like they do this automatically, but
I wanted to ensure my USB UART appeared as the first COM port. By default it appeard
as COM33 in my setup!.
To move the USB UART COM to be COM1, we need add a new section specifying to wine
which devices are mapped where (basically, an over-ride of the default mapping algorithm).
Using the editor of your choice, add the following into your system.reg
file. I found that
the section already existed in my file, but was empty, so I just added the two COM
lines.
[Software\\Wine\\Ports] 1591696793
#time=1d63e44b8abc440
"COM1"="/dev/ttyUSB0"
"COM2"="/dev/ttyUSB1"
I mapped two USB ports as sometimes my device will get mapped to the second one when I plug it in.
Once you run wine
below, you should be able to see the com ports in the dosdevices
subdirectory
of the wine configuration:
~/wine_pw32$ ls -la dosdevices/
total 8
drwxr-xr-x 2 user user 4096 Jun 12 16:32 .
drwxr-xr-x 4 user user 4096 Jun 12 16:37 ..
lrwxrwxrwx 1 user user 10 Jun 9 10:59 c: -> ../drive_c
lrwxrwxrwx 1 user user 12 Jun 12 16:32 com1 -> /dev/ttyUSB0
lrwxrwxrwx 1 user user 10 Jun 12 16:32 com10 -> /dev/ttyS7
lrwxrwxrwx 1 user user 10 Jun 12 16:32 com11 -> /dev/ttyS8
lrwxrwxrwx 1 user user 10 Jun 12 16:32 com12 -> /dev/ttyS9
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com13 -> /dev/ttyS10
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com14 -> /dev/ttyS11
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com15 -> /dev/ttyS12
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com16 -> /dev/ttyS13
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com17 -> /dev/ttyS14
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com18 -> /dev/ttyS15
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com19 -> /dev/ttyS16
lrwxrwxrwx 1 user user 12 Jun 12 16:32 com2 -> /dev/ttyUSB1
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com20 -> /dev/ttyS17
lrwxrwxrwx 1 user user 11 Jun 12 16:32 com21 -> /dev/ttyS18
With the Wine components installed, we can then run the plugwise installer. I ran mine from
a wine
command prompt rather than invoking directly on the command line:
WINEPREFIX="$HOME/wine_pw32" WINEARCH=win32 wine cmd
Z:\tmp>dir
09/06/2020 09:38 7,362,352 pwsetup.exe
Z:\tmp>.\plugwise.exe
Follow the dialogs etc., and the Plugwise binaries should be installed.
Now Plugwise is installed, let't try running it. Again, at the wine
prompt:
Z:\C:
c:\>cd Pro*
c:\Program Files>cd Pl*
c:\Program Files\Plugwise>cd Pl*
c:\Program Files\Plugwise\Plugwise Source>
c:\Program Files\Plugwise\Plugwise Source>dir *.exe
Directory of c:\Program Files\Plugwise\Plugwise Source
11/10/2019 16:19 324,728 PlugwiseBackup.exe
11/10/2019 16:19 335,992 PlugwiseConfig.exe
11/10/2019 16:19 484,984 PlugwiseDiag.exe
11/10/2019 16:19 556,152 PlugwiseMeters.exe
11/10/2019 16:19 881,784 PlugwisePC.exe
11/10/2019 16:19 306,808 PlugwiseServer.exe
11/10/2019 16:19 244,856 PlugwiseUpdate.exe
11/10/2019 16:19 240,248 PlugwiseWatchDog.exe
09/06/2020 11:04 197,622 uninstall.exe
c:\Program Files\Plugwise\Plugwise Source>.\PlugwiseConfig
Initially I ran PlugwisePC.exe
, and that worked the first time, but failed after my initial
configuration failure. From that point on I ran PlugwiseConfig.exe
, which took me directly
to the setup dialogs - so I'd recommend trying that first.
At this point you will be asked for a product serial number. Although I do own a valid serial number, I went with the 'free for non commercial use' option, as this is not for commercial use.
Skip over the 'smile' dialog page, as we are trying to configure the 'Stick' here... You should
then find yourself at a dialog that is searching for the USB dongle. Here you will get stuck -
the dialog will spin here forever looking for the 'stick', no matter if it is plugged in,
replugged etc. What you will find are errors in the wine
output such as:
005e:fixme:comm:wait_on EV_RXFLAG not handled
This is the crux of the Wine/plugwise stick issue. Plugwise is trying to use a serial/UART
Windows communication feature that is not supported under Wine, as there is no direct equivalent
in the Linux driver world. You can find some more links and details
here.
It seems there have been a few wine patches floating around to work
around this a bit, but nothing that has ever landed in the upstream. At that point, without
hacking and rebuilding your own wine
installation to get past this, you are stuck.
Using lsof
, I can confirm that wine
and plugwiseconfig
are indeed opening and scanning
the USB UART occasionally, so afaict, the mapping has worked, and the thing preventing any
progress is the EV_RXFLAG
issue above.
I gave up at that point, and went back to trying to make it work on a Windows XP machine and then directly hacking the plugwise protocol under Linux to the USB UART dongle.