我对 GPIO 产生了奇怪的影响。
我们使用的是基于英特尔的单板迷你电脑,也配备了一些 GPIO。由于我们在它们上面使用的是 Ubuntu MATE 20.04,因此通过 sysfs 的 GPIO 开箱即用。
现在,升级到 Ubuntu MATE 22.04 后,似乎 GPIO 的编号已经发生了变化。
为了确保该问题不是由某些配置或额外安装的软件包引起的,我通过启动两个不同的实时 USB 棒来重现该问题。一个装有 Ubuntu MATE 20.04,另一个装有 Ubuntu MATE 22.04
Ubuntu MATE 20.04-内核 5.4.0-104-generic
/sys/class/gpio# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
/sys/class/gpio# uname -r
5.4.0-104-generic
/sys/class/gpio# ll
total 0
--w------- 1 root root 4096 Aug 10 12:13 export
lrwxrwxrwx 1 root root 0 Aug 10 12:13 gpiochip267 -> ../../devices/platform/INT3452:03/gpio/gpiochip267
lrwxrwxrwx 1 root root 0 Aug 10 12:13 gpiochip310 -> ../../devices/platform/INT3452:02/gpio/gpiochip310
lrwxrwxrwx 1 root root 0 Aug 10 12:13 gpiochip357 -> ../../devices/platform/INT3452:01/gpio/gpiochip357
lrwxrwxrwx 1 root root 0 Aug 10 12:13 gpiochip434 -> ../../devices/platform/INT3452:00/gpio/gpiochip434
--w------- 1 root root 4096 Aug 10 15:06 unexport
Ubuntu MATE 22.04-内核 5.15.0-41-generic
/sys/class/gpio# lsb_release
No LSB modules are available.
root@tox-hmi3:/sys/class/gpio# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04 LTS
Release: 22.04
Codename: jammy
/sys/class/gpio# uname -r
5.15.0-41-generic
/sys/class/gpio# ll
total 0
--w------- 1 root root 4096 Aug 10 14:42 export
lrwxrwxrwx 1 root root 0 Aug 10 14:42 gpiochip779 -> ../../devices/platform/INT3452:03/gpio/gpiochip779
lrwxrwxrwx 1 root root 0 Aug 10 14:42 gpiochip822 -> ../../devices/platform/INT3452:02/gpio/gpiochip822
lrwxrwxrwx 1 root root 0 Aug 10 14:42 gpiochip869 -> ../../devices/platform/INT3452:01/gpio/gpiochip869
lrwxrwxrwx 1 root root 0 Aug 10 14:42 gpiochip946 -> ../../devices/platform/INT3452:00/gpio/gpiochip946
--w------- 1 root root 4096 Aug 10 14:42 unexport
导出 PIN 码似乎仍然有效,但当然不再使用以前存在的号码。
/sys/class/gpio# echo 404 > export
bash: echo: write error: Invalid argument
/sys/class/gpio# echo 869 > export
root@tox-hmi3:/sys/class/gpio# ls
export gpio869 gpiochip779 gpiochip822 gpiochip869 gpiochip946 unexport
但是,现在我不知道我的 PIN 码被移到哪里了。
内核版本 5.4 和 5.15 之间发生了什么变化,导致 GPIO 检测产生不同的编号?