mirror of https://github.com/joan2937/pigpio
Include for issue #188 and ignore various errors
This commit is contained in:
parent
59f63d832a
commit
73ade1954b
33
pigpio.c
33
pigpio.c
|
@ -55,6 +55,7 @@ For more information, please refer to <http://unlicense.org/>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <sys/sysmacros.h>
|
||||||
#include <netinet/tcp.h>
|
#include <netinet/tcp.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/select.h>
|
#include <sys/select.h>
|
||||||
|
@ -3977,8 +3978,8 @@ int i2cOpen(unsigned i2cBus, unsigned i2cAddr, unsigned i2cFlags)
|
||||||
{
|
{
|
||||||
/* try a modprobe */
|
/* try a modprobe */
|
||||||
|
|
||||||
system("/sbin/modprobe i2c_dev");
|
if (system("/sbin/modprobe i2c_dev") == -1) { /* ignore errors */}
|
||||||
system("/sbin/modprobe i2c_bcm2835");
|
if (system("/sbin/modprobe i2c_bcm2835") == -1) { /* ignore errors */}
|
||||||
|
|
||||||
myGpioDelay(100000);
|
myGpioDelay(100000);
|
||||||
|
|
||||||
|
@ -4040,7 +4041,14 @@ void i2cSwitchCombined(int setting)
|
||||||
|
|
||||||
if (fd >= 0)
|
if (fd >= 0)
|
||||||
{
|
{
|
||||||
if (setting) write(fd, "1\n", 2); else write(fd, "0\n", 2);
|
if (setting)
|
||||||
|
{
|
||||||
|
if (write(fd, "1\n", 2) == -1) { /* ignore errors */ }
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (write(fd, "0\n", 2) == -1) { /* ignore errors */ }
|
||||||
|
}
|
||||||
|
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
@ -6765,7 +6773,7 @@ static void * pthTimerTick(void *x)
|
||||||
tp->id,
|
tp->id,
|
||||||
(unsigned)tp->nextTick.tv_sec,
|
(unsigned)tp->nextTick.tv_sec,
|
||||||
(unsigned)tp->nextTick.tv_nsec);
|
(unsigned)tp->nextTick.tv_nsec);
|
||||||
fprintf(stderr, buf);
|
fprintf(stderr, "%s", buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6856,7 +6864,7 @@ static void * pthFifoThread(void *x)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
fprintf(outFifo, cmdUsage);
|
fprintf(outFifo, "%s", cmdUsage);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
|
@ -6976,7 +6984,7 @@ static void *pthSocketThreadHandler(void *fdC)
|
||||||
p[3] = myDoCommand(p, sizeof(buf)-1, buf);
|
p[3] = myDoCommand(p, sizeof(buf)-1, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
write(sock, p, 16);
|
if (write(sock, p, 16) == -1) { /* ignore errors */ }
|
||||||
|
|
||||||
switch (p[0])
|
switch (p[0])
|
||||||
{
|
{
|
||||||
|
@ -7001,7 +7009,7 @@ static void *pthSocketThreadHandler(void *fdC)
|
||||||
|
|
||||||
if (((int)p[3]) > 0)
|
if (((int)p[3]) > 0)
|
||||||
{
|
{
|
||||||
write(sock, buf, p[3]);
|
if (write(sock, buf, p[3]) == 1) { /* ignore errors */ }
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -7153,7 +7161,10 @@ static int initGrabLockFile(void)
|
||||||
{
|
{
|
||||||
sprintf(pidStr, "%d\n", (int)getpid());
|
sprintf(pidStr, "%d\n", (int)getpid());
|
||||||
|
|
||||||
write(fd, pidStr, strlen(pidStr));
|
if (write(fd, pidStr, strlen(pidStr)) == -1)
|
||||||
|
{
|
||||||
|
/* ignore errors */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -11355,7 +11366,7 @@ static void *pthISRThread(void *x)
|
||||||
pfd.events = POLLPRI;
|
pfd.events = POLLPRI;
|
||||||
|
|
||||||
lseek(fd, 0, SEEK_SET); /* consume any prior interrupt */
|
lseek(fd, 0, SEEK_SET); /* consume any prior interrupt */
|
||||||
read(fd, buf, sizeof buf);
|
if (read(fd, buf, sizeof buf) == -1) { /* ignore errors */ }
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
|
@ -11368,7 +11379,7 @@ static void *pthISRThread(void *x)
|
||||||
if (retval >= 0)
|
if (retval >= 0)
|
||||||
{
|
{
|
||||||
lseek(fd, 0, SEEK_SET); /* consume interrupt */
|
lseek(fd, 0, SEEK_SET); /* consume interrupt */
|
||||||
read(fd, buf, sizeof buf);
|
if (read(fd, buf, sizeof buf) == -1) { /* ignore errors */ }
|
||||||
|
|
||||||
if (retval)
|
if (retval)
|
||||||
{
|
{
|
||||||
|
@ -12750,7 +12761,7 @@ int fileApprove(char *filename)
|
||||||
char match[PI_MAX_PATH];
|
char match[PI_MAX_PATH];
|
||||||
char buffer[PI_MAX_PATH];
|
char buffer[PI_MAX_PATH];
|
||||||
char line[PI_MAX_PATH];
|
char line[PI_MAX_PATH];
|
||||||
char mperm;
|
char mperm=0;
|
||||||
char perm;
|
char perm;
|
||||||
char term;
|
char term;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
Loading…
Reference in New Issue