diff --git a/DOC/dbase/lg.sqlite b/DOC/dbase/lg.sqlite index fd05e93..662e6d2 100644 Binary files a/DOC/dbase/lg.sqlite and b/DOC/dbase/lg.sqlite differ diff --git a/DOC/src/defs/examples.def b/DOC/src/defs/examples.def index 2e639ac..839ec14 100644 --- a/DOC/src/defs/examples.def +++ b/DOC/src/defs/examples.def @@ -35,7 +35,7 @@ Prints gpiochip information and line information for each GPIO. ?4|dhtxx.c|2020-11-18|DHT11/22/XX Reads the DHT series of temperature and humidity sensors. The sensor type is autodetected. -?4|monitor.c|2020-11-18|Monitor GPIO +?4|monitor.c|2020-11-20|Monitor GPIO Monitors one or more GPIO as specified on the command line. ./monitor [chip:]gpio ... @@ -47,7 +47,7 @@ e.g. ./monitor 23 24 25 # chip0: 23,24,25 ./monitor 0:23 1:0 5 # chip0: 23, chip1: 0,5 -?4|rotary_encoder.c|2020-11-18|Rotary Encoder +?4|rotary_encoder.c|2020-11-20|Rotary Encoder Code to monitor a rotary encoder and show the detent changes. ./rotary_encoder [chip] gpioA gpioB diff --git a/DOC/src/defs/rgs.def b/DOC/src/defs/rgs.def index 56c59e1..4f75ff9 100644 --- a/DOC/src/defs/rgs.def +++ b/DOC/src/defs/rgs.def @@ -1174,11 +1174,11 @@ On error a negative status code will be returned. The pipes are created in the daemon's working directory (the command [#pwd#] will show the working directory). -Notifications for handle g will be available at the pipe named lgd-nfyx -(where g is the handle number). +Notifications for handle x will be available at the pipe named .lgd-nfyx +(where x is the handle number). E.g. if the command returns 15 then the notifications must be read -from lgd-nfy15. +from .lgd-nfy15. ... $ rgs c 1 no diff --git a/EXAMPLES/lgpio/monitor.c b/EXAMPLES/lgpio/monitor.c index 2c91e96..59381dc 100644 --- a/EXAMPLES/lgpio/monitor.c +++ b/EXAMPLES/lgpio/monitor.c @@ -1,6 +1,6 @@ /* monitor.c -2020-11-18 +2020-11-20 Public Domain http://abyz.me.uk/lg/lgpio.html @@ -96,14 +96,14 @@ int main(int argc, char *argv[]) if (err < 0) { fprintf(stderr, "GPIO in use %d:%d (%s)\n", - chip, gpio, lgErrStr(err)); + chip, gpio, lguErrorText(err)); return -1; } } else { fprintf(stderr, "can't open gpiochip %d (%s)\n", - chip, lgErrStr(h)); + chip, lguErrorText(h)); return -1; } } diff --git a/EXAMPLES/lgpio/rotary_encoder.c b/EXAMPLES/lgpio/rotary_encoder.c index 7e509b6..b5e56ee 100644 --- a/EXAMPLES/lgpio/rotary_encoder.c +++ b/EXAMPLES/lgpio/rotary_encoder.c @@ -1,6 +1,6 @@ /* rotary_encoder.c -2020-11-18 +2020-11-20 Public Domain http://abyz.me.uk/lg/lgpio.html @@ -116,7 +116,7 @@ int main(int argc, char *argv[]) if (h < 0) { fprintf(stderr, "can't open /dev/gpiochip%d (%s)\n", - renc.chip, lgErrStr(h)); + renc.chip, lguErrorText(h)); return -1; } @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) if (err < 0) { fprintf(stderr, "can't claim GPIO %d (%s)\n", - renc.gpioA, lgErrStr(err)); + renc.gpioA, lguErrorText(err)); return -1; } @@ -136,7 +136,7 @@ int main(int argc, char *argv[]) if (err < 0) { fprintf(stderr, "can't claim GPIO %d (%s)\n", - renc.gpioB, lgErrStr(err)); + renc.gpioB, lguErrorText(err)); return -1; } diff --git a/EXAMPLES/lgpio/sonar_ranger.c b/EXAMPLES/lgpio/sonar_ranger.c index eb7110e..650a611 100644 --- a/EXAMPLES/lgpio/sonar_ranger.c +++ b/EXAMPLES/lgpio/sonar_ranger.c @@ -100,7 +100,7 @@ int main(int argc, char *argv[]) if (h < 0) { fprintf(stderr, "can't open /dev/gpiochip%d (%s)\n", - chip, lgErrStr(h)); + chip, lguErrorText(h)); return -1; } @@ -109,7 +109,7 @@ int main(int argc, char *argv[]) if (err < 0) { fprintf(stderr, "can't claim GPIO %d (%s)\n", - trigger, lgErrStr(err)); + trigger, lguErrorText(err)); return -1; } @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) if (err < 0) { fprintf(stderr, "can't claim GPIO %d (%s)\n", - echo, lgErrStr(err)); + echo, lguErrorText(err)); return -1; } @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) if (err < 0) { fprintf(stderr, "can't create callback for GPIO %d (%s)\n", - echo, lgErrStr(cb_echo)); + echo, lguErrorText(cb_echo)); return -1; } diff --git a/PY_LGPIO/lgpio.i b/PY_LGPIO/lgpio.i index b51f69f..5f1bfeb 100644 --- a/PY_LGPIO/lgpio.i +++ b/PY_LGPIO/lgpio.i @@ -744,6 +744,6 @@ extern int lguGetInternal(int cfgId, uint64_t *OUTPUT); %rename(_set_internal) lguSetInternal; extern int lguSetInternal(int cfgId, uint64_t cfgVal); -%rename(_error_text) lgErrStr; -extern const char *lgErrStr(int error); +%rename(_error_text) lguErrorText; +extern const char *lguErrorText(int error); diff --git a/PY_LGPIO/lgpio_extra.py b/PY_LGPIO/lgpio_extra.py index f567424..09fff4c 100644 --- a/PY_LGPIO/lgpio_extra.py +++ b/PY_LGPIO/lgpio_extra.py @@ -5,7 +5,7 @@ import threading import time -LGPIO_PY_VERSION = 0x00000000 +LGPIO_PY_VERSION = 0x00010000 exceptions = True @@ -267,7 +267,7 @@ def __init__(self): """ threading.Thread.__init__(self) self._notify = _lgpio._notify_open() - self._file = open('lgd-nfy{}'.format(self._notify), 'rb') + self._file = open('.lgd-nfy{}'.format(self._notify), 'rb') self.go = False self.daemon = True self.callbacks = [] @@ -1639,10 +1639,10 @@ def notify_open(): The pipes are created in the library's working directory. Notifications for handle x will be available at the pipe - named lgd-nfyx (where x is the handle number). + named .lgd-nfyx (where x is the handle number). E.g. if the function returns 15 then the notifications must be - read from lgd-nfy15. + read from .lgd-nfy15. Notifications have the following structure: diff --git a/PY_LGPIO/setup.py b/PY_LGPIO/setup.py index 38be6da..d02aab5 100644 --- a/PY_LGPIO/setup.py +++ b/PY_LGPIO/setup.py @@ -12,7 +12,7 @@ lgpio_module = Extension('_lgpio', sources=['lgpio_wrap.c',], libraries=['lgpio',],) setup (name = 'lgpio', - version = '0.0.0.2', + version = '0.1.0.0', zip_safe=False, author='joan', author_email='joan@abyz.me.uk', diff --git a/PY_RGPIO/rgpio.py b/PY_RGPIO/rgpio.py index 2d3d1f5..db2866c 100644 --- a/PY_RGPIO/rgpio.py +++ b/PY_RGPIO/rgpio.py @@ -240,7 +240,7 @@ import atexit import hashlib -RGPIO_PY_VERSION = 0x00000300 +RGPIO_PY_VERSION = 0x00010000 exceptions = True @@ -638,7 +638,7 @@ _except_2 = """ Do you have permission to access the rgpiod daemon? -Perhaps it was started with lgd -nlocalhost""" +Perhaps it was started with rgpiod -nlocalhost""" _except_3 = """ Can't create callback thread. @@ -2668,10 +2668,10 @@ def notify_open(self): The pipes are created in the library's working directory. Notifications for handle x will be available at the pipe - named lgd-nfyx (where x is the handle number). + named .lgd-nfyx (where x is the handle number). E.g. if the function returns 15 then the notifications must be - read from lgd-nfy15. + read from .lgd-nfy15. Notifications have the following structure: diff --git a/PY_RGPIO/setup.py b/PY_RGPIO/setup.py index 613358a..efd6dbc 100644 --- a/PY_RGPIO/setup.py +++ b/PY_RGPIO/setup.py @@ -6,7 +6,7 @@ long_description = f.read() setup(name='rgpio', - version='0.0.3.0', + version='0.1.0.0', zip_safe=False, author='joan', author_email='joan@abyz.me.uk', diff --git a/lgCmd.c b/lgCmd.c index ffadb1a..62df9e4 100644 --- a/lgCmd.c +++ b/lgCmd.c @@ -184,16 +184,16 @@ cmdInfo_t cmdInfo[]= {LG_CMD_USER, "U", 105, 6, 0}, // xSetUser {LG_CMD_USER, "USER", 105, 6, 0}, // xSetUser - {LG_CMD_SHARE, "C", 101, 0, 0}, // xShareSetUse - {LG_CMD_SHARE, "SHARE", 101, 0, 0}, // xShareSetUse + {LG_CMD_SHARE, "C", 101, 0, 1}, // xShareSetUse + {LG_CMD_SHARE, "SHARE", 101, 0, 1}, // xShareSetUse - {LG_CMD_LCFG, "LCFG", 100, 0, 1}, // xLoadConfig + {LG_CMD_LCFG, "LCFG", 100, 0, 0}, // xLoadConfig - {LG_CMD_PCD, "PCD", 100, 6, 1}, // lguGetConfigDir - {LG_CMD_PWD, "PWD", 100, 6, 1}, // lguGetWorkDir + {LG_CMD_PCD, "PCD", 100, 6, 0}, // lguGetConfigDir + {LG_CMD_PWD, "PWD", 100, 6, 0}, // lguGetWorkDir - {LG_CMD_SHRS, "SHRS", 101, 0, 0}, // lgHdlSetShare - {LG_CMD_SHRU, "SHRU", 101, 0, 0}, // xShareUse + {LG_CMD_SHRS, "SHRS", 101, 0, 1}, // lgHdlSetShare + {LG_CMD_SHRU, "SHRU", 101, 0, 1}, // xShareUse {LG_CMD_PASSW, "PASSW", 105, 0, 0}, // xPassword diff --git a/lgErr.c b/lgErr.c index 34534ea..f417322 100644 --- a/lgErr.c +++ b/lgErr.c @@ -143,7 +143,7 @@ static xErrInfo_t xErrInfo[]= {LG_INVALID_GROUP_ALERT, "can not set a group to alert"}, }; -const char *lgErrStr(int error) +const char *lguErrorText(int error) { int i; diff --git a/lgNotify.c b/lgNotify.c index 5f0a5d4..9903aec 100644 --- a/lgNotify.c +++ b/lgNotify.c @@ -127,7 +127,7 @@ int lgNotifyOpenWithSize(int bufSize) if (handle < 0) {return LG_NO_MEMORY;} - snprintf(name, sizeof(name), "%s/lgd-nfy%d", lguGetWorkDir(), handle); + snprintf(name, sizeof(name), "%s/.lgd-nfy%d", lguGetWorkDir(), handle); xCreatePipe(name, 0664); diff --git a/lgpio.3 b/lgpio.3 index 80d19fd..eefc1e3 100644 --- a/lgpio.3 +++ b/lgpio.3 @@ -331,7 +331,7 @@ lguTime Gets the current time .br .br -lgErrStr Gets a text description of an error code +lguErrorText Gets a text description of an error code .br .br @@ -1768,7 +1768,7 @@ int main(int argc, char *argv[]) .br .br - if (h < 0) { printf("ERROR: %s (%d)\n", lgErrStr(h), h); return 1; } + if (h < 0) { printf("ERROR: %s (%d)\n", lguErrorText(h), h); return 1; } .br .br @@ -1776,7 +1776,7 @@ int main(int argc, char *argv[]) .br .br - if (e < 0) { printf("ERROR: %s (%d)\n", lgErrStr(e), e); return 1; } + if (e < 0) { printf("ERROR: %s (%d)\n", lguErrorText(e), e); return 1; } .br .br @@ -2135,7 +2135,7 @@ int main(int argc, char *argv[]) .br .br - if (h < 0) { printf("ERROR: %s (%d)\n", lgErrStr(h), h); return 1; } + if (h < 0) { printf("ERROR: %s (%d)\n", lguErrorText(h), h); return 1; } .br .br @@ -2147,7 +2147,7 @@ int main(int argc, char *argv[]) .br .br - if (e < 0) { printf("ERROR: %s (%d)\n", lgErrStr(e), e); return 1; } + if (e < 0) { printf("ERROR: %s (%d)\n", lguErrorText(e), e); return 1; } .br .br @@ -2281,7 +2281,7 @@ int main(int argc, char *argv[]) .br .br - if (h < 0) { printf("ERROR: %s (%d)\n", lgErrStr(h), h); return 1; } + if (h < 0) { printf("ERROR: %s (%d)\n", lguErrorText(h), h); return 1; } .br .br @@ -2375,9 +2375,9 @@ The notification pipes are created in the library working directory .br Pipe notifications for handle x will be available at the pipe -named lgd-nfy* (where * is the handle number). E.g. if the +named .lgd-nfy* (where * is the handle number). E.g. if the function returns 15 then the notifications must be read -from lgd-nfy15. +from .lgd-nfy15. .br @@ -2400,7 +2400,7 @@ if (h >= 0) .br { .br - sprintf(str, "lgd-nfy%d", h); + sprintf(str, ".lgd-nfy%d", h); .br .br @@ -4070,7 +4070,7 @@ If OK returns 0. .br On failure returns a negative error code. -.IP "\fBconst char *lgErrStr(int error)\fP" +.IP "\fBconst char *lguErrorText(int error)\fP" .IP "" 4 Returns the error text for an error code. diff --git a/lgpio.h b/lgpio.h index 8f50c8c..bba7fea 100644 --- a/lgpio.h +++ b/lgpio.h @@ -33,7 +33,7 @@ For more information, please refer to #include #include -#define LGPIO_VERSION 0x00000000 +#define LGPIO_VERSION 0x00010000 #define LG_CD "LG_CD" /* configuration directory */ #define LG_WD "LG_WD" /* working directory */ @@ -194,7 +194,7 @@ lguSleep Sleeps for a given time lguTimestamp Gets the current timestamp lguTime Gets the current time -lgErrStr Gets a text description of an error code +lguErrorText Gets a text description of an error code lguSetWorkDir Set the working directory lguGetWorkDir Get the working directory @@ -1157,11 +1157,11 @@ int main(int argc, char *argv[]) h = lgGpiochipOpen(0); // open /dev/gpiochip0 - if (h < 0) { printf("ERROR: %s (%d)\n", lgErrStr(h), h); return 1; } + if (h < 0) { printf("ERROR: %s (%d)\n", lguErrorText(h), h); return 1; } e = lgGroupClaimOutput(h, 0, 6, GPIO, levels); - if (e < 0) { printf("ERROR: %s (%d)\n", lgErrStr(e), e); return 1; } + if (e < 0) { printf("ERROR: %s (%d)\n", lguErrorText(e), e); return 1; } mask = 0; p = 0; @@ -1343,13 +1343,13 @@ int main(int argc, char *argv[]) h = lgGpiochipOpen(0); - if (h < 0) { printf("ERROR: %s (%d)\n", lgErrStr(h), h); return 1; } + if (h < 0) { printf("ERROR: %s (%d)\n", lguErrorText(h), h); return 1; } lgGpioSetAlertsFunc(h, GPIO, afunc, &userdata); e = lgGpioClaimAlert(h, 0, LG_BOTH_EDGES, 23, -1); - if (e < 0) { printf("ERROR: %s (%d)\n", lgErrStr(e), e); return 1; } + if (e < 0) { printf("ERROR: %s (%d)\n", lguErrorText(e), e); return 1; } lguSleep(10); @@ -1416,7 +1416,7 @@ int main(int argc, char *argv[]) h = lgGpiochipOpen(0); - if (h < 0) { printf("ERROR: %s (%d)\n", lgErrStr(h), h); return 1; } + if (h < 0) { printf("ERROR: %s (%d)\n", lguErrorText(h), h); return 1; } lgGpioSetSamplesFunc(afunc, &userdata); @@ -1472,9 +1472,9 @@ The notification pipes are created in the library working directory (see [*lguGetWorkDir*]). Pipe notifications for handle x will be available at the pipe -named lgd-nfy* (where * is the handle number). E.g. if the +named .lgd-nfy* (where * is the handle number). E.g. if the function returns 15 then the notifications must be read -from lgd-nfy15. +from .lgd-nfy15. Socket notifications are returned to the socket which requested the handle. @@ -1484,7 +1484,7 @@ h = lgNotifyOpen(); if (h >= 0) { - sprintf(str, "lgd-nfy%d", h); + sprintf(str, ".lgd-nfy%d", h); fd = open(str, O_RDONLY); @@ -2434,7 +2434,7 @@ On failure returns a negative error code. D*/ /*F*/ -const char *lgErrStr(int error); +const char *lguErrorText(int error); /*D Returns the error text for an error code. diff --git a/rgpio.3 b/rgpio.3 index 8562389..7107682 100644 --- a/rgpio.3 +++ b/rgpio.3 @@ -3153,9 +3153,9 @@ The notification pipes are created in the library working directory. .br Notifications for handle x will be available at the pipe -named lgd-nfyx (where x is the handle number). E.g. if the +named .lgd-nfyx (where x is the handle number). E.g. if the function returns 15 then the notifications must be -read from lgd-nfy15. +read from .lgd-nfy15. .br diff --git a/rgpio.c b/rgpio.c index 35c3e62..c5cca6a 100644 --- a/rgpio.c +++ b/rgpio.c @@ -1711,7 +1711,7 @@ uint32_t lgu_rgpio_version(void) const char *lgu_error_text(int errnum) { - if (errnum > -1000) return lgErrStr(errnum); + if (errnum > -1000) return lguErrorText(errnum); else { switch(errnum) diff --git a/rgpio.h b/rgpio.h index b863021..4833c63 100644 --- a/rgpio.h +++ b/rgpio.h @@ -33,7 +33,7 @@ For more information, please refer to #include "lgpio.h" -#define RGPIO_VERSION 0x00000100 +#define RGPIO_VERSION 0x00010000 /*TEXT @@ -1760,9 +1760,9 @@ should be used instead. The notification pipes are created in the library working directory. Notifications for handle x will be available at the pipe -named lgd-nfyx (where x is the handle number). E.g. if the +named .lgd-nfyx (where x is the handle number). E.g. if the function returns 15 then the notifications must be -read from lgd-nfy15. +read from .lgd-nfy15. Each notification occupies 16 bytes in the fifo and has the following structure. diff --git a/rgpiod.h b/rgpiod.h index 1ecf53b..06266e9 100644 --- a/rgpiod.h +++ b/rgpiod.h @@ -32,7 +32,7 @@ For more information, please refer to #include "lgCmd.h" -#define RGPIOD_VERSION 0x00000000 +#define RGPIOD_VERSION 0x00010000 #define LG_ENVPORT "LG_PORT" #define LG_ENVADDR "LG_ADDR" diff --git a/rgs.1 b/rgs.1 index 7c5aac0..2cb3f46 100644 --- a/rgs.1 +++ b/rgs.1 @@ -2168,12 +2168,12 @@ The pipes are created in the daemon's working directory (the command \fBpwd\fP will show the working directory). .br -Notifications for handle g will be available at the pipe named lgd-nfyx -(where g is the handle number). +Notifications for handle x will be available at the pipe named .lgd-nfyx +(where x is the handle number). .br E.g. if the command returns 15 then the notifications must be read -from lgd-nfy15. +from .lgd-nfy15. .br diff --git a/rgs.c b/rgs.c index 1372a46..d60ecab 100644 --- a/rgs.c +++ b/rgs.c @@ -49,7 +49,7 @@ This program provides a socket interface to some of the commands available from lg. */ -#define RGS_VERSION 0x00000000 +#define RGS_VERSION 0x00010000 #define RGS_CONNECT_ERR 255 #define RGS_OPTION_ERR 254 @@ -305,20 +305,20 @@ static void xShowResult(int rv, lgCmd_p cmdP, char *cmdExt) if (r < 0) { printf("%d\n", r); - xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); } break; case 2: printf("%d\n", r); - if (r < 0) xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + if (r < 0) xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); break; case 3: if (r < 0) { printf("%d\n", r); - xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); } else printf("%"PRIu64"\n", argQ[0]); break; @@ -343,7 +343,7 @@ static void xShowResult(int rv, lgCmd_p cmdP, char *cmdExt) } printf("%d", r); - if (r < 0) xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + if (r < 0) xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); if (r > 0) { if (printFlags == PRINT_ASCII) printf(" "); @@ -370,7 +370,7 @@ static void xShowResult(int rv, lgCmd_p cmdP, char *cmdExt) if (r != (4 + (4*LG_MAX_SCRIPT_PARAMS))) { printf("%d", r); - xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); } else { @@ -387,7 +387,7 @@ static void xShowResult(int rv, lgCmd_p cmdP, char *cmdExt) if (r < 0) { printf("%d\n", r); - xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); } else { @@ -399,7 +399,7 @@ static void xShowResult(int rv, lgCmd_p cmdP, char *cmdExt) if (r < 0) { printf("%d\n", r); - xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); } else { @@ -411,7 +411,7 @@ static void xShowResult(int rv, lgCmd_p cmdP, char *cmdExt) if (r < 0) { printf("%d\n", r); - xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); } else { @@ -422,7 +422,7 @@ static void xShowResult(int rv, lgCmd_p cmdP, char *cmdExt) default: printf("*** command=%d, status=%d\n", cmdP->cmd, r); - if (r < 0) xReport(RGS_SCRIPT_ERR, "ERROR: %s", lgErrStr(r)); + if (r < 0) xReport(RGS_SCRIPT_ERR, "ERROR: %s", lguErrorText(r)); break; } diff --git a/v0.0.4.3 b/v0.1.0.0 similarity index 100% rename from v0.0.4.3 rename to v0.1.0.0