Files
79_IPKVM_board/功能说明.md
fml a344f2fd8d Initial commit: IP-KVM server implementation with complete functionality
Core Features:
- Web server based on Mongoose framework listening on port 82
- WebSocket support for real-time mouse and keyboard control
- Serial communication via /dev/ttyS5 (115200 baud rate)
- GPIO-based hardware control (GPIO 34/35 for shutdown/reboot, GPIO 139 for reset)
- User authentication and management system
- Network configuration management with dynamic updates
- MJPG-streamer integration for video streaming (port 8080, 1920x1080)
- File upload support with chunked transfer capability
- Hardware reset functionality via GPIO button

Technical Implementation:
- Mouse protocol conversion to serial data format {0x57, 0xAB, ...}
- Keyboard input handling with proper HID report generation
- Real-time configuration updates without service restart
- Thread-based GPIO monitoring for hardware events
- Authentication integration with MJPG-streamer
- Default configuration restoration on hardware reset

Configuration Files:
- /mnt/user.txt - User credentials storage
- /etc/init.d/xnet.conf - Network configuration
- /www/webcam - Web interface files

Documentation:
- Complete functional specification in Chinese (功能说明.md)
- Detailed WebSocket message protocol documentation
- GPIO mapping and hardware control specifications

This is a complete standalone IP-KVM server that enables remote
keyboard, video, and mouse control over IP networks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-13 13:29:13 +08:00

121 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# xtell_server 功能说明
## 概述
xtell_server 是一个基于 Mongoose 库的嵌入式 Web 服务器,用于 IP-KVM (Keyboard-Video-Mouse over IP) 远程控制系统。
## 主要功能
### 1. Web 服务器功能
- 监听端口 82提供 HTTP 服务
- 支持 WebSocket 连接和文件上传
- 使用 Mongoose 库处理 HTTP 请求
### 2. 远程控制功能
- **鼠标控制**: 接收 WebSocket 鼠标指令,转换为串口协议数据
- 数据格式: `{0x57, 0xAB, 0x00, 0x04, 0x07, 0x02, ..., checksum}`
- 通过 `/dev/ttyS5` 串口通信 (波特率 115200)
- **键盘控制**: 接收 WebSocket 键盘指令,转换为串口协议数据
- 数据格式: `{0x57,0xAB,0x00,0x02,0x08,0x00, ..., checksum}`
### 3. 用户管理系统
- 用户名密码修改功能
- 认证信息存储在 `/mnt/user.txt`
- 支持 MJPG-streamer 认证配置
- 默认配置检测和创建
### 4. 网络配置管理
- IP 地址、子网掩码、网关、DNS 配置
- 配置文件存储在 `/etc/init.d/xnet.conf`
- 支持网络配置动态更新
- 默认 IP: 192.168.6.100, 端口: 8700
### 5. 系统控制功能
- **关机控制**: 通过 GPIO 35 控制系统关机
- **重启控制**: 通过 GPIO 34 控制系统重启
- 支持远程关机和重启操作
### 6. 视频流管理
- 启动和管理 MJPG-streamer 服务
- 支持认证的视频流传输 (端口 8080)
- 分辨率: 1920x1080
- 动态用户认证配置
### 7. GPIO 按键处理
- GPIO 139 按键检测线程
- 按键触发时恢复默认网络配置
- 硬件重置功能
- 自动重启 MJPG-streamer 服务
### 8. 文件上传功能
- 支持分块文件上传
- 上传端点: `/upload`
- 上传路径: `/mnt/UDISK/gcode.nc`
- 支持大文件分块传输
## 技术架构
### 核心依赖
- **Mongoose**: 嵌入式 Web 服务器框架
- **MJPG-streamer**: 视频流服务
- **Linux GPIO**: 硬件控制接口
- **串口通信**: `/dev/ttyS5`
### 配置文件
- `/mnt/user.txt`: 用户认证信息
- `/etc/init.d/xnet.conf`: 网络配置
- `/www/webcam`: Web 界面文件
### GPIO 映射
- GPIO 34: 系统重启控制
- GPIO 35: 系统关机控制
- GPIO 139: 硬件重置按键
## WebSocket 消息协议
### 鼠标控制
```
mouse,x1,y1,x2,y2,buttons,scroll
```
### 键盘控制
```
keyboard,key_code,modifier
```
### 用户管理
```
newuser,oldUser,oldPass,newUser,newPass
```
### 网络配置
```
newip,ip,mask,gw,dns1,dns2
```
### 系统控制
```
control,shutdown|reboot
```
## 运行流程
1. **初始化阶段**:
- 读取用户配置
- 启动 MJPG-streamer
- 配置 GPIO
- 初始化串口
- 启动 GPIO 监控线程
2. **服务阶段**:
- 监听 HTTP/WebSocket 连接
- 处理客户端指令
- 转发键鼠数据到串口
- 管理系统配置
3. **硬件重置**:
- GPIO 139 按键触发
- 恢复默认网络配置
- 重启相关服务
## 独立性
xtell_server 是一个完整的独立应用程序,不需要其他组件配合即可正常运行所有功能。