add Code/scripts/README.md

This commit is contained in:
cuu
2026-08-02 00:11:30 +08:00
parent f336cb4fe0
commit 53a05efca8
2 changed files with 44 additions and 0 deletions

12
Code/scripts/README.md Normal file
View File

@@ -0,0 +1,12 @@
# Scripts code used in uConsole os image
## uconsole-4g-cm4
Bash script to PowerOn/PowerOff 4G ext module in uConsole.
## audio_3.5_patch.py
Python script to switch between 3.5 audio jack and speaker on uConsole when 3.5 audio jack plugged or not.

View File

@@ -0,0 +1,32 @@
import os
import time
def init_gpio():
os.popen("pinctrl set 11 op")
os.popen("pinctrl set 10 ip pn")
def check_3_5():
tmp = os.popen("pinctrl 10").readline().strip("\n")
return tmp
def enable_speaker_gpio():
os.popen("pinctrl set 11 op dh")
def disable_speaker_gpio():
os.popen("pinctrl set 11 op dl")
init_gpio()
while True:
tmp = check_3_5()
if tmp == "10: ip pn | lo // GPIO10 = input":
enable_speaker_gpio()
elif tmp == "10: ip pn | hi // GPIO10 = input":
disable_speaker_gpio()
time.sleep(1)