init commитььиьа

This commit is contained in:
huker committed 2026-10-07 00:46:54 +03:00
commit ede7d165a4
12 files changed
+541

No files matched your search

+40
View File
@@ -0,0 +1,40 @@
#!/system/bin/sh
LOG=/data/adb/euicc_daemon.log
ESIM_SVC="vendor.oplus.hardware.esim.IOplusEsim/default"
gpio_st() {
service call "$ESIM_SVC" 1 2>/dev/null | grep -oE '[0-9a-f]{8} [0-9a-f]{8}' | head -1 | awk '{print $2}'
}
status() {
G=$(gpio_st)
D=$(dumpsys isub 2>/dev/null | grep -c 'simSlotIndex=1 portIndex=0 isEmbedded=1')
N=$(dumpsys isub 2>/dev/null | grep 'simSlotIndex=1 ' | grep -oE 'displayName=[^ ]+' | head -1)
if [ "$G" = "00000001" ]; then
echo "eUICC power : ON"
else
echo "eUICC power : OFF ($G)"
fi
if [ "${D:-0}" -ge 1 ]; then
echo "eSIM in slot: YES $N"
else
echo "eSIM in slot: NO"
fi
}
echo "=== eSIM Fix ==="
status
echo
echo "Running activation cycle (~1-2 min)..."
echo
sh /data/adb/modules/euicc_slots_fix/esimd-manual.sh
echo
echo "=== Result ==="
status
echo
echo "Log:"
tail -8 "$LOG" 2>/dev/null
if [[ -z "$MMRL" ]] && ([[ -n "$KSU" ]] || [[ -n "$APATCH" ]]); then
sleep 10
fi
+12
View File
@@ -0,0 +1,12 @@
ui_print "- eSIM Slots Fix v1.1"
ui_print "- by huker667"
ui_print "- OnePlus 15R (macan), LineageOS-based Android 16"
set_perm_recursive "$MODPATH" 0 0 0755 0644
set_perm "$MODPATH/post-fs-data.sh" 0 0 0755
set_perm "$MODPATH/service.sh" 0 0 0755
set_perm "$MODPATH/action.sh" 0 0 0755
set_perm "$MODPATH/esimd.sh" 0 0 0755
set_perm "$MODPATH/esimd-manual.sh" 0 0 0755
ui_print "- Done. Reboot to activate."
+57
View File
@@ -0,0 +1,57 @@
#!/system/bin/sh
ESIM_SVC="vendor.oplus.hardware.esim.IOplusEsim/default"
SUB_SVC="vendor.oplus.hardware.subsys_interface.subsys_radio.ISubsysRadio/slot1"
LOG=/data/adb/euicc_daemon.log
M1="i32 2 i32 1 i32 0 i32 0 i32 0 i32 1 i32 1 i32 0 i32 1 i32 1 i32 1"
M2="i32 2 i32 1 i32 0 i32 0 i32 0 i32 1 i32 1 i32 0 i32 1 i32 1 i32 2"
log() {
echo "$(date '+%F %T') [manual] $*" >> "$LOG"
echo "$*"
}
gpio_state() {
service call "$ESIM_SVC" 1 2>/dev/null | grep -oE '[0-9a-f]{8} [0-9a-f]{8}' | head -1 | awk '{print $2}'
}
detected() {
dumpsys isub 2>/dev/null | grep -c 'simSlotIndex=1 portIndex=0 isEmbedded=1'
}
log "=== manual cycle start ==="
service call "$ESIM_SVC" 5 i32 0 >/dev/null 2>&1
service call "$SUB_SVC" 289 i32 91 i32 1 >/dev/null 2>&1
service call "$ESIM_SVC" 3 i32 1 >/dev/null 2>&1
service call "$ESIM_SVC" 5 i32 1 >/dev/null 2>&1
sleep 1
log "gpio=$(gpio_state)"
logcat -c -b radio 2>/dev/null
service call phone 175 $M1 >/dev/null 2>&1
sleep 2
log "SET_SIM_TYPE[1,1] sent, restarting qcrild..."
setprop ctl.restart vendor.qcrild
setprop ctl.restart vendor.qcrild2
t=0
while [ $t -lt 40 ]; do
n=$(logcat -d -b radio 2>/dev/null | grep -c "Received GET_SIM_TYPE_INFO")
[ "${n:-0}" -ge 1 ] 2>/dev/null && break
sleep 1
t=$((t+1))
done
log "ril sync after ${t}s"
service call phone 175 $M2 >/dev/null 2>&1
log "SET_SIM_TYPE[1,2] sent, waiting for eSIM detection..."
p=0
while [ $p -lt 15 ]; do
sleep 3
p=$((p+1))
d=$(detected)
[ "${d:-0}" -ge 1 ] 2>/dev/null && break
done
log "=== manual cycle done: detect=$(detected) ($((p * 3))s) ==="
pgrep -f esimd.sh >/dev/null 2>&1 || setsid /system/bin/sh /data/adb/modules/euicc_slots_fix/esimd.sh >/dev/null 2>&1 </dev/null &
exit 0
+132
View File
@@ -0,0 +1,132 @@
#!/system/bin/sh
ESIM_SVC="vendor.oplus.hardware.esim.IOplusEsim/default"
SUB_SVC="vendor.oplus.hardware.subsys_interface.subsys_radio.ISubsysRadio/slot1"
LOG=/data/adb/euicc_daemon.log
M1="i32 2 i32 1 i32 0 i32 0 i32 0 i32 1 i32 1 i32 0 i32 1 i32 1 i32 1"
M2="i32 2 i32 1 i32 0 i32 0 i32 0 i32 1 i32 1 i32 0 i32 1 i32 1 i32 2"
log() { echo "$(date '+%F %T') $*" >> "$LOG"; }
if [ -f "$LOG" ] && [ "$(wc -c < "$LOG" 2>/dev/null)" -gt 262144 ]; then
tail -c 65536 "$LOG" > "$LOG.tmp" && mv "$LOG.tmp" "$LOG"
fi
gpio_state() {
service call "$ESIM_SVC" 1 2>/dev/null | grep -oE '[0-9a-f]{8} [0-9a-f]{8}' | head -1 | awk '{print $2}'
}
gpio_on() {
service call "$ESIM_SVC" 5 i32 0 >/dev/null 2>&1
service call "$SUB_SVC" 289 i32 91 i32 1 >/dev/null 2>&1
service call "$ESIM_SVC" 3 i32 1 >/dev/null 2>&1
service call "$ESIM_SVC" 5 i32 1 >/dev/null 2>&1
}
esim_detected() {
dumpsys isub 2>/dev/null | grep -c 'simSlotIndex=1 portIndex=0 isEmbedded=1'
}
card_up() {
logcat -d -b radio 2>/dev/null | grep -cF "[1] recv card status:3"
}
echo $$ > /data/adb/esimd.pid
log "=== esimd started pid=$$ ==="
i=0
while [ $i -lt 600 ]; do
service check "$ESIM_SVC" 2>/dev/null | grep -q ': found' && break
sleep 0.5
i=$((i+1))
done
log "phaseA: esim HAL ready after ~$((i/2))s"
G=$(gpio_state)
if [ "$G" != "00000001" ]; then
j=0
while [ $j -lt 10 ]; do
gpio_on
sleep 1
G=$(gpio_state)
[ "$G" = "00000001" ] && break
j=$((j+1))
done
log "phaseA: gpio powered, state=$G tries=$((j+1))"
else
log "phaseA: gpio already ON"
fi
i=0
while [ $i -lt 300 ]; do
service check phone 2>/dev/null | grep -q ': found' && break
sleep 1
i=$((i+1))
done
log "phaseB: phone service after ~${i}s"
w=0
while [ $w -lt 60 ]; do
[ "$(esim_detected)" -ge 1 ] 2>/dev/null && break
sleep 3
w=$((w+3))
done
attempt=0
while [ $attempt -lt 6 ]; do
D=$(esim_detected)
if [ "${D:-0}" -ge 1 ] 2>/dev/null; then
log "phaseB: eSIM UP (attempt $attempt, detect=$D card=$(card_up))"
break
fi
attempt=$((attempt+1))
log "phaseB: attempt $attempt (detect=$D card=$(card_up))"
G=$(gpio_state)
if [ "$G" != "00000001" ]; then
gpio_on
sleep 1
fi
logcat -c -b radio 2>/dev/null
service call phone 175 $M1 >/dev/null 2>&1
sleep 2
setprop ctl.restart vendor.qcrild
setprop ctl.restart vendor.qcrild2
t=0
while [ $t -lt 40 ]; do
n=$(logcat -d -b radio 2>/dev/null | grep -c "Received GET_SIM_TYPE_INFO")
[ "${n:-0}" -ge 1 ] 2>/dev/null && break
sleep 1
t=$((t+1))
done
service call phone 175 $M2 >/dev/null 2>&1
p=0
while [ $p -lt 12 ]; do
sleep 3
p=$((p+1))
[ "$(card_up)" -ge 1 ] 2>/dev/null && break
done
done
log "phaseB: done, detect=$(esim_detected) card=$(card_up)"
fails=0
while true; do
sleep 30
if [ "$(esim_detected)" -ge 1 ] 2>/dev/null; then
fails=0
else
fails=$((fails+1))
log "monitor: eSIM not detected (fails=$fails)"
if [ $fails -ge 2 ]; then
log "monitor: reactivating"
gpio_on
sleep 1
service call phone 175 $M1 >/dev/null 2>&1
sleep 2
setprop ctl.restart vendor.qcrild
sleep 10
service call phone 175 $M2 >/dev/null 2>&1
fails=0
fi
fi
done
+6
View File
@@ -0,0 +1,6 @@
id=euicc_slots_fix
name=eSIM Slots Fix
version=v1.1
versionCode=2
author=huker667
description=Full eSIM support for OnePlus 15R (macan) on LineageOS-based Android 16 ports. RRO for eUICC slot visibility, early boot activation daemon with auto-recovery, manual activation action button.
+37
View File
@@ -0,0 +1,37 @@
#!/system/bin/sh
MODDIR=${0%/*}
TMP=/dev/euicc_overlay_tmp
SRC=/product/overlay
if [ -f "$MODDIR/product/overlay/EuiccSlotsFix.apk" ]; then
rm -rf "$TMP" 2>/dev/null
mkdir -p "$TMP"
cp -a "$SRC/." "$TMP/" 2>/dev/null
cp -a "$MODDIR/product/overlay/EuiccSlotsFix.apk" "$TMP/" 2>/dev/null
mount -t tmpfs -o mode=755 tmpfs "$SRC"
cp -a "$TMP/." "$SRC/" 2>/dev/null
chown -R root:root "$SRC"
chmod 755 "$SRC"
restorecon -R "$SRC" 2>/dev/null
rm -rf "$TMP"
fi
PTMP=/dev/perm_tmp
PERM=/product/etc/permissions
if [ -f "$MODDIR/product/etc/permissions/android.hardware.telephony.satellite.xml" ]; then
rm -rf "$PTMP" 2>/dev/null
mkdir -p "$PTMP"
cp -a "$PERM/." "$PTMP/" 2>/dev/null
cp -a "$MODDIR/product/etc/permissions/android.hardware.telephony.satellite.xml" "$PTMP/" 2>/dev/null
mount -t tmpfs -o mode=755 tmpfs "$PERM"
cp -a "$PTMP/." "$PERM/" 2>/dev/null
chown -R root:root "$PERM"
chmod 755 "$PERM"
chmod 644 "$PERM"/*.xml 2>/dev/null
restorecon -R "$PERM" 2>/dev/null
rm -rf "$PTMP"
fi
/data/adb/ksu/bin/resetprop ro.surface_flinger.set_idle_timer_ms 3000
setsid /system/bin/sh "$MODDIR/esimd.sh" >/dev/null 2>&1 </dev/null &
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<permissions>
<feature name="android.hardware.telephony.satellite" />
</permissions>
Binary file not shown.
+10
View File
@@ -0,0 +1,10 @@
#!/system/bin/sh
until [ "$(getprop sys.boot_completed)" = "1" ]; do sleep 2; done
sleep 5
while true; do
if ! pgrep -f esimd.sh >/dev/null 2>&1; then
echo "$(date) esimd not running, respawning" >> /data/adb/euicc_daemon.log
setsid /system/bin/sh /data/adb/modules/euicc_slots_fix/esimd.sh >/dev/null 2>&1 </dev/null &
fi
sleep 20
done