Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
interfaces/builtin: use udev to export GPIOs to userspace #2065
Conversation
|
@jocave can you test this to ensure that it really works in practice please? |
jocave
suggested changes
Oct 3, 2016
Tested, but found the action in RUN wasn't applied. See inline comments for what I found works.
| + case interfaces.SecurityUDev: | ||
| + // NOTE: nothing unexports this GPIO when the slot is disconnected but | ||
| + // AFAIK this doesn't hurt. | ||
| + snippet := fmt.Sprintf(`ACTION=="add", SUBSYSTEM=="gpio", RUN+="/bin/echo %v > /syc/class/gpio/export"`, slot.Attrs["number"]) |
jocave
Oct 3, 2016
Contributor
This doesn't work - you need to pass it to a shell e.g.:
RUN+="/bin/sh -c '/bin/echo 346 > /sys/class/gpio/export'"
| + plug := s.gadgetPlug | ||
| + content, err := s.iface.ConnectedSlotSnippet(plug, slot, interfaces.SecurityUDev) | ||
| + c.Assert(err, IsNil) | ||
| + expected := `ACTION=="add", SUBSYSTEM=="gpio", RUN+="/bin/echo 100 > /syc/class/gpio/export"` |
|
Testing note: just calling a "udevadm trigger" only creates "change" events so the rules used here are not run. "udevadm trigger -c add" causes them to be invoked Does this mean the rule needs to be changed or are we ok with "add"? |
|
Can you do a quick test to see what happens after reboot (it should be exported with your changed RUN line). As for |
niemeyer
approved these changes
Oct 3, 2016
LGTM assuming it actually works. Leaving that to @jocave to review.
niemeyer
added
the
Reviewed
label
Oct 3, 2016
|
We need to discuss this to see how to approach the problem. Let's work on it together next week. |
niemeyer
added
the
Blocked
label
Oct 5, 2016
zyga
closed this
Nov 15, 2016
|
This was actually implemented and landed as systemd-based job |
zyga commentedOct 3, 2016
This patch changes the GPIO interface to use udev for exporting devices
to userspace.
Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com