DBus daemon: Managing requests #116
Answered
by
brgl
o-alquimista
asked this question in
Q&A
-
I'm using the DBus daemon through From my understanding, we're supposed to make a request and store its name for later reuse. request=$(gpiocli request --output --chip="$chip" "$line")
# request0
gpiocli set --request="$request" "$line"=active I can think of two different solutions:
The latter seems neater. Here's how I did it: gpiocli requests
# request0 (gpiochip0) Offsets: [18]
request=$(gpiocli requests | grep "$chip" | grep "$line")
if [ $? -ne 0 ]; then
# Make a new request
gpiocli request --output --chip="$chip" "$line"
else
# Reuse existing request
request=$(echo "$request" | awk '{print $1}')
fi Is this good? Or should I not be afraid of creating files in libgpiod v2.2 |
Beta Was this translation helpful? Give feedback.
Answered by
brgl
Dec 6, 2024
Replies: 1 comment
-
Yes, that's why |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
o-alquimista
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, that's why
gpiocli requests
is there. Instead of parsing its output you may also usegdbus
to inspect the properties of the request object directly if your system has it.