Skip to content

Commit cdaad8a

Browse files
committed
Fixed regex for plc type detection
1 parent 7833d03 commit cdaad8a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/S7CommPlusDriver/Legitimation/Legitimation.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ private int legitimate(ValueStruct serverSession, string password, string userna
2525
{
2626
// Parse device and firmware version
2727
string sessionVersionPAOMString = ((ValueWString)serverSession.GetStructElement((uint)Ids.LID_SessionVersionSystemPAOMString)).GetValue();
28-
Regex reVersions = new Regex("^.*;.*(1[52]\\d\\d).+;S(\\d\\.\\d)$");
28+
Regex reVersions = new Regex("^.*;.*[17]\\s?([52]\\d\\d).+;[VS](\\d\\.\\d)$");
2929
Match m = reVersions.Match(sessionVersionPAOMString);
3030
if (!m.Success)
3131
{
@@ -39,7 +39,7 @@ private int legitimate(ValueStruct serverSession, string password, string userna
3939

4040
// Check if we have to use legacy legitimation via the firmware version
4141
bool legacyLegitimation = false;
42-
if (deviceVersion.StartsWith("15"))
42+
if (deviceVersion.StartsWith("5"))
4343
{
4444
if (fwVerNo < 209)
4545
{
@@ -51,7 +51,7 @@ private int legitimate(ValueStruct serverSession, string password, string userna
5151
legacyLegitimation = true;
5252
}
5353
}
54-
else if (deviceVersion.StartsWith("12"))
54+
else if (deviceVersion.StartsWith("2"))
5555
{
5656
if (fwVerNo < 403)
5757
{

0 commit comments

Comments
 (0)