etherlab/runtime_etherlab.py
author Edouard Tisserant <edouard.tisserant@gmail.com>
Wed, 30 Jun 2021 15:51:59 +0200
branchsvghmi
changeset 3267 5f20f391ae31
parent 2703 32ffdb32b14e
child 3750 f62625418bff
permissions -rw-r--r--
SVGHMI: Prepare accepting multiple clients on multiple HMI: Use POULibrary new capability to add variables to PLC Configuration. Now heartbeat and HMI tree root are added by the library part of SVGHMI, and not by each instance.
2641
c9deff128c37 EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2132
diff changeset
     1
#!/usr/bin/env python
c9deff128c37 EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2132
diff changeset
     2
# -*- coding: utf-8 -*-
c9deff128c37 EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2132
diff changeset
     3
2643
b98d9e08231f Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2422 2641
diff changeset
     4
# this file is part of beremiz
2641
c9deff128c37 EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2132
diff changeset
     5
#
2643
b98d9e08231f Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2422 2641
diff changeset
     6
# copyright (c) 2011-2014: laurent bessard, edouard tisserant
b98d9e08231f Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2422 2641
diff changeset
     7
#                          rtes lab : crkim, jblee, youcu
b98d9e08231f Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2422 2641
diff changeset
     8
#                          higen motor : donggu kang
2641
c9deff128c37 EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2132
diff changeset
     9
#
2643
b98d9e08231f Etherlab : Merged 2014-2018 changes from jblee and others
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2422 2641
diff changeset
    10
# see copying file for copyrights details.
2641
c9deff128c37 EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2132
diff changeset
    11
2405
af050469fc5c clean etherlab: pylint, W1618 # (no-absolute-import) import missing `from __future__ import absolute_import`
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2404
diff changeset
    12
from __future__ import absolute_import
2357
7c67286cddbe cleanup etherlab: pep8, E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2355
diff changeset
    13
import os
2404
87eb184414bd clean etherlab: pylint,E0602 # (undefined-variable) Undefined variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2401
diff changeset
    14
import signal
2357
7c67286cddbe cleanup etherlab: pep8, E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2355
diff changeset
    15
import subprocess
7c67286cddbe cleanup etherlab: pep8, E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2355
diff changeset
    16
import ctypes
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    17
from threading import Thread
2357
7c67286cddbe cleanup etherlab: pep8, E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2355
diff changeset
    18
import time
7c67286cddbe cleanup etherlab: pep8, E401 multiple imports on one line
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2355
diff changeset
    19
import re
2404
87eb184414bd clean etherlab: pylint,E0602 # (undefined-variable) Undefined variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2401
diff changeset
    20
87eb184414bd clean etherlab: pylint,E0602 # (undefined-variable) Undefined variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2401
diff changeset
    21
import runtime.PLCObject as PLCObject
2401
fe887446134d clean etherlab: pylint, E0611 # (no-name-in-module) No name 'X' in module 'Y'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2396
diff changeset
    22
from runtime.loglevels import LogLevelsDict
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    23
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    24
SDOAnswered = PLCBinary.SDOAnswered
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    25
SDOAnswered.restype = None
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    26
SDOAnswered.argtypes = []
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    27
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    28
SDOThread = None
2132
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
    29
SDOProc = None
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    30
Result = None
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    31
2360
2a3d022a7dac cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2358
diff changeset
    32
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    33
def SDOThreadProc(*params):
2132
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
    34
    global Result, SDOProc
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    35
    if params[0] == "upload":
2115
edb49073227e Added error logging when SDO FB fails
Edouard Tisserant
parents: 2114
diff changeset
    36
        cmdfmt = "ethercat upload -p %d -t %s 0x%.4x 0x%.2x"
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    37
    else:
2115
edb49073227e Added error logging when SDO FB fails
Edouard Tisserant
parents: 2114
diff changeset
    38
        cmdfmt = "ethercat download -p %d -t %s 0x%.4x 0x%.2x %s"
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
    39
2115
edb49073227e Added error logging when SDO FB fails
Edouard Tisserant
parents: 2114
diff changeset
    40
    command = cmdfmt % params[1:]
2132
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
    41
    SDOProc = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True)
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
    42
    res = SDOProc.wait()
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
    43
    output = SDOProc.communicate()[0]
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
    44
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    45
    if params[0] == "upload":
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    46
        Result = None
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    47
        if res == 0:
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    48
            if params[2] in ["float", "double"]:
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    49
                Result = float(output)
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    50
            elif params[2] in ["string", "octet_string", "unicode_string"]:
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    51
                Result = output
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    52
            else:
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    53
                hex_value, dec_value = output.split()
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    54
                if int(hex_value, 16) == int(dec_value):
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    55
                    Result = int(dec_value)
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    56
    else:
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    57
        Result = res == 0
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
    58
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    59
    SDOAnswered()
2375
cfa68a06a24d clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2372
diff changeset
    60
    if res != 0:
2115
edb49073227e Added error logging when SDO FB fails
Edouard Tisserant
parents: 2114
diff changeset
    61
        PLCObject.LogMessage(
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
    62
            LogLevelsDict["WARNING"],
2363
9c7da6ff6a34 cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2360
diff changeset
    63
            "%s : %s" % (command, output))
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
    64
2641
c9deff128c37 EtherCat master plugin : commit changes recovered from KOSMOS 2018 installer, unkown author(s).
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2132
diff changeset
    65
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    66
def EthercatSDOUpload(pos, index, subindex, var_type):
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    67
    global SDOThread
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    68
    SDOThread = Thread(target=SDOThreadProc, args=["upload", pos, var_type, index, subindex])
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    69
    SDOThread.start()
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
    70
2360
2a3d022a7dac cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2358
diff changeset
    71
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    72
def EthercatSDODownload(pos, index, subindex, var_type, value):
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    73
    global SDOThread
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    74
    SDOThread = Thread(target=SDOThreadProc, args=["download", pos, var_type, index, subindex, value])
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    75
    SDOThread.start()
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    76
2360
2a3d022a7dac cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2358
diff changeset
    77
2086
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    78
def GetResult():
8e4992e0f147 Adding block library for SDO download and SDO upload
Laurent Bessard
parents:
diff changeset
    79
    return Result
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    80
2370
e40f3914e55f cleanup etherlab: pep8, E305 expected 2 blank lines after class or function definition, found X
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2366
diff changeset
    81
2365
bc07b9910cdb cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2363
diff changeset
    82
KMSGPollThread = None
bc07b9910cdb cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2363
diff changeset
    83
StopKMSGThread = False
2360
2a3d022a7dac cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2358
diff changeset
    84
2a3d022a7dac cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2358
diff changeset
    85
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    86
def KMSGPollThreadProc():
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    87
    """
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    88
    Logs Kernel messages starting with EtherCAT
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    89
    Uses GLibc wrapper to Linux syscall "klogctl"
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
    90
    Last 4 KB are polled, and lines compared to last
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    91
    captured line to detect new lines
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    92
    """
2365
bc07b9910cdb cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2363
diff changeset
    93
    libc = ctypes.CDLL("libc.so.6")
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    94
    klog = libc.klogctl
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    95
    klog.argtypes = [ctypes.c_int, ctypes.c_char_p, ctypes.c_int]
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    96
    klog.restype = ctypes.c_int
2365
bc07b9910cdb cleanup etherlab: pep8, E225 missing whitespace around operator
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2363
diff changeset
    97
    s = ctypes.create_string_buffer(4*1024)
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    98
    last = None
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
    99
    while not StopKMSGThread:
2372
51f3acc89a58 clean etherlab: pep8, E741 ambiguous variable name 'l'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2370
diff changeset
   100
        bytes_to_read = klog(3, s, len(s)-1)
51f3acc89a58 clean etherlab: pep8, E741 ambiguous variable name 'l'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2370
diff changeset
   101
        log = s.value[:bytes_to_read-1]
2375
cfa68a06a24d clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2372
diff changeset
   102
        if last:
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   103
            log = log.rpartition(last)[2]
2375
cfa68a06a24d clean etherlab: pep8, E203 whitespace before ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2372
diff changeset
   104
        if log:
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   105
            last = log.rpartition('\n')[2]
2363
9c7da6ff6a34 cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2360
diff changeset
   106
            for lvl, msg in re.findall(
2407
5f2b1bb464a0 clean etherlab: pylint, C0330 # (bad-continuation) Wrong hanging indentation before block
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2405
diff changeset
   107
                    r'<(\d)>\[\s*\d*\.\d*\]\s*(EtherCAT\s*.*)$',
5f2b1bb464a0 clean etherlab: pylint, C0330 # (bad-continuation) Wrong hanging indentation before block
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2405
diff changeset
   108
                    log, re.MULTILINE):
2116
2b1980a038b1 Better logging, saffer failure at init (allows restart)
Edouard Tisserant
parents: 2115
diff changeset
   109
                PLCObject.LogMessage(
2b1980a038b1 Better logging, saffer failure at init (allows restart)
Edouard Tisserant
parents: 2115
diff changeset
   110
                    LogLevelsDict[{
2363
9c7da6ff6a34 cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2360
diff changeset
   111
                        "4": "WARNING",
9c7da6ff6a34 cleanup etherlab: pep8, E231 missing whitespace after ','
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2360
diff changeset
   112
                        "3": "CRITICAL"}.get(lvl, "DEBUG")],
2116
2b1980a038b1 Better logging, saffer failure at init (allows restart)
Edouard Tisserant
parents: 2115
diff changeset
   113
                    msg)
2355
fec77f2b9e07 cleanup etherlab: pep8, W291 trailing whitespace
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2353
diff changeset
   114
        time.sleep(0.5)
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   115
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   116
2703
32ffdb32b14e Python Runtime: order of execution of extension's init() and cleanup() now reflects order of appearance of extensions in configuration tree.
Edouard Tisserant
parents: 2643
diff changeset
   117
# TODO : rename to match _runtime_{location}_extname_init() format
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   118
def _runtime_etherlab_init():
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   119
    global KMSGPollThread, StopKMSGThread
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   120
    StopKMSGThread = False
2366
d635680e4c2c cleanup etherlab: pep8, E251 unexpected spaces around keyword / parameter equals
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2365
diff changeset
   121
    KMSGPollThread = Thread(target=KMSGPollThreadProc)
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   122
    KMSGPollThread.start()
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   123
2360
2a3d022a7dac cleanup etherlab: pep8, E302 expected 2 blank lines, found 1
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2358
diff changeset
   124
2703
32ffdb32b14e Python Runtime: order of execution of extension's init() and cleanup() now reflects order of appearance of extensions in configuration tree.
Edouard Tisserant
parents: 2643
diff changeset
   125
# TODO : rename to match _runtime_{location}_extname_cleanup() format
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   126
def _runtime_etherlab_cleanup():
2422
45aa510d7a2a cleanup etherlab: pylint, W0602 (global-variable-not-assigned) Using global for 'X' but no assignment is done
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2407
diff changeset
   127
    global KMSGPollThread, StopKMSGThread, SDOThread
2132
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
   128
    try:
2404
87eb184414bd clean etherlab: pylint,E0602 # (undefined-variable) Undefined variable 'X'
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2401
diff changeset
   129
        os.kill(SDOProc.pid, signal.SIGTERM)
2353
8f1a2846b2f5 cleanup etherlab: pep8, E722 do not use bare except
Andrey Skvortsov <andrej.skvortzov@gmail.com>
parents: 2132
diff changeset
   130
    except Exception:
2132
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
   131
        pass
9f5e4dc43053 Added support for stopping SDOThreadProc when stopping PLC
Laurent Bessard
parents: 2116
diff changeset
   132
    SDOThread = None
2114
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   133
    StopKMSGThread = True
fc1bc441cf71 Added logging based on collecting Kernel logs
Edouard Tisserant
parents: 2086
diff changeset
   134
    KMSGPollThread = None