From b99a538aeea2a1ab5d3cef5cc3279115ed936fe5 Mon Sep 17 00:00:00 2001 From: Dawid Sabat Date: Fri, 18 Sep 2020 23:28:18 +0200 Subject: [PATCH] Modify pigpio_start arguments --- pigpiod_if2.c | 4 ++-- pigpiod_if2.h | 2 +- x_pigpiod_if2.c | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pigpiod_if2.c b/pigpiod_if2.c index ab2ef10..64b0d15 100644 --- a/pigpiod_if2.c +++ b/pigpiod_if2.c @@ -234,7 +234,7 @@ static int pigpio_command_ext return cmd.res; } -static int pigpioOpenSocket(char *addrStr, char *portStr) +static int pigpioOpenSocket(const char *addrStr, const char *portStr) { int sock, err, opt; struct addrinfo hints, *res, *rp; @@ -685,7 +685,7 @@ void stop_thread(pthread_t *pth) } } -int pigpio_start(char *addrStr, char *portStr) +int pigpio_start(const char *addrStr, const char *portStr) { int pi; int *userdata; diff --git a/pigpiod_if2.h b/pigpiod_if2.h index 9700cc0..4e3314d 100644 --- a/pigpiod_if2.h +++ b/pigpiod_if2.h @@ -429,7 +429,7 @@ The thread to be stopped should have been started with [*start_thread*]. D*/ /*F*/ -int pigpio_start(char *addrStr, char *portStr); +int pigpio_start(const char *addrStr, const char *portStr); /*D Connect to the pigpio daemon. Reserving command and notification streams. diff --git a/x_pigpiod_if2.c b/x_pigpiod_if2.c index c9b2c27..9422aee 100644 --- a/x_pigpiod_if2.c +++ b/x_pigpiod_if2.c @@ -77,6 +77,10 @@ void t1(int pi) gpio_write(pi, GPIO, PI_HIGH); v = gpio_read(pi, GPIO); CHECK(1, 6, v, 1, 0, "write, read"); + + v = pigpio_start(PI_DEFAULT_SOCKET_ADDR_STR, PI_DEFAULT_SOCKET_PORT_STR); + CHECK(1, 7, v, 31, 100, "pigpio_start with non-default arguments"); + pigpio_stop(v); } int t2_count=0;