pi-top / pi-topd

pi-top System Daemon (formerly pt-device-manager)
6 stars 4 forks source link

Handle unexpected changes to SPI bus #158

Closed jcapona closed 2 years ago

jcapona commented 2 years ago
Status Ticket/Issue
Ready/Hold Ticket

Main changes

This PR implements a workaround for the bug that changes the SPI bus in the hub of a pi-top[4] by making sure that the only valid way to change the SPI bus used by the OLED is through pi-topd, rolling back any changes to it if done any other way.

Basically:

Screenshots (feature, test output, profiling, dev tools etc)

N/A

Other notes (e.g. implementation quirks, edge cases, questions / issues)

-

Manual testing tips

To reproduce the bug, we can write values directly into the hub using the SDK.

Steps:

i2c_device = I2CDevice("/dev/i2c-1", 0x11) i2c_device.set_delays(0.001, 0.001) i2c_device.connect()

OLED uses SPI bus 0

i2c_device.write_byte(0x14, 0b101)


- Check the SPI bus again using the CLI: `pi-top oled spi` should return `1`, since writing to the register directly is not a valid way to set the SPI bus.

#### Tag anyone who definitely needs to review or help
-