Issues #131 and #141
authorjoan <joan@abyz.co.uk>
Tue, 6 Feb 2018 16:01:45 +0000 (16:01 +0000)
committerjoan <joan@abyz.co.uk>
Tue, 6 Feb 2018 16:01:45 +0000 (16:01 +0000)
pigpio.3
pigpio.c
pigpio.h
pigpio.py
pigpiod.1

index 6fdff766134eec6c757a50cb42e41479d5725120..efe0a80370360b16ed4cfbb92105d4f8eb1a4cdb 100644 (file)
--- a/pigpio.3
+++ b/pigpio.3
@@ -6936,8 +6936,11 @@ and 611 control blocks on a lite channel.
 
 .IP "\fBint gpioCfgPermissions(uint64_t updateMask)\fP"
 .IP "" 4
-Configures pigpio to only allow updates (writes or mode changes) for the
-GPIO specified by the mask.
+Configures pigpio to restrict GPIO updates via the socket or pipe
+interfaces to the GPIO specified by the mask.  Programs directly
+calling the pigpio library (i.e. linked with -lpigpio are not
+affected).  A GPIO update is a write to a GPIO or a GPIO mode
+change or any function which would force such an action.
 
 .br
 
@@ -6963,7 +6966,7 @@ added to the mask.
 .br
 
 .br
-If the board revision is not recognised then GPIO 0-31 are allowed.
+If the board revision is not recognised then GPIO 2-27 are allowed.
 
 .br
 
@@ -10259,7 +10262,7 @@ A 16-bit word value.
 .br
 #define PI_DEFAULT_SOCKET_ADDR_STR         "127.0.0.1"
 .br
-#define PI_DEFAULT_UPDATE_MASK_UNKNOWN     0xFFFFFFFF
+#define PI_DEFAULT_UPDATE_MASK_UNKNOWN     0x0000000FFFFFFCLL
 .br
 #define PI_DEFAULT_UPDATE_MASK_B1          0x03E7CF93
 .br
index 933759591e05d8e22e927b6f49d2fb84a1a9e3a6..8b121f9fae5b2d983368c474ad1530db75796b59 100644 (file)
--- a/pigpio.c
+++ b/pigpio.c
@@ -205,7 +205,7 @@ bit 0 READ_LAST_NOT_SET_ERROR
 #define DO_DBG(level, format, arg...)                              \
    {                                                               \
       if ((gpioCfg.dbgLevel >= level) &&                           \
-         (!(gpioCfg.internals & PI_CFG_SIGHANDLER)))               \
+         (!(gpioCfg.internals & PI_CFG_NOSIGHANDLER)))             \
          fprintf(stderr, "%s %s: " format "\n" ,                   \
             myTimeStamp(), __FUNCTION__ , ## arg);                 \
    }
@@ -8135,7 +8135,7 @@ int initInitialise(void)
    }
 
 #ifndef EMBEDDED_IN_VM
-   if (!(gpioCfg.internals & PI_CFG_SIGHANDLER))
+   if (!(gpioCfg.internals & PI_CFG_NOSIGHANDLER))
       sigSetHandler();
 #endif
 
@@ -8534,7 +8534,7 @@ void gpioTerminate(void)
 
 #ifndef EMBEDDED_IN_VM
    if ((gpioCfg.internals & PI_CFG_STATS) &&
-       (!(gpioCfg.internals & PI_CFG_SIGHANDLER)))
+       (!(gpioCfg.internals & PI_CFG_NOSIGHANDLER)))
    {
       fprintf(stderr,
          "\n#####################################################\n");
index 1cedc09894f41dc5cd11843cf53373767f18493b..d1cf3af40f661239d103f0d98b37ea6d6f10fb0d 100644 (file)
--- a/pigpio.h
+++ b/pigpio.h
@@ -31,7 +31,7 @@ For more information, please refer to <http://unlicense.org/>
 #include <stdint.h>
 #include <pthread.h>
 
-#define PIGPIO_VERSION 6507
+#define PIGPIO_VERSION 6509
 
 /*TEXT
 
@@ -865,7 +865,7 @@ typedef void *(gpioThreadFunc_t) (void *);
 #define PI_CFG_ALERT_FREQ        4 /* bits 4-7 */
 #define PI_CFG_RT_PRIORITY       (1<<8)
 #define PI_CFG_STATS             (1<<9)
-#define PI_CFG_SIGHANDLER        (1<<10)
+#define PI_CFG_NOSIGHANDLER      (1<<10)
 
 #define PI_CFG_ILLEGAL_VAL       (1<<11)
 
@@ -4712,8 +4712,11 @@ D*/
 /*F*/
 int gpioCfgPermissions(uint64_t updateMask);
 /*D
-Configures pigpio to only allow updates (writes or mode changes) for the
-GPIO specified by the mask.
+Configures pigpio to restrict GPIO updates via the socket or pipe
+interfaces to the GPIO specified by the mask.  Programs directly
+calling the pigpio library (i.e. linked with -lpigpio are not
+affected).  A GPIO update is a write to a GPIO or a GPIO mode
+change or any function which would force such an action.
 
 This function is only effective if called before [*gpioInitialise*].
 
@@ -4724,7 +4727,7 @@ updateMask: bit (1<<n) is set for each GPIO n which may be updated
 The default setting depends upon the Pi model. The user GPIO are
 added to the mask.
 
-If the board revision is not recognised then GPIO 0-31 are allowed.
+If the board revision is not recognised then GPIO 2-27 are allowed.
 
 Unknown board @ PI_DEFAULT_UPDATE_MASK_UNKNOWN @ 0xFFFFFFFF 
 Type 1 board  @ PI_DEFAULT_UPDATE_MASK_B1 @ 0x03E6CF93 
@@ -6373,7 +6376,7 @@ after this command is issued.
 #define PI_DEFAULT_SOCKET_PORT             8888
 #define PI_DEFAULT_SOCKET_PORT_STR         "8888"
 #define PI_DEFAULT_SOCKET_ADDR_STR         "127.0.0.1"
-#define PI_DEFAULT_UPDATE_MASK_UNKNOWN     0xFFFFFFFF
+#define PI_DEFAULT_UPDATE_MASK_UNKNOWN     0x0000000FFFFFFCLL
 #define PI_DEFAULT_UPDATE_MASK_B1          0x03E7CF93
 #define PI_DEFAULT_UPDATE_MASK_A_B2        0xFBC7CF9C
 #define PI_DEFAULT_UPDATE_MASK_APLUS_BPLUS 0x0080480FFFFFFCLL
index 275250bb9a581a785a75b138e050d1b536d17cb6..aa73f3d9abd97c59cfb9f078563abbbea0c8b006 100644 (file)
--- a/pigpio.py
+++ b/pigpio.py
@@ -3,7 +3,7 @@ pigpio is a Python module for the Raspberry which talks to
 the pigpio daemon to allow control of the general purpose
 input outputs (GPIO).
 
-[http://abyz.co.uk/rpi/pigpio/python.html]
+[http://abyz.me.uk/rpi/pigpio/python.html]
 
 *Features*
 
@@ -299,7 +299,7 @@ import threading
 import os
 import atexit
 
-VERSION = "1.38"
+VERSION = "1.39"
 
 exceptions = True
 
@@ -1114,17 +1114,19 @@ class _callback_thread(threading.Thread):
 
       lastLevel = self.lastLevel
 
+      RECV_SIZ = 4096
       MSG_SIZ = 12
 
+      buf = bytes()
       while self.go:
 
-         buf = self.sl.s.recv(MSG_SIZ)
+         buf += self.sl.s.recv(RECV_SIZ)
+         offset = 0
 
-         while self.go and len(buf) < MSG_SIZ:
-            buf += self.sl.s.recv(MSG_SIZ-len(buf))
-
-         if self.go:
-            seq, flags, tick, level = (struct.unpack('HHII', buf))
+         while self.go and (len(buf) - offset) >= MSG_SIZ:
+            msgbuf = buf[offset:offset + MSG_SIZ]
+            offset += MSG_SIZ
+            seq, flags, tick, level = (struct.unpack('HHII', msgbuf))
 
             if flags == 0:
                changed = level ^ lastLevel
@@ -1147,6 +1149,7 @@ class _callback_thread(threading.Thread):
                   for cb in self.events:
                      if cb.event == event:
                         cb.func(event, tick)
+         buf = buf[offset:]
 
       self.sl.s.close()
 
@@ -4163,7 +4166,7 @@ class pi():
       """
       Store a script for later execution.
 
-      See [[http://abyz.co.uk/rpi/pigpio/pigs.html#Scripts]] for
+      See [[http://abyz.me.uk/rpi/pigpio/pigs.html#Scripts]] for
       details.
 
       script:= the script text as a series of bytes.
index db10b5f1ff2b2605425e9eb7bff4fd5975ac9641..1f7d3d1d3f36fe7d39c937ed23bda51aabf10b91 100644 (file)
--- a/pigpiod.1
+++ b/pigpiod.1
@@ -78,6 +78,11 @@ Disable remote socket interface.
 .
 Default enabled
 .
+.IP "\fB-m\fP"
+Disable alerts (sampling).
+.
+Default enabled
+.
 .IP "\fB-n IP address\fP"
 Allow IP address to use the socket interface.
 Name (e.g. paul) or dotted quad (e.g. 192.168.1.66).