Merged default wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 13 Sep 2021 13:02:52 +0200
branchwxPython4
changeset 3316 51b9b49a56ba
parent 3313 21d37b199ede (current diff)
parent 3315 5f9db9c6c69c (diff)
child 3317 ecfa689684c5
Merged default
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/setup.py	Mon Sep 13 13:02:52 2021 +0200
@@ -0,0 +1,15 @@
+"""
+Install Beremiz
+"""
+from setuptools import setup
+
+setup(
+    name='beremiz',
+    version='0.1', 
+    install_requires=["Twisted == 20.3.0", "attrs == 19.2.0", "Automat == 0.3.0",
+                      "zope.interface == 4.4.2", "Nevow == 0.14.5", "PyHamcrest == 2.0.2",
+                      "Pygments == 2.9.0", "Pyro == 3.16", "constantly == 15.1.0",
+                      "future == 0.18.2", "hyperlink == 21.0.0", "incremental == 21.3.0",
+                      "pathlib == 1.0.1", "prompt-toolkit == 3.0.19", "zeroconf-py2compat == 0.19.10", 
+                      "idna == 2.10"]
+)
--- a/targets/Xenomai/plc_Xenomai_main.c	Fri Sep 10 14:48:07 2021 +0200
+++ b/targets/Xenomai/plc_Xenomai_main.c	Mon Sep 13 13:02:52 2021 +0200
@@ -8,6 +8,7 @@
 #include <time.h>
 #include <signal.h>
 #include <stdlib.h>
+#include <errno.h>
 #include <sys/mman.h>
 #include <sys/fcntl.h>
 
@@ -117,16 +118,16 @@
 
 static unsigned long __debug_tick;
 
-#define _LogAndReturnNull(text) \
+#define _Log(text, err) \
     {\
-    	char mstr[256] = text " for ";\
-        strncat(mstr, name, 255);\
+        char mstr[256];\
+        snprintf(mstr, 255, text " for %s (%d)", name, err);\
         LogMessage(LOG_CRITICAL, mstr, strlen(mstr));\
-        return NULL;\
     }
 
 void *create_RT_to_nRT_signal(char* name){
     int new_index = -1;
+    int ret;
     RT_to_nRT_signal_t *sig;
     char pipe_dev[64];
 
@@ -141,19 +142,22 @@
 
     /* fail if none found */
     if(new_index == -1) {
-    	_LogAndReturnNull("Maximum count of RT-PIPE reached while creating pipe");
+    	_Log("Maximum count of RT-PIPE reached while creating pipe", max_RT_to_nRT_signals);
+        return NULL;
     }
 
     /* create rt pipe */
-    if(rt_pipe_create(&sig->pipe, name, new_index, PIPE_SIZE) < 0){
-    	_LogAndReturnNull("Failed opening real-time end of RT-PIPE");
+    if(ret = rt_pipe_create(&sig->pipe, name, new_index, PIPE_SIZE) < 0){
+    	_Log("Failed opening real-time end of RT-PIPE", ret);
+        return NULL;
     }
 
     /* open pipe's userland */
-    snprintf(pipe_dev, 64, "/dev/rtp%d", new_index);
+    snprintf(pipe_dev, 63, "/dev/rtp%d", new_index);
     if((sig->pipe_fd = open(pipe_dev, O_RDWR)) == -1){
         rt_pipe_delete(&sig->pipe);
-    	_LogAndReturnNull("Failed opening non-real-time end of RT-PIPE");
+    	_Log("Failed opening non-real-time end of RT-PIPE", errno);
+        return NULL;
     }
 
     sig->used = 1;
@@ -163,13 +167,19 @@
 }
 
 void delete_RT_to_nRT_signal(void* handle){
+    int ret;
     RT_to_nRT_signal_t *sig = (RT_to_nRT_signal_t*)handle;
+    char *name = sig->name;
 
     if(!sig->used) return;
 
-    rt_pipe_delete(&sig->pipe);
-
-    close(sig->pipe_fd);
+    if(ret = rt_pipe_delete(&sig->pipe) != 0){
+    	_Log("Failed closing real-time end of RT-PIPE", ret);
+    }
+
+    if(close(sig->pipe_fd) != 0){
+    	_Log("Failed closing non-real-time end of RT-PIPE", errno);
+    }
 
     sig->used = 0;
 }