commit 0be91bc45b00cef7667dbfea6be8cbcddd9d7d86 Author: purpl Date: Sat Jun 27 12:18:41 2026 +0800 Initial commit: CB-C6s-STU GSI Fixes TWRP flashable zip for CB-C6s-STU tablet running GSI. - build.prop: append tablet characteristics, brightness, orientation, BT offload - goodix_ts.idc: touchscreen IDC config - sensor_config.xml: camera sensor module mapping (hi846 / gc8034) - Shell-script update-binary with append-only build.prop logic diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2b5e356 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# TWRP flashable zip output +*.zip diff --git a/META-INF/com/google/android/update-binary b/META-INF/com/google/android/update-binary new file mode 100644 index 0000000..003f6e3 --- /dev/null +++ b/META-INF/com/google/android/update-binary @@ -0,0 +1,123 @@ +#!/sbin/sh + +# ============================================================ +# TWRP Flashable Zip — CB-C6s-STU-GSI-Fixes +# +# This is a shell-script update-binary. TWRP extracts the zip, +# sets the working dir to that temp location, and runs this script. +# The updater-script is a dummy — all logic lives here. +# +# What it does: +# - Appends build.prop entries to /system/build.prop (not replace!) +# - Installs goodix_ts.idc to /system/usr/idc/ +# - Installs sensor_config.xml to /vendor/etc/ +# ============================================================ + +OUTFD=$2 +ZIPFILE=$3 + +# ----- helpers ----- +ui_print() { + echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD + echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD +} + +abort() { + ui_print " " + ui_print "ERROR: $1" + ui_print "Installation aborted." + exit 1 +} + +# ----- locate zip root ----- +# The script lives at: META-INF/com/google/android/update-binary +# Zip root is 3 levels up from the script's directory. +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) +ZIPROOT=$(cd "$SCRIPT_DIR/../../.." && pwd) + +ui_print "========================================" +ui_print " CB-C6s-STU-GSI-Fixes" +ui_print " Tablet GSI tweaks" +ui_print "========================================" + +# ----- mount partitions ----- +ui_print " " +ui_print "Mounting partitions..." + +mount /system 2>/dev/null +mount /vendor 2>/dev/null + +# Verify /system is accessible +if [ ! -d /system ] || [ ! -f /system/build.prop ]; then + abort "Cannot access /system. Is the system partition mounted?" +fi + +ui_print "Partitions ready." + +# ----- 1. APPEND build.prop (关键:追加,不覆盖) ----- +ui_print " " +ui_print "[1/3] Appending entries to /system/build.prop..." + +BUILDPROP_SRC="$ZIPROOT/system/build.prop" + +if [ ! -f "$BUILDPROP_SRC" ]; then + abort "build.prop not found inside zip." +fi + +# Backup original before modifying +cp /system/build.prop /system/build.prop.bak 2>/dev/null +chmod 644 /system/build.prop.bak 2>/dev/null + +# APPEND — 使用 >> 追加而非覆盖 +cat "$BUILDPROP_SRC" >> /system/build.prop +chmod 644 /system/build.prop + +ui_print "build.prop: entries appended. Backup at build.prop.bak" + +# ----- 2. Install touchscreen IDC ----- +ui_print " " +ui_print "[2/3] Installing goodix_ts.idc..." + +IDC_SRC="$ZIPROOT/system/usr/idc/goodix_ts.idc" +IDC_DST="/system/usr/idc/goodix_ts.idc" + +if [ -f "$IDC_SRC" ]; then + mkdir -p /system/usr/idc 2>/dev/null + cp -f "$IDC_SRC" "$IDC_DST" + chmod 644 "$IDC_DST" + ui_print "goodix_ts.idc installed." +else + ui_print "goodix_ts.idc not found — skipped." +fi + +# ----- 3. Install sensor config ----- +ui_print " " +ui_print "[3/3] Installing sensor_config.xml..." + +SENSOR_SRC="$ZIPROOT/vendor/etc/sensor_config.xml" + +if [ -f "$SENSOR_SRC" ]; then + # /vendor may be a separate partition OR a symlink under /system + if [ -d /vendor/etc ]; then + cp -f "$SENSOR_SRC" /vendor/etc/sensor_config.xml + chmod 644 /vendor/etc/sensor_config.xml + ui_print "sensor_config.xml → /vendor/etc/" + elif [ -d /system/vendor/etc ]; then + cp -f "$SENSOR_SRC" /system/vendor/etc/sensor_config.xml + chmod 644 /system/vendor/etc/sensor_config.xml + ui_print "sensor_config.xml → /system/vendor/etc/" + else + ui_print "WARNING: /vendor/etc not found — skipped." + fi +else + ui_print "sensor_config.xml not found — skipped." +fi + +# ----- done ----- +ui_print " " +ui_print "========================================" +ui_print " Installation complete!" +ui_print " Reboot to apply changes." +ui_print "========================================" + +exit 0 diff --git a/META-INF/com/google/android/updater-script b/META-INF/com/google/android/updater-script new file mode 100644 index 0000000..50a62eb --- /dev/null +++ b/META-INF/com/google/android/updater-script @@ -0,0 +1,4 @@ +# CB-C6s-STU-GSI-Fixes +# This updater-script is intentionally minimal. +# The real installation logic is in update-binary (shell script). +# TWRP runs the shell-script update-binary directly and ignores this file. diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c8d039 --- /dev/null +++ b/README.md @@ -0,0 +1,90 @@ +# CB-C6s-STU GSI Fixes + +TWRP flashable zip that applies device-specific fixes for the **CB-C6s-STU** +tablet when running a Generic System Image (GSI). All `build.prop` changes +are **appended** — the existing file is never replaced. + +## What it fixes + +| Area | File | Problem | Fix | +|------|------|---------|-----| +| System properties | `build.prop` | Missing tablet characteristics, wrong brightness range, portrait-only orientation, broken Bluetooth A2DP offload | Append missing properties | +| Touchscreen | `goodix_ts.idc` | Touch orientation and input device type not declared | Install IDC config for Goodix touch panel | +| Camera sensors | `sensor_config.xml` | Rear/front camera sensor modules not configured | Install sensor config for hi846 / gc8034 modules | + +## Files + +``` +CB-C6s-STU-GSI-Fixes.zip +├── META-INF/com/google/android/ +│ ├── update-binary # Shell script — all install logic +│ └── updater-script # Placeholder (TWRP uses shell-script mode) +├── system/ +│ ├── build.prop # Properties appended to /system/build.prop +│ └── usr/idc/ +│ └── goodix_ts.idc # Touchscreen input device config +└── vendor/etc/ + └── sensor_config.xml # Camera sensor module mapping +``` + +### build.prop entries + +Appended to the device's existing `/system/build.prop`: + +```ini +# Tablet characteristics +ro.build.characteristics=tablet + +# Workaround: Set max brightness of sprd_backlight to 1023 +persist.sys.qcom-brightness=1023 + +# Workaround: Set primary display orientation to landscape +ro.surface_flinger.primary_display_orientation=ORIENTATION_90 + +# Workaround: Disable Bluetooth A2DP offload +ro.bluetooth.a2dp_offload.supported=false +persist.bluetooth.a2dp_offload.disabled=true +``` + +A backup is saved to `/system/build.prop.bak` before appending. + +## Usage + +1. Copy `CB-C6s-STU-GSI-Fixes.zip` to the device (sdcard or adb push). +2. Boot to **TWRP Recovery**. +3. Tap **Install** → select the zip → **Swipe to confirm Flash**. +4. Reboot. + +The script mounts `/system` and `/vendor` automatically. No manual +mounting is needed. + +## TWRP install output + +During flash, TWRP will show: + +``` +[1/3] Appending entries to /system/build.prop... +[2/3] Installing goodix_ts.idc... +[3/3] Installing sensor_config.xml... +``` + +## Compatibility + +- **Device**: CB-C6s-STU tablet (Spreadtrum / Unisoc platform) +- **Recovery**: TWRP with `/sbin/sh` support (shell-script update-binary) +- **GSI**: Any Android GSI that needs these device-specific tweaks + +## Notes + +- The `build.prop` entries are **appended, not replaced**. Re-flashing + the zip multiple times will duplicate the entries — restore from + `/system/build.prop.bak` if needed, or inspect the file first. +- The `sensor_config.xml` covers four camera sensor combinations: + rear (`hi846`, `gc8034_rear`) and front (`hi846_front`, `gc8034`), + each with OTP EEPROM tuning parameters. +- For SAR (System-as-Root) devices, the script falls back to + `/system/vendor/etc/` if `/vendor/etc/` is not available. + +## License + +Provided as-is for device maintenance. No warranty. diff --git a/system/build.prop b/system/build.prop new file mode 100644 index 0000000..4ce698b --- /dev/null +++ b/system/build.prop @@ -0,0 +1,12 @@ +# Tablet characteristics +ro.build.characteristics=tablet + +# Workaround: Set the max_brightness of sprd_backlight to 1023 +persist.sys.qcom-brightness=1023 + +# Workaround: Set the primary display orientation to landscape +ro.surface_flinger.primary_display_orientation=ORIENTATION_90 + +# Workaround: Disable bluetooth A2DP offload +ro.bluetooth.a2dp_offload.supported=false +persist.bluetooth.a2dp_offload.disabled=true diff --git a/system/usr/idc/goodix_ts.idc b/system/usr/idc/goodix_ts.idc new file mode 100644 index 0000000..cb4d2cd --- /dev/null +++ b/system/usr/idc/goodix_ts.idc @@ -0,0 +1,34 @@ +# Copyright (C) 2010 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# +# Input Device Configuration File for the Stingray touch screen. +# + +# Basic Parameters +touch.deviceType = touchScreen +touch.orientationAware = 1 +touch.orientation = ORIENTATION_90 + +## Size +#touch.size.calibration = area +#touch.size.scale = 28 +#touch.size.bias = 0 +# +## Pressure +#touch.pressure.calibration = amplitude +#touch.pressure.scale = 0.0125 +# +## Orientation +#touch.orientation.calibration = none diff --git a/vendor/etc/sensor_config.xml b/vendor/etc/sensor_config.xml new file mode 100644 index 0000000..92a6fd7 --- /dev/null +++ b/vendor/etc/sensor_config.xml @@ -0,0 +1,88 @@ + + + sensor id 0 + <--> + + 0 + hi846 + BACK + 0 + 0 + + dw9714 + 2 + + + + general + 0xa4 + 0 + 8192 + + + + hi846 + + + + 0 + gc8034_rear + BACK + 0 + 0 + + dw9714 + 2 + + + + general + 0xa4 + 0 + 8192 + + + + gc8034_rear + + + + sensor id 1 + <--> + + 1 + hi846_front + FRONT + 0 + 0 + + + general + 0xa6 + 0 + 8192 + + + + hi846_front + + + + 1 + gc8034 + FRONT + 0 + 0 + + + general + 0xa6 + 0 + 8192 + + + + gc8034 + + +