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
This commit is contained in:
purpl
2026-06-27 12:18:41 +08:00
commit 0be91bc45b
7 changed files with 353 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
# TWRP flashable zip output
*.zip

View File

@@ -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

View File

@@ -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.

90
README.md Normal file
View File

@@ -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.

12
system/build.prop Normal file
View File

@@ -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

View File

@@ -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

88
vendor/etc/sensor_config.xml vendored Normal file
View File

@@ -0,0 +1,88 @@
<root>
<!-->
sensor id 0
<-->
<CameraModuleCfg>
<SlotId>0</SlotId>
<SensorName>hi846</SensorName>
<Facing>BACK</Facing>
<Orientation>0</Orientation>
<Resource_cost>0</Resource_cost>
<VCM>
<AfName>dw9714</AfName>
<Mode>2</Mode>
</VCM>
<OTP>
<E2prom>
<OtpName>general</OtpName>
<I2cAddr>0xa4</I2cAddr>
<E2promNum>0</E2promNum>
<E2promSize>8192</E2promSize>
</E2prom>
</OTP>
<TuningParameter>
<TuningName>hi846</TuningName>
</TuningParameter>
</CameraModuleCfg>
<CameraModuleCfg>
<SlotId>0</SlotId>
<SensorName>gc8034_rear</SensorName>
<Facing>BACK</Facing>
<Orientation>0</Orientation>
<Resource_cost>0</Resource_cost>
<VCM>
<AfName>dw9714</AfName>
<Mode>2</Mode>
</VCM>
<OTP>
<E2prom>
<OtpName>general</OtpName>
<I2cAddr>0xa4</I2cAddr>
<E2promNum>0</E2promNum>
<E2promSize>8192</E2promSize>
</E2prom>
</OTP>
<TuningParameter>
<TuningName>gc8034_rear</TuningName>
</TuningParameter>
</CameraModuleCfg>
<!-->
sensor id 1
<-->
<CameraModuleCfg>
<SlotId>1</SlotId>
<SensorName>hi846_front</SensorName>
<Facing>FRONT</Facing>
<Orientation>0</Orientation>
<Resource_cost>0</Resource_cost>
<OTP>
<E2prom>
<OtpName>general</OtpName>
<I2cAddr>0xa6</I2cAddr>
<E2promNum>0</E2promNum>
<E2promSize>8192</E2promSize>
</E2prom>
</OTP>
<TuningParameter>
<TuningName>hi846_front</TuningName>
</TuningParameter>
</CameraModuleCfg>
<CameraModuleCfg>
<SlotId>1</SlotId>
<SensorName>gc8034</SensorName>
<Facing>FRONT</Facing>
<Orientation>0</Orientation>
<Resource_cost>0</Resource_cost>
<OTP>
<E2prom>
<OtpName>general</OtpName>
<I2cAddr>0xa6</I2cAddr>
<E2promNum>0</E2promNum>
<E2promSize>8192</E2promSize>
</E2prom>
</OTP>
<TuningParameter>
<TuningName>gc8034</TuningName>
</TuningParameter>
</CameraModuleCfg>
</root>