-
Notifications
You must be signed in to change notification settings - Fork 3
feat: add PiKVM module #247
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
base: main
Are you sure you want to change the base?
Conversation
9dbc7d7 to
ad77246
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice changes, looks pretty clean overall. Just some thoughts:
- Maybe separate the power,virtual-media,keyboard functionalities into separate files for better readability
- 'combo' -> key-combo
Tell me what you think 😄
ad77246 to
ae564e7
Compare
I think thats a good idea :) |
ae564e7 to
4e04fe1
Compare
2183a74 to
9454670
Compare
jenstopp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, full KVM feature set implemented 🚀 :)
pkg/module/pikvm/pikvm.go
Outdated
| func (p *PiKVM) doRequest(ctx context.Context, method, urlPath string, body io.Reader, contentType string) (*http.Response, error) { | ||
| return p.doRequestWithOptions(ctx, method, urlPath, body, contentType, requestOptions{}) | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this for testing purposes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is for the purpose of not having 3 different methods and combine them within one with the requestOptions input
| func (p *PiKVM) buildRequestURL(urlPath string) (string, error) { | ||
| targetURL := *p.baseURL | ||
|
|
||
| parsedPath, err := url.Parse(urlPath) | ||
| if err != nil { | ||
| return "", fmt.Errorf("invalid URL path: %v", err) | ||
| } | ||
|
|
||
| targetURL.Path = path.Join(targetURL.Path, parsedPath.Path) | ||
| targetURL.RawQuery = parsedPath.RawQuery | ||
|
|
||
| return targetURL.String(), nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this done during init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you change anything?
The PiKVM module provides comprehensive control of a DUT via a PiKVM device. It offers power management through ATX control, keyboard input simulation, and virtual media mounting capabilities. Power management commands: on, off, force-off, reset, force-reset, and status. Keyboard control commands: type, key, combo, and paste. Virtual media commands: mount, mount-url, unmount, and media-status. The module connects to a PiKVM device using HTTP/HTTPS with configurable host, user, password, and timeout. It supports both short and long ATX button presses for power and reset control, allows sending keyboard input and key combinations, and enables mounting ISO images from local files or URLs. Signed-off-by: llogen <christoph.lange@blindspot.software>
Signed-off-by: llogen <christoph.lange@blindspot.software>
Add support for streaming file transfers in 1MB chunks to avoid loading large disk images entirely into memory. This fixes OOM issues and connection timeouts when transferring multi-gigabyte files. Changes: - Add FileChunk message to protobuf for streaming file transfers - Implement sendFileInChunks() in client to stream files in 1MB chunks - Implement receiveFileChunk() in client for incoming chunked files - Update agent session to write chunks directly to temp files - Update agent worker to stream files to client in chunks - Remove verbose logging from ChanReader to reduce noise The chunked approach reduces memory usage from ~5GB+ for a 5GB file transfer down to ~1-2MB (only the current chunk in memory). Backward compatible: old File message still supported for small files.
Avoid unnecessary file transfers by calculating SHA256 hash on the client side and checking PiKVM storage before transferring files. Workflow optimization: - Client calculates file hash locally (automated in dutctl) - Agent checks if image already exists on PiKVM by hash - If exists: mount directly without transfer (saves minutes) - If missing: request file from client and upload This significantly improves the user experience when mounting the same disk image multiple times, reducing the operation from ~2-3 minutes (full transfer) to ~2 seconds (hash check only). Example: ./dutctl -s server:1024 device media mount ~/image.img First mount: Calculates hash, transfers 3.5GB, uploads to PiKVM Second mount: Calculates hash, finds on PiKVM, mounts immediately Changes: - Add preprocessArgs() to dutctl for automatic hash calculation - Update PiKVM handleMount() to accept precomputed hash and size - Check PiKVM storage before requesting file from client - Backward compatible: works without hash (calculates server-side)
Signed-off-by: llogen <christoph.lange@blindspot.software>
ec724a1 to
4be888f
Compare
|
Please put the changes to the file transfer out of this PR (maybe in a separate one). These are serious changes to the core code and need more detailed review and testing. |
@llogen ? I saw the separate PR for the reworked file transfer, but what about getting this parts out of here, so we can get this PR merged? |
The PiKVM module provides comprehensive control of a DUT via a PiKVM device. It offers power management through ATX control, keyboard input simulation, and virtual media mounting capabilities.
Power management commands: on, off, force-off, reset, force-reset,
and status. Keyboard control commands: type, key, combo, and paste.
Virtual media commands: mount, mount-url, unmount, and media-status.
The module connects to a PiKVM device using HTTP/HTTPS with configurable host, user, password, and timeout. It supports both short and long ATX button presses for power and reset control, allows sending keyboard input and key combinations, and enables mounting ISO images from local files or URLs.
resolves #246