Skip to content

Commit

Permalink
Changed lgErrStr to lguErrorText
Browse files Browse the repository at this point in the history
Changed notify pipes from lgd-nfyx to .lgd-nfyx
Altered list of commands which may be executed by scripts.
  • Loading branch information
joan2937 committed Nov 20, 2020
1 parent 8ada8c3 commit aabd28f
Show file tree
Hide file tree
Showing 23 changed files with 78 additions and 78 deletions.
Binary file modified DOC/dbase/lg.sqlite
Binary file not shown.
4 changes: 2 additions & 2 deletions DOC/src/defs/examples.def
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions DOC/src/defs/rgs.def
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions EXAMPLES/lgpio/monitor.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
monitor.c
2020-11-18
2020-11-20
Public Domain
http://abyz.me.uk/lg/lgpio.html
Expand Down Expand Up @@ -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;
}
}
Expand Down
8 changes: 4 additions & 4 deletions EXAMPLES/lgpio/rotary_encoder.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
rotary_encoder.c
2020-11-18
2020-11-20
Public Domain
http://abyz.me.uk/lg/lgpio.html
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down
8 changes: 4 additions & 4 deletions EXAMPLES/lgpio/sonar_ranger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions PY_LGPIO/lgpio.i
Original file line number Diff line number Diff line change
Expand Up @@ -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);

8 changes: 4 additions & 4 deletions PY_LGPIO/lgpio_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import threading
import time

LGPIO_PY_VERSION = 0x00000000
LGPIO_PY_VERSION = 0x00010000

exceptions = True

Expand Down Expand Up @@ -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 = []
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion PY_LGPIO/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
Expand Down
8 changes: 4 additions & 4 deletions PY_RGPIO/rgpio.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
import atexit
import hashlib

RGPIO_PY_VERSION = 0x00000300
RGPIO_PY_VERSION = 0x00010000

exceptions = True

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion PY_RGPIO/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]',
Expand Down
14 changes: 7 additions & 7 deletions lgCmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lgErr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion lgNotify.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
20 changes: 10 additions & 10 deletions lgpio.3
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1768,15 +1768,15 @@ 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
e = lgGroupClaimOutput(h, 0, 6, GPIO, levels);
.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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -2400,7 +2400,7 @@ if (h >= 0)
.br
{
.br
sprintf(str, "lgd-nfy%d", h);
sprintf(str, ".lgd-nfy%d", h);
.br
.br
Expand Down Expand Up @@ -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.

Expand Down
Loading

0 comments on commit aabd28f

Please sign in to comment.