-
Notifications
You must be signed in to change notification settings - Fork 73
Implement virtio-input for keyboard and mouse #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9152699
Add linux configs
Mes0903 399ec53
Implement virtio-input for keyboard and mouse
Mes0903 6b8b0e1
Ignore build outputs and working directories
Mes0903 a467a7b
Enable SDL offscreen mode explicitly in CI
Mes0903 023bba4
Add input event debug logging
Mes0903 5c24de0
Introduce SPSC queue to handle virtio-input event
Mes0903 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
| . "${SCRIPT_DIR}/common.sh" | ||
|
|
||
| # Override timeout for macOS - emulation is significantly slower | ||
| case "${OS_TYPE}" in | ||
| Darwin) | ||
| TIMEOUT=1200 | ||
| ;; | ||
| esac | ||
|
|
||
| cleanup | ||
| trap cleanup EXIT | ||
|
|
||
| # Feature toggles are passed through environment variables, which do not | ||
| # participate in make's normal dependency tracking. Force a rebuild here so | ||
| # one-feature-at-a-time test runs never reuse a stale semu binary. | ||
| make -B semu minimal.dtb | ||
|
|
||
| # NOTE: We want to capture the expect exit code and map | ||
| # it to our MESSAGES array for meaningful error output. | ||
| # Temporarily disable errexit for the expect call. | ||
| set +e | ||
| expect <<'DONE' | ||
| set timeout $env(TIMEOUT) | ||
| spawn make check | ||
|
|
||
| # Boot and login | ||
| expect "buildroot login:" { send "root\r" } timeout { exit 1 } | ||
| expect "# " { send "uname -a\r" } timeout { exit 2 } | ||
| expect "riscv32 GNU/Linux" {} | ||
|
|
||
| # ---------------- virtio-input ---------------- | ||
| # Require actual event* nodes, not just /dev/input directory existence. | ||
| # Print a concrete status marker that is not present in the echoed command text. | ||
| expect "# " { send "if ls /dev/input/event* >/dev/null 2>&1; then status=OK; else status=BAD; fi; printf \"__EVT_%s__\\n\" \"\$status\"\r" } | ||
| expect { | ||
| -exact "__EVT_OK__" {} | ||
| -exact "__EVT_BAD__" { exit 3 } | ||
| timeout { exit 3 } | ||
| } | ||
|
|
||
| expect "# " { send "cat /proc/bus/input/devices | head -20\r" } | ||
| # Emit a shell-expanded status marker so expect cannot match the echoed command. | ||
| expect "# " { send "if grep -qi virtio /proc/bus/input/devices; then status=OK; else status=BAD; fi; printf \"__VPROC_%s__\\n\" \"\$status\"\r" } | ||
| expect { | ||
| -exact "__VPROC_OK__" {} | ||
| -exact "__VPROC_BAD__" { exit 3 } | ||
| timeout { exit 3 } | ||
| } | ||
| DONE | ||
|
|
||
| ret="$?" | ||
| set -e # Re-enable errexit after capturing expect's return code | ||
|
|
||
| MESSAGES=( | ||
| "PASS: headless virtio-input checks" | ||
| "FAIL: boot/login prompt not found" | ||
| "FAIL: shell prompt not found" | ||
| "FAIL: virtio-input basic checks failed (/dev/input/event* or /proc/bus/input/devices)" | ||
| "FAIL: virtio-input event stream did not produce bytes (needs host->virtio-input injection path)" | ||
| ) | ||
|
|
||
| if [[ "${ret}" -eq 0 ]]; then | ||
| print_success "${MESSAGES[0]}" | ||
| exit 0 | ||
| fi | ||
|
|
||
| print_error "${MESSAGES[${ret}]:-FAIL: unknown error (exit code ${ret})}" | ||
| exit "${ret}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.