Make RPi.GPIO work on arm64

Bug #1814118 reported by Dave Jones
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
rpi.gpio (Ubuntu)
Fix Released
Low
Unassigned
Bionic
Fix Released
Medium
Unassigned
Cosmic
Won't Fix
Low
Unassigned

Bug Description

[Impact]

 * RPi.GPIO currently does not work under arm64 kernels, simply due to hardware revision detection being slightly different.
 * The patched version operates as expected under both armhf and arm64 kernels by querying /proc/device-tree/system/linux,revision (a file that exists on modern armhf and arm64 kernels), falling back to /proc/cpuinfo (the former detection method, primarily to continue supporting any older armhf kernels).
 * This will also bump the version from 0.6.3 to 0.6.5 on bionic/cosmic. This fixes several nasty bugs around PWM handling and event detection. These issues didn't affect short-term experimentation with the library, but do affect long-running deployments (memory leak in PWM allocation, and a race-condition in setting up pin event detection).

[Test Case]

 * On an arm64 kernel:
 * Install present version of python3-rpi.gpio (0.6.3-1ubuntu4)
 * Under python3 "from RPi import GPIO"
 * Present version returns RuntimeError: This module can only be run on a Raspberry Pi
 * Upgrade to proposed version (0.6.5-1ubuntu1)
 * Under python3 "from RPi import GPIO"
 * This should succeed
 * Run test cases under test/ (note: external wiring/components required; check source header for requirements)
 * Repeat procedure with armhf kernel to ensure no regression

[Regression Potential]

 * On armhf kernels: low; the existing detection pathway is maintained for ancient kernels lacking /proc/device-tree/system/linux but modern armhf kernels appear to have this file anyway and work with the new detection code. The new version is also operating happily upstream in Raspbian stretch.
 * On arm64 kernels: none; the existing version simply fails to import anyway

Mathew Hodson (mhodson)
Changed in rpi.gpio (Ubuntu):
importance: Undecided → Low
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

The package looks good and I guess I'll just sponsor it as is. For a moment I was wondering about proposing a small change to the relevant patch: since currently when we're able to open /proc/device-tree/system/linux,revision but are not able to read the contents, the patch forces an error. Was thinking that maybe we should fall-back to the cpuinfo check in this case as well. But then, I suppose that if the linux,revision is openable but unreadable, that's actually a bug and maybe one should actually error out. Besides, this might make the code less clean as for handling an edge-case. Might be worth considering, but I now lean towards just releasing this to disco as-is.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Sponsored.

Changed in rpi.gpio (Ubuntu):
status: New → Fix Committed
Dave Jones (waveform)
description: updated
Revision history for this message
Dave Jones (waveform) wrote :

SRU: debdiff from current bionic (0.6.3-1ubuntu5) to disco (0.6.5-1ubuntu1) attached.

Revision history for this message
Simon Quigley (tsimonq2) wrote :

Subscribing Łukasz, he sponsored this the last time and is also on the SRU Team (so he can examine its suitability for a stable release).

Thanks for your work on this!

Mathew Hodson (mhodson)
Changed in rpi.gpio (Ubuntu Bionic):
importance: Undecided → Low
Changed in rpi.gpio (Ubuntu Cosmic):
importance: Undecided → Low
Mathew Hodson (mhodson)
Changed in rpi.gpio (Ubuntu):
status: Fix Committed → Fix Released
Changed in rpi.gpio (Ubuntu Bionic):
importance: Low → Medium
Changed in rpi.gpio (Ubuntu Cosmic):
status: New → Won't Fix
Changed in rpi.gpio (Ubuntu Bionic):
status: New → In Progress
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

I have sponsored the backport to bionic, since even though this is certainly not a priority, we do support arm64 on Pi3 officially for this series - so it would be good to have things working there.

I'm setting the cosmic task as invalid because we do not provide cosmic arm64 pi3 images (at all).

Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Dave, or anyone else affected,

Accepted rpi.gpio into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rpi.gpio/0.6.5-1ubuntu0.18.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in rpi.gpio (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic
Revision history for this message
Brian Murray (brian-murray) wrote : [rpi.gpio/bionic] verification still needed

The fix for this bug has been awaiting testing feedback in the -proposed repository for bionic for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now, the package will be removed from the -proposed repository.

tags: added: removal-candidate
Revision history for this message
Andres A (andresa007) wrote :

These two packages were tested on Ubuntu 18.04 for armhf in a Raspberry Pi 3b

rpi.gpio-common_0.6.5-1ubuntu1_armhf.deb
python-rpi.gpio_0.6.5-1ubuntu1_armhf.deb

They solved the issue presented when testing with rpi.gpio and gpiozero.

Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Excellent, thank you for the verification. Let me adjust the tags and release (the tags need to be set as otherwise we could not see that the fix has been verified).

tags: added: verification-done verification-done-bionic
removed: removal-candidate verification-needed verification-needed-bionic
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for rpi.gpio has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package rpi.gpio - 0.6.5-1ubuntu0.18.04.1

---------------
rpi.gpio (0.6.5-1ubuntu0.18.04.1) bionic; urgency=medium

  * Added d/p/fix-revision-on-aarch64.patch to permit usage of the module
    on aarch64 based distros.
  * Fix filename on d/rpi.gpio-common.docs
  * Backport to bionic (LP: #1814118)

 -- Dave Jones <email address hidden> Tue, 22 Jan 2019 15:26:28 +0000

Changed in rpi.gpio (Ubuntu Bionic):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.