From 1c4e560de48a54a1039d4043c951f84a4a8cf642 Mon Sep 17 00:00:00 2001 From: Jorge Capona Date: Fri, 19 Jul 2024 14:37:15 -0400 Subject: [PATCH] Don't set SPI bus cshigh on v1 hub --- pitopd/pthub/pthub_spi.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/pitopd/pthub/pthub_spi.py b/pitopd/pthub/pthub_spi.py index ad0397e..5e85cab 100644 --- a/pitopd/pthub/pthub_spi.py +++ b/pitopd/pthub/pthub_spi.py @@ -2,8 +2,6 @@ import threading import traceback from enum import Enum -from platform import uname -from re import match from time import sleep from pitop.common.common_ids import DeviceID @@ -221,7 +219,6 @@ def _setup_spi(self): self.spi.max_speed_hz = 9600 self.spi.mode = 0b00 self.spi.bits_per_word = 8 - self.spi.cshigh = True self.spi.lsbfirst = False def _determine_byte(self, resp): @@ -300,12 +297,6 @@ def _process_spi_resp(self, resp, init=False): if init or not screen_is_blanked: self._state.set_brightness(spi_brightness_int, False) - def __using_old_kernel(self): - # check if kernel version is lower than "5.0.0" - # to avoid errors when setting cshigh - # https://github.com/raspberrypi/linux/issues/3745 - return match(r"^[0-4]\.", uname().release) is not None - def _transceive_spi(self, bits_to_send): hex_str_to_send = "0x" + str(hex(bits_to_send))[2:].zfill(2) bin_str_to_send = "{0:b}".format(int(hex_str_to_send[2:], 16)).zfill(8) @@ -331,12 +322,8 @@ def _transceive_spi(self, bits_to_send): + "]" ) - if self.__using_old_kernel(): - # Initiate receiving communication from hub - self.spi.cshigh = False # Transfer data with hub resp = self.spi.xfer2([bits_to_send], self.spi.max_speed_hz) - self.spi.cshigh = True resp_hex = hex(resp[0]) resp_hex_str = "0x" + str(resp_hex)[2:].zfill(2)