golemparts / rppal

A Rust library that provides access to the Raspberry Pi's GPIO, I2C, PWM, SPI and UART peripherals.
MIT License
1.21k stars 96 forks source link

Add patches to full support "Raspberry PI W2 2021". #132

Closed denisandroid closed 10 months ago

denisandroid commented 10 months ago

Previously, "Archlinux ARM" images worked fine with your library and identified themselves correctly. With the advent of a distribution update, the operation of your library was disrupted.

According to the new changes to the device tree, devices now identify themselves as "raspberry pi,model-zero-2-w" and there is only one option in your library: "raspberry pi,model-zero-2". (see current rpios dts file)

Also, here's some debugging:

new_archarm current (0.15.0, Archlinux ARM, W2 2021): [src/model.rs:173] &hardware[..] = "" [src/model.rs:174] &revision[..] = "902120" [src/model.rs:244] comp_id = "raspberrypi,model-zero-2-w" [src/model.rs:244] comp_id = "brcm,bcm2837" [src/model.rs:244] comp_id = "" [src/model.rs:292] &base_model = "Raspberry Pi Zero 2 W Rev 1.0" [src/model.rs:304] &base_model[..] = "Raspberry Pi Zero 2 W" cdevice: Err(UnknownModel) <<

old_archarm (0.15.0, Archlinux ARM, W2 2021): [src/model.rs:173] &hardware[..] = "BCM2835" [src/model.rs:174] &revision[..] = "902120" [src/model.rs:205] revision_type = 18 cdevice: Ok(DeviceInfo { model: RaspberryPiZero2W, soc: Bcm2837A1, peripheral_base: 1056964608, gpio_offset: 2097152, gpio_lines: 54, gpio_interface: Bcm }) <<

current (0.15.0, Archlinux ARM, RPI3): [src/model.rs:173] &hardware[..] = "" [src/model.rs:174] &revision[..] = "a02082" [src/model.rs:244] comp_id = "raspberrypi,3-model-b" cdevice: Ok(DeviceInfo { model: RaspberryPi3B, soc: Bcm2837A1, peripheral_base: 1056964608, gpio_offset: 2097152, gpio_lines: 54, gpio_interface: Bcm })

next (my_fork, Archlinux ARM, W2 2021): [src/model.rs:173] &hardware[..] = "" [src/model.rs:174] &revision[..] = "902120" [src/model.rs:244] comp_id = "raspberrypi,model-zero-2-w" [src/model.rs:244] comp_id = "brcm,bcm2837" [src/model.rs:244] comp_id = "" [src/model.rs:293] &base_model = "Raspberry Pi Zero 2 W Rev 1.0" [src/model.rs:305] &base_model[..] = "Raspberry Pi Zero 2 W" cdevice: Ok(DeviceInfo { model: RaspberryPiZero2W, soc: Bcm2837A1, peripheral_base: 1056964608, gpio_offset: 2097152, gpio_lines: 54, gpio_interface: Bcm })

golemparts commented 10 months ago

Thanks for the PR! It's good to see the alternative identification functions are still useful for other distros.