Skip to content

Commit 478b164

Browse files
authored
Merge pull request #20 from makermelissa/main
Added kernel userspace mismatch check and updated pre-commit config
2 parents 3b6984a + 205d2fa commit 478b164

File tree

2 files changed

+51
-11
lines changed

2 files changed

+51
-11
lines changed

.pre-commit-config.yaml

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,40 @@
33
# SPDX-License-Identifier: Unlicense
44

55
repos:
6-
- repo: https://github.com/python/black
7-
rev: 22.3.0
6+
- repo: https://github.com/python/black
7+
rev: 23.3.0
88
hooks:
9-
- id: black
10-
- repo: https://github.com/fsfe/reuse-tool
11-
rev: v0.12.1
9+
- id: black
10+
- repo: https://github.com/fsfe/reuse-tool
11+
rev: v1.1.2
1212
hooks:
13-
- id: reuse
14-
- repo: https://github.com/pre-commit/pre-commit-hooks
15-
rev: v4.0.1
13+
- id: reuse
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.4.0
1616
hooks:
17-
- id: check-yaml
18-
- id: end-of-file-fixer
19-
- id: trailing-whitespace
17+
- id: check-yaml
18+
- id: end-of-file-fixer
19+
- id: trailing-whitespace
20+
- repo: https://github.com/pycqa/pylint
21+
rev: v2.17.4
22+
hooks:
23+
- id: pylint
24+
name: pylint (library code)
25+
types: [python]
26+
args:
27+
- --disable=consider-using-f-string
28+
exclude: "^(docs/|examples/|tests/|setup.py$)"
29+
- id: pylint
30+
name: pylint (example code)
31+
description: Run pylint rules on "examples/*.py" files
32+
types: [python]
33+
files: "^examples/"
34+
args:
35+
- --disable=missing-docstring,invalid-name,consider-using-f-string,duplicate-code
36+
- id: pylint
37+
name: pylint (test code)
38+
description: Run pylint rules on "tests/*.py" files
39+
types: [python]
40+
files: "^tests/"
41+
args:
42+
- --disable=missing-docstring,consider-using-f-string,duplicate-code

adafruit_shell.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
__version__ = "0.0.0-auto.0"
3737
__repo__ = "https://github.com/adafruit/Adafruit_Python_Shell.git"
3838

39+
3940
# pylint: disable=too-many-public-methods
4041
class Shell:
4142
"""
@@ -563,6 +564,22 @@ def check_kernel_update_reboot_required(self):
563564
)
564565
self.prompt_reboot()
565566

567+
def check_kernel_userspace_mismatch(self):
568+
"""
569+
Check if the userspace is 64-bit and kernel is 32-bit
570+
"""
571+
if self.is_arm64() and platform.architecture()[0] == "32bit":
572+
print(
573+
"Unable to compile driver because kernel space is 64-bit, but user space is 32-bit."
574+
)
575+
if self.is_raspberry_pi_os() and self.prompt(
576+
"Add parameter to /boot/config.txt to use 32-bit kernel?"
577+
):
578+
self.reconfig("/boot/config.txt", "^.*arm_64bit.*$", "arm_64bit=0")
579+
self.prompt_reboot()
580+
else:
581+
self.bail("Unable to continue while mismatch is present.")
582+
566583
# pylint: enable=invalid-name
567584

568585
def is_raspberry_pi_os(self):

0 commit comments

Comments
 (0)