top of page
Writer's pictureMehrdad Majzoobi

Hello Kernel 6.6 - Avoiding the Dependency Hell

Raspberry Pi OS recent upgrade to Kernel v6.6 (from 6.1) and Introduction of Pi 5 has resurfaced some of the old wounds from similarly fought battles. So many things can break (and are breaking) on the driver / kernel side. 



This can break so many applications that rely on such low level abstractions. 


Before we look into one very specific issue regarding GPIO, My ultimate goal is to address this problem and other similar problems from a DevOps standpoint with the Ubo Project such that applications can self-heal and automatically migrate. If you have any suggestions to address such migrations, please comment below or send me a DM. 


Okay, enough.


So what the hell is happening with GPIO breaking on Kernel 6.6. Basically this is happening only to the RPi.GPIO library which has been the go-to choice for many folks using GPIO in their applications. On Kernel 6.6, RPI.GPIO is deprecated and instead gpiozero and gpiod is recommended. I am only going to cover gpiozero since it is recommended by Raspberry Pi.


So basically you have to update your application code to use the new libraries. You should checkout each tool documentation but in essence you need to replace these lines:


From:

import RPi.GPIO as GPIO

GPIO.setmode(GPIO.BCM)
GPIO.setup(5, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.add_event_detect(INT_EXPANPER,
					GPIO.FALLING,
					callback=foo,
					bouncetime=1)

To:

from gpiozero import Button
btn = Button(5)
btn.when_pressed=foo
// btn.when_released=foo for GPIO.RISING

Would it be wonderful if your code could automatically make this change for you, build and test it, and make a release candidate? 


Other notes:


  • Most of these changes are intended to Support Pi 5 since it uses a new chip (RP1) to handle most of the IO work. Once these changes are settled your software will be well supported on Pi 4 and I guess the older versions as long as you can run the latest OS on it. 

  • This type of issue is quite common in audio as well. I2C and SPI have been quite resilient to changes due to their simplicity I believe.

52 views0 comments

Comments


bottom of page