om26er
July 15, 2017, 11:21pm
1
Hi!
I have a project which is packaged as a snap. I need to get the snapcraft.yaml in that project reviewed, mostly I have a few questions that I have added in that file.
question 1: Can I access RasbperryPi GPIO in a confined snap ?
reference: https://github.com/om26er/wamp-pigpio/blob/ce3503a745ac9924e7306a9dc7243a2e56f56424/snap/snapcraft.yaml#L8
question 2: I had to export PYTHONPATH in the snap environment for my code to actually work, am I doing something wrong ?
reference: https://github.com/om26er/wamp-pigpio/blob/ce3503a745ac9924e7306a9dc7243a2e56f56424/snap/snapcraft.yaml#L18
question 3: How to have a configure hook without a plug ?
reference: https://github.com/om26er/wamp-pigpio/blob/ce3503a745ac9924e7306a9dc7243a2e56f56424/snap/snapcraft.yaml#L41
ogra
July 17, 2017, 12:41pm
3
In all images except for the stable channel we have:
ogra@pi3:~$ snap interfaces|grep gpio
pi3:bcm-gpio-0 -
pi3:bcm-gpio-1 -
pi3:bcm-gpio-10 -
pi3:bcm-gpio-11 -
pi3:bcm-gpio-12 -
pi3:bcm-gpio-13 -
pi3:bcm-gpio-14 -
pi3:bcm-gpio-15 -
pi3:bcm-gpio-16 -
pi3:bcm-gpio-17 -
pi3:bcm-gpio-18 -
pi3:bcm-gpio-19 -
pi3:bcm-gpio-2 -
pi3:bcm-gpio-20 -
pi3:bcm-gpio-21 -
pi3:bcm-gpio-22 -
pi3:bcm-gpio-23 -
pi3:bcm-gpio-24 -
pi3:bcm-gpio-25 -
pi3:bcm-gpio-26 -
pi3:bcm-gpio-27 -
pi3:bcm-gpio-3 -
pi3:bcm-gpio-4 -
pi3:bcm-gpio-5 -
pi3:bcm-gpio-6 -
pi3:bcm-gpio-7 -
pi3:bcm-gpio-8 -
pi3:bcm-gpio-9 -
This will land in stable once gadget updates are properly implemented. For now use a beta, edge or candidate image to access RasbperryPi GPIO interfaces. The naming of the interfaces follows the mapping of https://pinout.xyz/#
On 2, PYTHONPATH
should not be needed, it is dynamically assessed from the python being called in shebang which in your case it is hardcoded to #!/usr/bin/python3
and since the runner
part is not driven by the python plugin it does not get adapted appropriately.
That said, that part shouldn’t really be needed if in setup.py
you used either a scripts
entry or moved to console_scripts/entry_points
.
om26er
July 17, 2017, 10:02pm
5
Seems that was it, I had to change my setup.py and I was able to remove the export of PYTHONPATH.
om26er
July 23, 2017, 4:27pm
6
Is that interface also available on Raspberrry Pi 2 ? I just flashed the candidate image from http://cdimage.ubuntu.com/ubuntu-core/16/candidate/current/ then ran snap refresh
but still the interfaces that I see are:
om26er@localhost:~$ snap interfaces
Slot Plug
:account-control -
:alsa -
:autopilot-introspection -
:bluetooth-control -
:browser-support -
:camera -
:classic-support -
:core-support core:core-support-plug
:dcdbas-control -
:docker-support -
:firewall-control -
:framebuffer -
:fuse-support -
:hardware-observe -
:hardware-random-control -
:hardware-random-observe -
:home -
:io-ports-control -
:joystick -
:kernel-module-control -
:kubernetes-support -
:log-observe -
:lxd-support -
:mount-observe -
:netlink-audit -
:netlink-connector -
:network -
:network-bind -
:network-control -
:network-observe -
:network-setup-control -
:network-setup-observe -
:opengl -
:openvswitch-support -
:physical-memory-control -
:physical-memory-observe -
:ppp -
:process-control -
:raw-usb -
:removable-media -
:shutdown -
:snapd-control -
:system-observe -
:system-trace -
:time-control -
:timeserver-control -
:timezone-control -
:tpm -
:uhid -
ogra
July 24, 2017, 10:17am
7