Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makefile incorrectly set the flags for character device support #56

Open
fell-z opened this issue Sep 3, 2024 · 1 comment
Open

Makefile incorrectly set the flags for character device support #56

fell-z opened this issue Sep 3, 2024 · 1 comment

Comments

@fell-z
Copy link

fell-z commented Sep 3, 2024

Hey.

I had some issues using the lib via lua-periphery. After some digging of my own, I discovered that 'c-periphery' wasn't building with character device support, so I took a look at the Makefile and found a problem in the following line.

GPIO_CDEV_SUPPORT = $(if $(filter 1,$(GPIO_CDEV_V2_SUPPORT)),2,$(if $(filter 1,$(GPIO_CDEV_V1_SUPPORT)),1,0))

In those conditions, filter 1 should be filter 0 to work correctly.

@reeett
Copy link

reeett commented Sep 6, 2024

Hi @fell-z,
had the same problem writing a Makefile of lua-periphery for OpenWRT. Your suggestion fixed it for me too.

Thank you


Patchfile for OpenWRT 23.05.4

Index: lua-periphery-2.4.2/c-periphery/Makefile
===================================================================
--- lua-periphery-2.4.2.orig/c-periphery/Makefile
+++ lua-periphery-2.4.2/c-periphery/Makefile
@@ -12,7 +12,7 @@ OBJECTS = $(patsubst $(SRCDIR)/%.c,$(OBJ
 
 GPIO_CDEV_V1_SUPPORT := $(shell ! echo -e "#include <linux/gpio.h>\n#ifndef GPIO_GET_LINEEVENT_IOCTL\n#error\n#endif" | $(CC) -E - >/dev/null 2>&1; echo $$?)
 GPIO_CDEV_V2_SUPPORT := $(shell ! echo -e "#include <linux/gpio.h>\nint main(void) { GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME; return 0; }" | $(CC) -x c - >/dev/null 2>&1; echo $$?)
-GPIO_CDEV_SUPPORT = $(if $(filter 1,$(GPIO_CDEV_V2_SUPPORT)),2,$(if $(filter 1,$(GPIO_CDEV_V1_SUPPORT)),1,0))
+GPIO_CDEV_SUPPORT = $(if $(filter 0,$(GPIO_CDEV_V2_SUPPORT)),2,$(if $(filter 0,$(GPIO_CDEV_V1_SUPPORT)),1,0))
 
 COMMIT_ID := $(shell git describe --abbrev --always --tags --dirty 2>/dev/null || echo "")
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants