Skip to content

Commit ca96d20

Browse files
committed
chore: update VERSION, CHANGELOG and install/restore scripts
1 parent 4c28e55 commit ca96d20

5 files changed

Lines changed: 52 additions & 12 deletions

File tree

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.2
1+
4.0.3

docs/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ All notable changes to the GZ302 Linux Setup project will be documented in this
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [4.0.3] - 2026-01-31
9+
10+
### Fixed
11+
12+
- **RGB Memory/Restore on Resume**: Fixed keyboard RGB not restoring after sleep/suspend
13+
- Increased USB device reinitialization delay from 0.5s to 1s for reliable hidraw access
14+
- Changed RGB restore from background to synchronous execution in sleep hook
15+
- Added logging to system journal for debugging (`journalctl -t gz302-reset`)
16+
- RGB restore script now provides verbose output for both keyboard and lightbar
17+
- Fixed silent failures by removing blanket stderr suppression in restore script
18+
19+
### Changed
20+
21+
- Updated `gz302-reset.sh` sleep hook to v2.1 with improved timing and logging
22+
- RGB restore script now logs success/failure status for troubleshooting
23+
824
## [4.0.2] - 2025-01-08
925

1026
### Fixed

gz302-main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# ==============================================================================
44
# Author: th3cavalry using Copilot
5-
# Version: 4.0.2
5+
# Version: 4.0.3
66
#
77
# Supported Models:
88
# - GZ302EA-XS99 (128GB RAM)

scripts/gz302-rgb-install.sh

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,12 @@ install_suspend_hook() {
360360
#!/bin/bash
361361
# GZ302 Resume Reset Hook (Optimized)
362362
# Resets keyboard and lightbar USB devices on resume to fix touchpad and RGB
363-
# v2.0 - Single loop, faster sleeps to minimize resume delay
363+
# v2.1 - Improved RGB restore timing and logging
364364
365365
case "$1" in
366366
post)
367+
logger -t gz302-reset "Resume detected, resetting USB devices..."
368+
367369
# Single pass through USB devices - reset both keyboard and lightbar
368370
# Product IDs: 1a30 = Keyboard/Touchpad, 18c6 = Lightbar
369371
for dev in /sys/bus/usb/devices/*; do
@@ -377,24 +379,30 @@ case "$1" in
377379
case "$pid" in
378380
1a30)
379381
# Keyboard/Touchpad - fixes touchpad not working after sleep
382+
logger -t gz302-reset "Resetting keyboard/touchpad at $dev"
380383
echo 0 > "$dev/authorized"
381384
sleep 0.1
382385
echo 1 > "$dev/authorized"
383386
;;
384387
18c6)
385388
# Lightbar - ensures RGB commands work
389+
logger -t gz302-reset "Resetting lightbar at $dev"
386390
echo 0 > "$dev/authorized"
387391
sleep 0.1
388392
echo 1 > "$dev/authorized"
389393
;;
390394
esac
391395
done
392396
393-
# Restore RGB settings in background (non-blocking)
394-
{
395-
sleep 0.5
396-
systemctl restart gz302-rgb-restore.service 2>/dev/null
397-
} &
397+
# Wait for USB devices to fully reinitialize, then restore RGB
398+
# Run synchronously to ensure it completes before user interaction
399+
sleep 1
400+
logger -t gz302-reset "Restoring RGB settings..."
401+
if /usr/local/bin/gz302-rgb-restore 2>&1 | logger -t gz302-rgb-restore; then
402+
logger -t gz302-reset "RGB restore completed"
403+
else
404+
logger -t gz302-reset "RGB restore failed"
405+
fi
398406
;;
399407
esac
400408
exit 0

scripts/gz302-rgb-restore.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ if [[ -f "$KEYBOARD_CONFIG" ]]; then
9090
# KEYBOARD_COMMAND contains the full command string (e.g. "static ff0000")
9191
# Split into array to avoid eval
9292
read -r -a CMD_ARGS <<< "$KEYBOARD_COMMAND"
93-
"$RGB_BIN" "${CMD_ARGS[@]}" 2>/dev/null || true
93+
echo "Restoring keyboard RGB: ${CMD_ARGS[*]}"
94+
if "$RGB_BIN" "${CMD_ARGS[@]}" 2>&1; then
95+
echo "Keyboard RGB restored successfully"
96+
else
97+
echo "Warning: Keyboard RGB restore failed" >&2
98+
fi
9499

95100
# Handle legacy format (COMMAND + ARG1, ARG2, etc.)
96101
elif [[ -n "${COMMAND:-}" && -n "${ARGC:-}" ]] && [[ -x "$RGB_BIN" ]]; then
@@ -102,8 +107,15 @@ if [[ -f "$KEYBOARD_CONFIG" ]]; then
102107
args+=("$val")
103108
fi
104109
done
105-
"$RGB_BIN" "${args[@]}" 2>/dev/null || true
110+
echo "Restoring keyboard RGB (legacy): ${args[*]}"
111+
if "$RGB_BIN" "${args[@]}" 2>&1; then
112+
echo "Keyboard RGB restored successfully"
113+
else
114+
echo "Warning: Keyboard RGB restore failed" >&2
115+
fi
106116
fi
117+
else
118+
echo "No keyboard RGB config found at $KEYBOARD_CONFIG"
107119
fi
108120

109121
# Restore rear window/lightbar RGB settings
@@ -112,16 +124,20 @@ if [[ -f "$WINDOW_CONFIG" ]]; then
112124
WINDOW_COLOR=$(get_config_var "$WINDOW_CONFIG" "WINDOW_COLOR")
113125

114126
if [[ -n "${WINDOW_BRIGHTNESS:-}" ]] && [[ -x "$WINDOW_BIN" ]]; then
115-
"$WINDOW_BIN" --lightbar "$WINDOW_BRIGHTNESS" 2>/dev/null || true
127+
echo "Restoring lightbar brightness: $WINDOW_BRIGHTNESS"
128+
"$WINDOW_BIN" --lightbar "$WINDOW_BRIGHTNESS" 2>&1 || echo "Warning: Lightbar brightness restore failed" >&2
116129
fi
117130

118131
# Restore color if present (format: R,G,B)
119132
if [[ -n "${WINDOW_COLOR:-}" ]] && [[ -x "$WINDOW_BIN" ]]; then
120133
IFS=',' read -r R G B <<< "$WINDOW_COLOR"
121134
if [[ -n "${R:-}" && -n "${G:-}" && -n "${B:-}" ]]; then
122-
"$WINDOW_BIN" --color "$R" "$G" "$B" 2>/dev/null || true
135+
echo "Restoring lightbar color: R=$R G=$G B=$B"
136+
"$WINDOW_BIN" --color "$R" "$G" "$B" 2>&1 || echo "Warning: Lightbar color restore failed" >&2
123137
fi
124138
fi
139+
else
140+
echo "No lightbar RGB config found at $WINDOW_CONFIG"
125141
fi
126142

127143
exit 0

0 commit comments

Comments
 (0)