Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
435 commits
Select commit Hold shift + click to select a range
5781a0a
Updates: defer the mutex unlock
pennycoders Sep 9, 2025
ecbb127
Cleanup: remove devLog with calculated param
pennycoders Sep 9, 2025
0c05f08
[WIP] Cleanup: Remove hid optimization code, as it is out of scope
pennycoders Sep 9, 2025
59b7511
Improvement (Maintainability): Make all C code more manageable by mov…
pennycoders Sep 11, 2025
f6a107e
Merge branch 'dev' into feat/audio-support
pennycoders Sep 11, 2025
176e2a4
Fix: add accidentally removed test file back, devcontainer build proc…
pennycoders Sep 12, 2025
370b07e
Cleanup: only set PKG_CONFIG_PATH once
pennycoders Sep 12, 2025
260714c
Cleanup: Simplify Makefile by exporting all needed env vars at the top
pennycoders Sep 12, 2025
c70440f
Merge branch 'dev' into feat/audio-support
pennycoders Sep 13, 2025
a8b0a33
[WIP] Cleanup / Refinement: PR Review
pennycoders Sep 14, 2025
154fb5c
[WIP] Cleanpup: Remove audio input quality settings to reduce complexity
pennycoders Sep 15, 2025
7b3a8cc
Fix: indentation
pennycoders Sep 15, 2025
365dc4a
[WIP] Cleanpup: Remove audio input quality settings to reduce complexity
pennycoders Sep 15, 2025
8e54e26
[WIP] Cleanpup: Remove audio input quality settings to reduce complexity
pennycoders Sep 15, 2025
7c4f884
[WIP] Fix: add commented code back
pennycoders Sep 15, 2025
97b2fe0
[WIP] Optimizations: Optimize audio system
pennycoders Sep 15, 2025
48c62c5
Fix: pcm_snd_wait won't work when device is busy
pennycoders Sep 15, 2025
aa8a5fa
[WIP] Simplification: PR Simplification
pennycoders Sep 15, 2025
1fca01c
[WIP] Cleanup: remove unnecessary complexity
pennycoders Sep 15, 2025
1d27509
[WIP] Cleanup: function naming
pennycoders Sep 16, 2025
53b5a0a
[WIP] Maintainability: Add debug / trace logs to make it easy to debu…
pennycoders Sep 16, 2025
21d7c87
[WIP] Add debug logging throughout the audio system
pennycoders Sep 16, 2025
bbeeaf2
[WIP] Maintainability Improvement: Add debug logging throughout the a…
pennycoders Sep 16, 2025
410f10f
[WIP] Maintainability Improvement: Add debug logging throughout the a…
pennycoders Sep 16, 2025
26ac27f
[WIP] Cleanup: removed redundant code
pennycoders Sep 16, 2025
d810f06
[WIP] Cleanup: removed redundant code
pennycoders Sep 16, 2025
717d846
Cleanup: removed redundant code, comments, etc.
pennycoders Sep 16, 2025
6d2b8e5
Cleanup: removed redundant code, comments, etc.
pennycoders Sep 16, 2025
ab6a918
Cleanup, Optimizations: Small aaudio optimizations
pennycoders Sep 16, 2025
7615b5c
Cleanup, Optimizations: Small aaudio optimizations
pennycoders Sep 16, 2025
fe19379
Cleanup, Optimizations: Small aaudio optimizations
pennycoders Sep 16, 2025
b03a9f1
Fix: remove misplaced const
pennycoders Sep 16, 2025
53e8422
Cleanup: removed redundant code
pennycoders Sep 16, 2025
755e1ce
Cleanup: removed redundant code
pennycoders Sep 16, 2025
b973356
Consistency: keep if block multi-line
pennycoders Sep 16, 2025
c6951fc
PR Review Optimization: As recommended, use ternary operators instead…
pennycoders Sep 16, 2025
bf50669
perf(audio): add ARM NEON SIMD optimizations for audio processing
pennycoders Sep 16, 2025
b9ae450
PR Cleanup: reset .golangci.yml to its original state
pennycoders Sep 19, 2025
7dfc9dc
Merge branch 'dev' into feat/audio-support
pennycoders Sep 19, 2025
ce6e130
[WIP] Cleanup: PR cleanup
pennycoders Sep 19, 2025
c7dd1da
[WIP] Cleanup: PR Cleanup
pennycoders Sep 19, 2025
c642881
[WIP] Cleanup: PR Cleanup
pennycoders Sep 19, 2025
e944df8
[WIP] Cleanup: PR Cleanup
pennycoders Sep 19, 2025
fa0626d
[WIP] Cleanup: PR Cleanup
pennycoders Sep 19, 2025
41bb28e
[WIP] Cleanup: PR Cleanup
pennycoders Sep 19, 2025
e5357a6
[WIP] Cleanup: PR Cleanup
pennycoders Sep 19, 2025
8c87af8
[WIP] Cleanup: PR cleanup - restore commented logs
pennycoders Sep 20, 2025
60076fb
[WIP] CLeanup: Remove unused or redundant code or comments
pennycoders Sep 20, 2025
a079faa
Fix: make sure audio output enable / disable doesn't need a refresh i…
pennycoders Sep 20, 2025
90fbfb6
[WIP] Improvements: Improve audio resume mechanism after Hardware Set…
pennycoders Sep 21, 2025
04ae11e
[WIP] Improvements: Improve audio resume mechanism after Hardware Set…
pennycoders Sep 21, 2025
2194666
Improvement: improve audio input restauration mechanism
pennycoders Sep 21, 2025
63eb58e
[WIP] Improvements, Bugfixes: Improve audio experience when running i…
pennycoders Sep 21, 2025
6db4a93
[WIP] Improvements, Bugfixes: Improve audio experience when running i…
pennycoders Sep 21, 2025
cd5d3ed
[WIP] Improvements, Bugfixes: Improve audio experience when running i…
pennycoders Sep 21, 2025
b33d681
[WIP] Improvements, Bugfixes: Improve audio experience when running i…
pennycoders Sep 21, 2025
e6a6a18
[WIP] Improvements, Bugfixes: Improve audio experience when running i…
pennycoders Sep 21, 2025
63a6a4a
Merge branch 'dev' into feat/audio-support
pennycoders Sep 26, 2025
c8401cc
[WIP] Updates: simplify audio system
pennycoders Sep 30, 2025
36b8f74
[WIP] Updates: simplify audio system
pennycoders Sep 30, 2025
d015542
[WIP] Updates: simplify audio system
pennycoders Sep 30, 2025
0639982
[WIP] Updates: simplify audio system
pennycoders Sep 30, 2025
4afaf60
[WIP] Updates: simplify audio system
pennycoders Sep 30, 2025
918cdba
Updates: adjust gain to avoid audio artifacts
pennycoders Sep 30, 2025
f891f14
[WIP] Updates: simplify audio system
pennycoders Sep 30, 2025
5d24eba
[WIP] Fix: crackling sound when seeking forwars
pennycoders Sep 30, 2025
a068587
[WIP] Fix: crackling sound when seeking forwars
pennycoders Sep 30, 2025
11830e1
[WIP] Fix: crackling sound when seeking forward after migrating to HD…
pennycoders Sep 30, 2025
186f3cf
[WIP] Cleanup: cleanup audio code after HDMI switch
pennycoders Sep 30, 2025
51a8ed9
Cleanup: remove silence detection
pennycoders Sep 30, 2025
1bb036a
Merge branch 'dev' into feat/audio-support
pennycoders Sep 30, 2025
c42432b
[WIP] Updates: update build flows to work with the CGO jetkvm_native
pennycoders Oct 1, 2025
7fc3637
Updates: integrate all dev branch changes
pennycoders Oct 1, 2025
4e5523d
Merge branch 'dev' into feat/audio-support
pennycoders Oct 1, 2025
b1b64fc
[WIP] Updates: use native C binaries for audio
pennycoders Oct 1, 2025
bf943cc
[WIP] Updates: reduce PR complexity
pennycoders Oct 1, 2025
78a9e6d
[WIP] Updates: reduce PR complexity
pennycoders Oct 1, 2025
81134b9
[WIP] Updates: reduce PR complexity
pennycoders Oct 1, 2025
c2d343b
[WIP] Updates: reduce PR complexity
pennycoders Oct 1, 2025
f5ab131
[WIP] Updates: reduce PR complexity
pennycoders Oct 1, 2025
2aa07e3
[WIP] Updates: reduce PR complexity
pennycoders Oct 1, 2025
78c3dc3
Refactor: Simplify / rewrite Audio
pennycoders Oct 6, 2025
8bd3706
fix: Address linting errors in audio code
pennycoders Oct 6, 2025
e0bdbdd
fix: Replace 'any' with proper React.ChangeEvent type in AudioPopover
pennycoders Oct 6, 2025
639eecb
fix: Add noise gate to prevent amplifying silence artifacts
pennycoders Oct 6, 2025
3b609d2
refactor: Simplify audio implementation
pennycoders Oct 6, 2025
6728c49
feat: Optimize audio quality and default to USB audio
pennycoders Oct 6, 2025
dcc0851
[WIP] Updates: support in-process mode
pennycoders Oct 7, 2025
aa0b487
[WIP] Updates: support in-process mode
pennycoders Oct 7, 2025
24ca56b
[WIP] Updates: support in-process mode
pennycoders Oct 7, 2025
2349f60
[WIP] Updates: support in-process mode
pennycoders Oct 7, 2025
d93253c
[WIP] Updates: support in-process mode
pennycoders Oct 7, 2025
d848948
[WIP] Updates: support in-process mode
pennycoders Oct 7, 2025
1caf57f
Cleanup: PR Comments
pennycoders Oct 7, 2025
eaaada8
Merge branch 'feat/dual-audio-mode' into feat/audio-support
pennycoders Oct 7, 2025
8caa5fc
refactor: Remove subprocess audio infrastructure, use CGO-only
pennycoders Oct 7, 2025
7442bdc
Cleanup: reduce drift from dev
pennycoders Oct 7, 2025
558512a
Merge branch 'dev' into feat/audio-support
pennycoders Oct 7, 2025
7ad72de
Merge branch 'dev' into feat/audio-support
pennycoders Oct 9, 2025
34bfa6f
Merge branch 'dev' into feat/audio-support
pennycoders Oct 16, 2025
8b7fcb3
Merge branch 'dev' into feat/audio-support
IDisposable Oct 22, 2025
bcaa04f
Merge dev into feat/audio-support
pennycoders Oct 23, 2025
3b849cc
fix: move ipcMsgTypeOpus constant to source.go for cross-platform builds
pennycoders Oct 23, 2025
a61d2c5
feat: add proper translations for audio features across all languages
pennycoders Oct 23, 2025
c55a4e2
fix: add AudioOutputSource field to Config struct
pennycoders Oct 23, 2025
b092ea1
fix: use translation key for audio button in ActionBar
pennycoders Oct 23, 2025
a3ed215
docs: document JetKVM ARMv7 architecture and lint requirements
pennycoders Oct 23, 2025
c42caf1
feat: add translations and fix audio settings page
pennycoders Oct 23, 2025
f528902
fix: verify audio source change and show accurate feedback
pennycoders Oct 23, 2025
c3c34c6
fix: add stub implementation for CGO audio on non-ARM platforms
pennycoders Oct 23, 2025
4e6ae02
chore: revert golangci-lint config and remove audio stub
pennycoders Oct 23, 2025
7f29ff0
Fix: app not loading via HTTP
pennycoders Oct 27, 2025
df87d9f
fix: remove continuous sleep mode check to prevent audio interference
pennycoders Oct 27, 2025
bff2aba
Merge branch 'dev' into feat/audio-support
pennycoders Oct 27, 2025
e2bf5d4
Merge branch 'dev' into feat/audio-support
pennycoders Oct 27, 2025
c5ec1da
fix: enable audio playback via manual start stream button
pennycoders Oct 28, 2025
ca9fa32
fix: track audio autoplay status separately to handle Safari blocking…
pennycoders Oct 28, 2025
2e40a04
fix: prevent race condition in audio output source switching by readi…
pennycoders Oct 28, 2025
df33207
Updates: bump Makefile VERSION to 0.4.9
pennycoders Oct 28, 2025
e9186e3
Updates: revert VERSION to 0.4.8
pennycoders Oct 28, 2025
7635b97
fix: use atomic.Bool for audio source to prevent mutex contention dur…
pennycoders Oct 28, 2025
fbb52e7
fix: wait for audio relay goroutine to exit before disconnecting source
pennycoders Oct 28, 2025
65975a1
Merge branch 'dev' into feat/audio-support
pennycoders Oct 29, 2025
da5ca6b
Merge branch 'dev' into feat/audio-support
pennycoders Oct 30, 2025
6553142
fix: update default EDID to enable audio support
pennycoders Oct 30, 2025
f40f5a7
temp: disable audio source selection while HDMI audio issues are diag…
pennycoders Nov 3, 2025
2514c56
feat: add audio dependencies to Docker build context
adamshiervani Nov 3, 2025
9127bd2
feat: enhance audio settings UI and localization
adamshiervani Nov 3, 2025
e6e9c6b
feat: add microphone auto-enable setting with session-based opt-in
pennycoders Nov 3, 2025
6a60de5
feat: persist audio preferences to backend config
pennycoders Nov 4, 2025
e26e962
fix: handle audio track recreation to prevent microphone failures
pennycoders Nov 4, 2025
c95ee9e
feat: add visual feedback for auto-enable microphone toggle
pennycoders Nov 4, 2025
f3fc4f4
fix: improve microphone reliability and auto-enable behavior
pennycoders Nov 7, 2025
af0e044
refactor: use atomic.Pointer for thread-safe inputSource access
pennycoders Nov 7, 2025
f20fac7
fix: improve microphone handling and cleanup
pennycoders Nov 9, 2025
c34440b
refactor: fix infinite useEffect
adamshiervani Nov 10, 2025
522f6cf
Revert "refactor: use atomic.Pointer for thread-safe inputSource access"
pennycoders Nov 10, 2025
3261efa
fix: prevent audio disconnect from blocking new WebRTC sessions
pennycoders Nov 10, 2025
82977ab
Enhancement: Make the code more DRY
pennycoders Nov 10, 2025
0514a70
Enhancement: Make the code more DRY
pennycoders Nov 10, 2025
0e63e6d
Updates: add logging on error, revert Makefile lint targets
pennycoders Nov 11, 2025
98d20d4
Merge branch 'dev' into feat/audio-support
pennycoders Nov 11, 2025
22a16c7
Fix: coredump issue
pennycoders Nov 11, 2025
abe61c8
Fixes / Updates: Update outside mutex comment, move outputSource, out…
pennycoders Nov 12, 2025
33ee474
Fix: prevent concurrent Opus decoder access during session transfers
pennycoders Nov 13, 2025
d3a3846
feat: wait for channel to open before triggering initial state update…
adamshiervani Nov 13, 2025
31903c4
Fix: extend audio mutex to prevent concurrent initialization crashes
pennycoders Nov 14, 2025
cedd086
fix: normalize Unicode characters in paste modal for proper detection…
nitishagar Nov 17, 2025
400b347
Fix: add stub implementations for non-ARM platforms to fix lint
pennycoders Nov 17, 2025
17f5241
Fix: increase ALSA buffer size to reduce audio crackling
pennycoders Nov 17, 2025
e0b1d5f
fix: show HDMI overlays in fullscreen mode (#974)
nitishagar Nov 17, 2025
9e69a0c
Fix: set EDID before video init to ensure audio capability detection
pennycoders Nov 17, 2025
e79c6f7
Add audio output source switching and improve shutdown handling
pennycoders Nov 17, 2025
922a715
Add runtime configurable audio parameters with UI controls
pennycoders Nov 17, 2025
5b5fc40
Merge branch 'dev' into feat/audio-support
pennycoders Nov 17, 2025
0fe9cab
Remove unused audio_settings_input translations
pennycoders Nov 17, 2025
1e22e00
Auto-switch audio output to HDMI when USB audio emulation is disabled
pennycoders Nov 17, 2025
9371868
Fix: increase Opus buffer size to 1500 bytes and add bounds check
pennycoders Nov 17, 2025
9f0d9c4
Fix: skip redundant USB gadget reconfigurations to prevent HID disrup…
pennycoders Nov 17, 2025
df76cd0
Fix: reopen HID files on USB state transitions to prevent stale handles
pennycoders Nov 17, 2025
11dadeb
Fix: improve EDID compatibility and add audio configuration options
pennycoders Nov 17, 2025
236291a
Fix: eliminate audio warping by auto-adapting to actual device sample…
pennycoders Nov 17, 2025
9c57fe8
Change: make sample rate read-only and auto-detected
pennycoders Nov 17, 2025
3f141c8
Add log files and development artifacts to gitignore
pennycoders Nov 17, 2025
94cab8b
Fix: prevent race condition crash in audio playback using pthread mut…
pennycoders Nov 17, 2025
2b276e1
Remove unused update_opus_encoder_params function
pennycoders Nov 17, 2025
a6c5e46
Align inline comments in Config struct
pennycoders Nov 17, 2025
d7dc8c2
Update audio.c header comment to reflect variable sample rate
pennycoders Nov 17, 2025
6a7f9e9
Fix race condition in setAudioTrack by using single critical section
pennycoders Nov 17, 2025
437a63d
Add bounds check for Opus packets in Go layer
pennycoders Nov 17, 2025
a305217
Merge branch 'dev' into feat/audio-support
pennycoders Nov 17, 2025
051950f
Fix critical deadlock when switching audio sources
pennycoders Nov 17, 2025
a6b7ac5
Eliminate hang completely by making ALSA interruption immediate
pennycoders Nov 17, 2025
b15cbc5
Clean up redundant comments for maintainability
pennycoders Nov 17, 2025
12d7ac6
Fix USB HID errors during browser refresh
pennycoders Nov 17, 2025
cd2d4d7
Remove additional redundant comments
pennycoders Nov 18, 2025
2e84354
Fix shutdown log level and order per PR review
pennycoders Nov 18, 2025
a1a2b9d
Remove unnecessary assignment when USB devices unchanged
pennycoders Nov 18, 2025
ba831dc
Ran npm run i18n to sort the message strings.
IDisposable Nov 17, 2025
cbba7f2
Removed unused translations.
IDisposable Nov 17, 2025
7f930e0
Add missing translations for new connection stats
IDisposable Nov 17, 2025
9b2500b
Extract alsaDevice configuration to helper
IDisposable Nov 17, 2025
8c7764a
Ensure the stopAudio() always runs
IDisposable Nov 18, 2025
1ec9941
Simplify audio management
IDisposable Nov 18, 2025
bc2a5f8
Merge pull request #1 from IDisposable/small-tweaks
pennycoders Nov 18, 2025
2f622df
Fix input audio source swap bug
pennycoders Nov 18, 2025
0022599
Fix audio channel separation and improve quality defaults
pennycoders Nov 18, 2025
4783021
Fix USB audio channels and remove redundant synchronization
pennycoders Nov 18, 2025
0e299aa
Deduplicate ALSA error handling and cleanup code
pennycoders Nov 18, 2025
befdfc7
Fix type mismatch in ALSA error handler
pennycoders Nov 18, 2025
da4c6c7
Use efficient uint8_t for recovery attempt counters
pennycoders Nov 18, 2025
c88b98c
Fix critical audio race conditions and align configuration defaults
pennycoders Nov 18, 2025
0168fcb
Make config.EdidString the single source of truth for EDID
pennycoders Nov 19, 2025
0dbf2df
Update default EDID for improved compatibility
pennycoders Nov 19, 2025
ee23e3b
Refactor audio subsystem for improved maintainability
pennycoders Nov 19, 2025
7fc90b8
Make audio source switching instant with async initialization
pennycoders Nov 19, 2025
8d69780
Update audio source switch notification to indicate 30-60s delay
pennycoders Nov 19, 2025
1d570a8
Fix critical audio race conditions and improve reliability
pennycoders Nov 19, 2025
3897a61
Fix critical comment inaccuracies in audio code
pennycoders Nov 19, 2025
4160462
Remove inaccurate and redundant comments
pennycoders Nov 19, 2025
fe4fb33
Fix misleading comment and incorrect Go terminology
pennycoders Nov 19, 2025
fba4eab
Merge branch 'dev' into feat/audio-support
pennycoders Nov 20, 2025
a6cbf20
Fix audio capture to force Opus-compatible sample rates
pennycoders Nov 20, 2025
edd06e2
Fix UI hanging when toggling audio output enable/disable
pennycoders Nov 20, 2025
3cd5bdd
Make RestartAudioOutput async to prevent RPC hanging
pennycoders Nov 20, 2025
3ed663b
Enable ALSA software resampling for hw: devices
pennycoders Nov 20, 2025
5f7c906
Simplify audio configuration and error handling
pennycoders Nov 20, 2025
4001ef6
Fix silent failures and improve documentation
pennycoders Nov 20, 2025
584b9fe
Fix comment inaccuracies and restore lint targets
pennycoders Nov 20, 2025
1dfb4ab
Make audio sample rate user-configurable
pennycoders Nov 20, 2025
57baa14
Fix frame size calculation for configurable sample rates
pennycoders Nov 20, 2025
2040db6
Fix USB Audio Gadget sample rate constraints
pennycoders Nov 20, 2025
0be9dbc
Enable ALSA rate resampling for configurable audio sample rates
pennycoders Nov 21, 2025
ae9cf78
fix(ota): set updating to false when no updates are available (#996)
ym Nov 21, 2025
05446df
fix(network): IPv6 addresses sorting was using wrong references (#997)
ym Nov 21, 2025
2175e5f
fix: hidRPC handshake packet should be only sent once (#969)
ym Nov 21, 2025
d0f1b75
fix: stop video stream before enabling sleep mode (#999)
ym Nov 21, 2025
9d86b02
Integrate libspeexdsp for high-quality audio resampling
pennycoders Nov 21, 2025
ac568c7
Fix HDMI hotplug crash by releasing mutex during blocking ALSA I/O
pennycoders Nov 21, 2025
7296638
Update default EDID to JetKVM 1920x1080@60Hz with audio support
pennycoders Nov 21, 2025
3692cda
Fix reversed stereo channels by querying ALSA channel map
pennycoders Nov 21, 2025
6989782
Remove redundant ALSA plugins (plug, rate) from build
pennycoders Nov 21, 2025
9e6ffb3
Add ARM NEON soft-clipper to prevent clipping on sharp transients
pennycoders Nov 21, 2025
2ef6cb2
Improve soft-clipper with validation, error handling, and overflow pr…
pennycoders Nov 21, 2025
60fcd91
Update default EDID to 1920x1080@60Hz
pennycoders Nov 21, 2025
fb6dbe5
Disable assertions in ALSA static library build
pennycoders Nov 21, 2025
5ed7008
Add NULL checks before snd_pcm_close() calls
pennycoders Nov 21, 2025
d4bd9db
Improve audio capture reliability and remove soft-clipping
pennycoders Nov 24, 2025
818a2ca
Update DefaultEDID to force 60Hz video output
pennycoders Nov 24, 2025
db2dc88
Fix HDMI audio sample rate detection for non-48kHz sources
pennycoders Nov 24, 2025
81ff87f
Address code review feedback and optimize stereo channel swapping
pennycoders Nov 24, 2025
0f8b368
Fix critical error handling and race conditions in audio system
pennycoders Nov 24, 2025
dc0ccf9
Fix HIGH priority issues in audio system
pennycoders Nov 24, 2025
8debd07
Remove redundant comments and fix time import
pennycoders Nov 24, 2025
cc7e608
Add automatic HDMI sample rate change detection
pennycoders Nov 24, 2025
aa0fe18
Merge branch 'dev' into feat/audio-support
pennycoders Nov 24, 2025
7580d00
Fix HDMI hotplug video restart after sleep mode changes
pennycoders Nov 24, 2025
f324496
Merge branch 'dev' into feat/audio-support
pennycoders Nov 24, 2025
3d1c2a1
Remove dead code and redundant checks in audio implementation
pennycoders Nov 24, 2025
d42024b
Fix audio quality and cleanup issues in audio implementation
pennycoders Nov 25, 2025
55bf170
Add memory barrier and improve error logging in audio implementation
pennycoders Nov 25, 2025
aeb6881
Fix misleading comment about decoder sample rate
pennycoders Nov 25, 2025
fe940cd
Fix buffer aliasing and cleanup unused fields in audio
pennycoders Nov 25, 2025
4cadf38
Remove unused sample rate and frame size parameters
pennycoders Nov 25, 2025
82562b7
Remove unnecessary NULL checks in configure_alsa_device
pennycoders Nov 25, 2025
9fe46d5
Skip TC358743 sample rate detection for USB audio
pennycoders Nov 25, 2025
89c0b28
Merge remote-tracking branch 'origin/dev' into feat/audio-support
pennycoders Nov 28, 2025
594efa6
Change default EDID display name to JetKVM
pennycoders Nov 28, 2025
5d43b37
Update default EDID with HDMI audio support
pennycoders Dec 2, 2025
820efe5
Update default EDID to compliant 1.3 with HDMI audio support
pennycoders Dec 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .devcontainer/install_audio_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#!/bin/bash
# .devcontainer/install_audio_deps.sh
# Build ALSA and Opus static libs for ARM in /opt/jetkvm-audio-libs
set -e

# Sudo wrapper function
function use_sudo() {
if [ "$UID" -eq 0 ] || [ -z "$(which sudo 2>/dev/null)" ]; then
"$@"
else
sudo -E "$@"
fi
}

# Accept version parameters or use defaults
ALSA_VERSION="${1:-1.2.14}"
OPUS_VERSION="${2:-1.5.2}"
SPEEXDSP_VERSION="${3:-1.2.1}"

AUDIO_LIBS_DIR="/opt/jetkvm-audio-libs"
BUILDKIT_PATH="/opt/jetkvm-native-buildkit"
BUILDKIT_FLAVOR="arm-rockchip830-linux-uclibcgnueabihf"
CROSS_PREFIX="$BUILDKIT_PATH/bin/$BUILDKIT_FLAVOR"

# Create directory with proper permissions
use_sudo mkdir -p "$AUDIO_LIBS_DIR"
use_sudo chmod 777 "$AUDIO_LIBS_DIR"
cd "$AUDIO_LIBS_DIR"

# Download sources
[ -f alsa-lib-${ALSA_VERSION}.tar.bz2 ] || wget -N https://www.alsa-project.org/files/pub/lib/alsa-lib-${ALSA_VERSION}.tar.bz2
[ -f opus-${OPUS_VERSION}.tar.gz ] || wget -N https://downloads.xiph.org/releases/opus/opus-${OPUS_VERSION}.tar.gz
[ -f speexdsp-${SPEEXDSP_VERSION}.tar.gz ] || wget -N https://ftp.osuosl.org/pub/xiph/releases/speex/speexdsp-${SPEEXDSP_VERSION}.tar.gz

# Extract
[ -d alsa-lib-${ALSA_VERSION} ] || tar xf alsa-lib-${ALSA_VERSION}.tar.bz2
[ -d opus-${OPUS_VERSION} ] || tar xf opus-${OPUS_VERSION}.tar.gz
[ -d speexdsp-${SPEEXDSP_VERSION} ] || tar xf speexdsp-${SPEEXDSP_VERSION}.tar.gz

# ARM Cortex-A7 optimization flags with NEON support
OPTIM_CFLAGS="-O2 -mfpu=neon -mtune=cortex-a7 -mfloat-abi=hard -DNDEBUG"

export CC="${CROSS_PREFIX}-gcc"
export CFLAGS="$OPTIM_CFLAGS"
export CXXFLAGS="$OPTIM_CFLAGS"

# Build ALSA
cd alsa-lib-${ALSA_VERSION}
if [ ! -f .built ]; then
chown -R $(whoami):$(whoami) .
# Minimal ALSA configuration for direct hw: device access with SpeexDSP resampling
CFLAGS="$OPTIM_CFLAGS" ./configure --host $BUILDKIT_FLAVOR \
--enable-static=yes --enable-shared=no \
--with-pcm-plugins=linear,copy \
--disable-seq --disable-rawmidi --disable-ucm \
--disable-python --disable-old-symbols \
--disable-topology --disable-hwdep --disable-mixer \
--disable-alisp --disable-aload --disable-resmgr
make -j$(nproc)
touch .built
fi
cd ..

# Build Opus
cd opus-${OPUS_VERSION}
if [ ! -f .built ]; then
chown -R $(whoami):$(whoami) .
CFLAGS="$OPTIM_CFLAGS" ./configure --host $BUILDKIT_FLAVOR --enable-static=yes --enable-shared=no --enable-fixed-point
make -j$(nproc)
touch .built
fi
cd ..

# Build SpeexDSP
cd speexdsp-${SPEEXDSP_VERSION}
if [ ! -f .built ]; then
chown -R $(whoami):$(whoami) .
# NEON-optimized high-quality resampler
CFLAGS="$OPTIM_CFLAGS" ./configure --host $BUILDKIT_FLAVOR \
--enable-static=yes --enable-shared=no \
--enable-neon \
--disable-examples
make -j$(nproc)
touch .built
fi
cd ..

echo "ALSA, Opus, and SpeexDSP built in $AUDIO_LIBS_DIR"
115 changes: 115 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# JetKVM Copilot Instructions

## Architecture Overview

JetKVM is a high-performance KVM-over-IP solution with **bidirectional architecture**: a Go backend running on ARM hardware and a React/TypeScript frontend served by the device. The system provides real-time video streaming, HID input, virtual media mounting, and **2-way audio support** via WebRTC.

### Core Components

- **Backend**: Go application (`main.go`, `web.go`, `webrtc.go`) handling WebRTC, HTTP APIs, hardware interfaces
- **Frontend**: React/TypeScript SPA (`ui/src/`) with Vite build system, served as embedded static files
- **Hardware Layer**: CGO bridge (`internal/native/`) to ARM SoC for video capture, USB gadget, display control
- **Audio System**: In-process CGO implementation (`internal/audio/`) with ALSA/Opus for USB Audio Gadget streaming
- **USB Gadget**: Configurable emulation (`internal/usbgadget/`) - keyboard, mouse, mass storage, **audio device**

## Development Workflows

### Quick Development Commands
```bash
# Full development deployment (most common)
./dev_deploy.sh -r <DEVICE_IP>

# UI-only changes (faster iteration)
cd ui && ./dev_device.sh <DEVICE_IP>

# Backend-only changes (skip UI build)
./dev_deploy.sh -r <DEVICE_IP> --skip-ui-build

# Build for release
make build_release
```

### Critical Build Dependencies
- **Audio libraries**: `make build_audio_deps` builds ALSA and Opus static libs for ARM
- **Native CGO**: `make build_native` compiles hardware interface layer
- **Cross-compilation**: ARM7 with buildkit toolchain at `/opt/jetkvm-native-buildkit`

### Testing
```bash
# Run Go tests on device
./dev_deploy.sh -r <DEVICE_IP> --run-go-tests

# UI linting
cd ui && npm run lint
```

## Project-Specific Patterns

### Configuration Management
- **Single config file**: `/userdata/kvm_config.json` persisted across updates
- **Config struct**: `config.go` with JSON tags, atomic operations for thread safety
- **Migration pattern**: Use `ensureConfigLoaded()` before config access

### WebRTC Architecture
- **Session management**: `webrtc.go` handles peer connections with connection pooling
- **Media tracks**: Separate video and **stereo audio tracks** in independent MediaStreams
- **Data channels**: RPC (ordered), HID (unordered), upload, terminal, serial channels
- **SDP munging**: Frontend modifies SDP for Opus stereo parameters (`OPUS_STEREO_PARAMS`)

### Audio Implementation Details
- **USB Audio Gadget**: UAC1 device presenting as stereo speakers + microphone
- **Bidirectional streaming**: Output (device→browser) and input (browser→device)
- **CGO integration**: `internal/audio/cgo_source.go` bridges Go↔C for ALSA operations
- **Frame-based processing**: 20ms Opus frames (960 samples @ 48kHz) for low latency

### Frontend State Management
- **Zustand stores**: `hooks/stores.ts` - RTC, UI, Settings, Video state with persistence
- **JSON-RPC communication**: `useJsonRpc` hook for backend API calls
- **Localization**: Paraglide.js with compile-time validation - all UI strings use `m.key()` pattern

### USB Gadget Configuration
- **Configfs-based**: Dynamic reconfiguration via `/sys/kernel/config/usb_gadget/`
- **Transaction pattern**: `WithTransaction()` ensures atomic gadget changes
- **Device composition**: Keyboard + mouse + mass storage + **audio** with individual toggle support

## Integration Patterns

### Backend API Structure
- **JSON-RPC over WebSocket**: Primary communication via data channels
- **HTTP endpoints**: `/api/*` for REST operations, `/static/*` for UI assets
- **Configuration endpoints**: `rpc*` functions in `jsonrpc.go` with parameter validation

### Cross-Component Communication
- **Video pipeline**: `native.go` → WebRTC track → browser via H.264 streaming
- **HID input**: Browser → WebRTC data channel → `internal/usbgadget/hid_*.go` → Linux gadget
- **Audio pipeline**: ALSA capture → Opus encode → WebRTC → browser speakers (and reverse for mic)
- **Virtual media**: HTTP upload → storage → NBD server → USB mass storage gadget

### Error Handling Patterns
- **Graceful degradation**: Audio/video failures don't crash core functionality
- **Session isolation**: Per-connection logging with `connectionID` context
- **Recovery mechanisms**: USB gadget timeouts, audio restart on device changes

## Key Files for Common Tasks

### Adding new RPC endpoints
1. Add handler function in `jsonrpc.go`
2. Register in `rpcHandlers` map
3. Add frontend hook in `useJsonRpc`

### USB device modifications
- `internal/usbgadget/config.go` - gadget composition and attributes
- `internal/usbgadget/hid_*.go` - HID device implementations

### Audio feature development
- `audio.go` - high-level audio management and session integration
- `internal/audio/` - CGO sources, relays, and C audio processing

### Frontend feature development
- `ui/src/routes/` - page components
- `ui/src/components/` - reusable UI components
- `ui/localization/messages/en.json` - localizable strings

---

*This codebase uses advanced patterns like CGO, USB gadgets, and real-time media streaming. Focus on understanding the session lifecycle and cross-compilation requirements for effective development.*
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,14 @@ node_modules
#internal/native/include
#internal/native/lib

ui/reports
ui/reports

# Log files
*.log
app.log
deploy.log

# Development files
.devcontainer.json
utilities/
core
15 changes: 15 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ If you're using Windows, we strongly recommend using **WSL (Windows Subsystem fo

This ensures compatibility with shell scripts and build tools used in the project.

#### Using DevPod

**For Apple Silicon (M1/M2/M3/M4) Mac users:** You must set the Docker platform to `linux/amd64` before starting the DevPod container, as the JetKVM build system requires x86_64 architecture:

```bash
export DOCKER_DEFAULT_PLATFORM=linux/amd64
devpod up . --id kvm --provider docker --devcontainer-path .devcontainer/docker/devcontainer.json
```

After the container starts, you'll need to manually install build dependencies:

```bash
bash .devcontainer/install-deps.sh
```

### Project Setup

1. **Clone the repository:**
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ ENV GOPATH=/go
ENV PATH=$GOPATH/bin:/usr/local/go/bin:$PATH

COPY install-deps.sh /install-deps.sh
COPY install_audio_deps.sh /install_audio_deps.sh

RUN /install-deps.sh

# Create build directory
Expand All @@ -21,4 +23,4 @@ RUN go mod download && go mod verify
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

ENTRYPOINT [ "/entrypoint.sh" ]
ENTRYPOINT [ "/entrypoint.sh" ]
34 changes: 33 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ BIN_DIR := $(shell pwd)/bin

TEST_DIRS := $(shell find . -name "*_test.go" -type f -exec dirname {} \; | sort -u)

# Build ALSA and Opus static libs for ARM in /opt/jetkvm-audio-libs
build_audio_deps:
bash .devcontainer/install_audio_deps.sh

build_native:
@if [ "$(SKIP_NATIVE_IF_EXISTS)" = "1" ] && [ -f "internal/native/cgo/lib/libjknative.a" ]; then \
echo "libjknative.a already exists, skipping native build..."; \
Expand Down Expand Up @@ -136,4 +140,32 @@ release:
@echo "Uploading release..."
@shasum -a 256 bin/jetkvm_app | cut -d ' ' -f 1 > bin/jetkvm_app.sha256
rclone copyto bin/jetkvm_app r2://jetkvm-update/app/$(VERSION)/jetkvm_app
rclone copyto bin/jetkvm_app.sha256 r2://jetkvm-update/app/$(VERSION)/jetkvm_app.sha256
rclone copyto bin/jetkvm_app.sha256 r2://jetkvm-update/app/$(VERSION)/jetkvm_app.sha256
# Run golangci-lint locally with the same configuration as CI
lint-go: build_audio_deps
@echo "Running golangci-lint..."
@mkdir -p static && touch static/.gitkeep
golangci-lint run --verbose

# Run both Go and UI linting with auto-fix
lint-fix: lint-go-fix lint-ui-fix
@echo "All linting with auto-fix completed successfully!"

# Run golangci-lint with auto-fix
lint-go-fix: build_audio_deps
@echo "Running golangci-lint with auto-fix..."
@mkdir -p static && touch static/.gitkeep
golangci-lint run --fix --verbose

# Run UI linting locally (mirrors GitHub workflow ui-lint.yml)
lint-ui:
@echo "Running UI lint..."
@cd ui && npm ci && npm run lint

# Run UI linting with auto-fix
lint-ui-fix:
@echo "Running UI lint with auto-fix..."
@cd ui && npm ci && npm run lint:fix

# Legacy alias for UI linting (for backward compatibility)
ui-lint: lint-ui
Loading