Skip to content

Commit 3e7e857

Browse files
committed
Update App version to 0.0.3
1 parent 15d2766 commit 3e7e857

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+2836
-791
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ static/*
66
package-lock.json
77
package.json
88
node_modules/
9-
9+
ui/.i18n_extractor.json
1010

1111
device-tests.tar.gz

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
22
BUILDDATE ?= $(shell date -u +%FT%T%z)
33
BUILDTS ?= $(shell date -u +%s)
44
REVISION ?= $(shell git rev-parse HEAD)
5-
VERSION_DEV ?= 0.0.2-dev
6-
VERSION ?= 0.0.2
5+
VERSION_DEV ?= 0.0.3-dev
6+
VERSION ?= 0.0.3
77

88
PROMETHEUS_TAG := github.com/prometheus/common/version
99
KVM_PKG_NAME := kvm

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
![luckfox](https://github.com/LuckfoxTECH/luckfox-pico/assets/144299491/cec5c4a5-22b9-4a9a-abb1-704b11651e88)
2+
[中文](./README_CN.md)
3+
# Luckfox PicoKVM
4+
Luckfox PicoKVM is a lightweight IP KVM operation and maintenance tool. It allows remote access to a target device’s display and simulates HID input over the network, enabling contactless operation and management of development boards, PCs, and servers. The product delivers stable, low-latency video capture and remote control, making it well-suited for scenarios such as remote computer management and server maintenance. The software is based on a secondary development of JetKVM.
5+
6+
## Features
7+
* **Micro SD card support**: Used for software boot settings or storage expansion
8+
* **USB multifunction configuration**: Supports emulating a USB sound card or MTP device. Files in the shared MTP directory can be uploaded or downloaded via HTTP
9+
* **Serial port control**: Connects to the serial port of the controlled device for control and debugging
10+
* **IO level configuration**: Controls expansion IO output (high/low level)
11+
* **1.54-inch touchscreen**: Displays IP address, connection status, and system runtime status
12+
* **Multiple remote access methods**: Remote management via WebRTC through cross-network connections or FRP reverse proxy
13+
14+
## Compilation
15+
* Compile frontend only
16+
```bash
17+
make frontend
18+
```
19+
* Compile backend only
20+
```bash
21+
make build_dev
22+
```
23+
* Full compilation
24+
```bash
25+
make build_release
26+
```
27+
28+
## Detailed Usage Instructions
29+
[Luckfox PicoKVM](https://wiki.luckfox.com/Luckfox-PicoKVM/)

README_CN.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
![luckfox](https://github.com/LuckfoxTECH/luckfox-pico/assets/144299491/cec5c4a5-22b9-4a9a-abb1-704b11651e88)
2+
[English](./README.md)
3+
# Luckfox PicoKVM
4+
Luckfox PicoKVM 是一款轻量级 IP KVM 运维工具,支持通过网络远程获取目标设备画面并模拟 HID 输入,实现对开发板、电脑及服务器等系统的无接触运维管理。该产品具备稳定、低延迟的视频采集和远程控制能力,广泛适用于远程电脑控制和服务器维护等场景。软件基于 JetKVM 二次开发。
5+
6+
## 特性
7+
* **Micro SD 卡支持**:可用于软件启动设置或存储拓展
8+
* **USB 多功能配置**:支持模拟 USB 声卡或 MTP 设备,在 MTP 共享目录下可通过 HTTP 上传或下载文件
9+
* **串口控制**:可连接受控设备的串口,实现对受控设备的串口控制和调试
10+
* **IO 电平配置**:控制拓展 IO 输出高低电平
11+
* **1.54 寸触控屏幕**:显示 IP 地址、连接状态及系统运行状态
12+
* **多种远程访问方案**:使用 WebRTC 通过异域组网或 FRP 端口反向代理进行远程管理
13+
14+
## 编译
15+
* 仅编译前端
16+
```bash
17+
make frontend
18+
```
19+
* 仅编译后端
20+
```bash
21+
make build_dev
22+
```
23+
* 完整编译
24+
```bash
25+
make build_release
26+
```
27+
28+
## 详细使用说明
29+
[Luckfox PicoKVM](https://wiki.luckfox.com/zh/Luckfox-PicoKVM/)

config.go

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ type Config struct {
114114
TimeZone string `json:"time_zone"`
115115
LEDGreenMode string `json:"led_green_mode"`
116116
LEDYellowMode string `json:"led_yellow_mode"`
117+
AutoMountSystemInfo bool `json:"auto_mount_system_info_img"`
118+
EasytierAutoStart bool `json:"easytier_autostart"`
119+
EasytierConfig EasytierConfig `json:"easytier_config"`
117120
}
118121

119122
const configPath = "/userdata/kvm_config.json"
@@ -146,17 +149,18 @@ var defaultConfig = &Config{
146149
Audio: false, //At any given time, only one of Audio and Mtp can be set to true
147150
Mtp: false,
148151
},
149-
NetworkConfig: &network.NetworkConfig{},
150-
DefaultLogLevel: "INFO",
151-
ZeroTierAutoStart: false,
152-
TailScaleAutoStart: false,
153-
TailScaleXEdge: false,
154-
FrpcAutoStart: false,
155-
IO0Status: true,
156-
IO1Status: true,
157-
AudioMode: "disabled",
158-
LEDGreenMode: "network-rx",
159-
LEDYellowMode: "kernel-activity",
152+
NetworkConfig: &network.NetworkConfig{},
153+
DefaultLogLevel: "INFO",
154+
ZeroTierAutoStart: false,
155+
TailScaleAutoStart: false,
156+
TailScaleXEdge: false,
157+
FrpcAutoStart: false,
158+
IO0Status: true,
159+
IO1Status: true,
160+
AudioMode: "disabled",
161+
LEDGreenMode: "network-rx",
162+
LEDYellowMode: "kernel-activity",
163+
AutoMountSystemInfo: true,
160164
}
161165

162166
var (
@@ -174,15 +178,16 @@ func LoadConfig() {
174178
}
175179

176180
// load the default config
177-
config = defaultConfig
178-
if config.UsbConfig.SerialNumber == "" {
181+
if defaultConfig.UsbConfig.SerialNumber == "" {
179182
serialNumber, err := extractSerialNumber()
180183
if err != nil {
181184
logger.Warn().Err(err).Msg("failed to extract serial number")
182185
} else {
183-
config.UsbConfig.SerialNumber = serialNumber
186+
defaultConfig.UsbConfig.SerialNumber = serialNumber
184187
}
185188
}
189+
loadedConfig := *defaultConfig
190+
config = &loadedConfig
186191

187192
file, err := os.Open(configPath)
188193
if err != nil {
@@ -192,7 +197,6 @@ func LoadConfig() {
192197
defer file.Close()
193198

194199
// load and merge the default config with the user config
195-
loadedConfig := *defaultConfig
196200
if err := json.NewDecoder(file).Decode(&loadedConfig); err != nil {
197201
logger.Warn().Err(err).Msg("config file JSON parsing failed")
198202
os.Remove(configPath)

internal/usbgadget/udc.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,15 @@ func (u *UsbGadget) IsUDCBound() (bool, error) {
8080

8181
// BindUDC binds the gadget to the UDC.
8282
func (u *UsbGadget) BindUDC() error {
83-
err := os.WriteFile(path.Join(udcPath, "bind"), []byte(u.udc), 0644)
83+
err := os.WriteFile(udcPath, []byte(u.udc), 0644)
84+
if err != nil {
85+
return fmt.Errorf("error binding UDC: %w", err)
86+
}
87+
return nil
88+
}
89+
90+
func (u *UsbGadget) BindUDCToDWC3() error {
91+
err := os.WriteFile(path.Join(dwc3Path, "bind"), []byte(u.udc), 0644)
8492
if err != nil {
8593
return fmt.Errorf("error binding UDC: %w", err)
8694
}
@@ -89,7 +97,15 @@ func (u *UsbGadget) BindUDC() error {
8997

9098
// UnbindUDC unbinds the gadget from the UDC.
9199
func (u *UsbGadget) UnbindUDC() error {
92-
err := os.WriteFile(path.Join(udcPath, " "), []byte(u.udc), 0644)
100+
err := os.WriteFile(udcPath, []byte("none"), 0644)
101+
if err != nil {
102+
return fmt.Errorf("error unbinding UDC: %w", err)
103+
}
104+
return nil
105+
}
106+
107+
func (u *UsbGadget) UnbindUDCToDWC3() error {
108+
err := os.WriteFile(path.Join(dwc3Path, "unbind"), []byte(u.udc), 0644)
93109
if err != nil {
94110
return fmt.Errorf("error unbinding UDC: %w", err)
95111
}

internal/usbgadget/usbgadget.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ type UsbGadget struct {
8484
log *zerolog.Logger
8585

8686
logSuppressionCounter map[string]int
87+
logLock sync.Mutex
8788
}
8889

8990
const configFSPath = "/sys/kernel/config"

internal/usbgadget/utils.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ func compareFileContent(oldContent []byte, newContent []byte, looserMatch bool)
8282
}
8383

8484
func (u *UsbGadget) logWithSupression(counterName string, every int, logger *zerolog.Logger, err error, msg string, args ...interface{}) {
85+
u.logLock.Lock()
86+
defer u.logLock.Unlock()
87+
8588
if _, ok := u.logSuppressionCounter[counterName]; !ok {
8689
u.logSuppressionCounter[counterName] = 0
8790
} else {

jsonrpc.go

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,9 @@ func rpcGetUsbEmulationState() (bool, error) {
628628

629629
func rpcSetUsbEmulationState(enabled bool) error {
630630
if enabled {
631-
return gadget.BindUDC()
631+
return gadget.BindUDCToDWC3()
632632
} else {
633-
return gadget.UnbindUDC()
633+
return gadget.UnbindUDCToDWC3()
634634
}
635635
}
636636

@@ -663,7 +663,8 @@ func rpcSetWakeOnLanDevices(params SetWakeOnLanDevicesParams) error {
663663
}
664664

665665
func rpcResetConfig() error {
666-
config = defaultConfig
666+
loadedConfig := *defaultConfig
667+
config = &loadedConfig
667668
if err := SaveConfig(); err != nil {
668669
return fmt.Errorf("failed to reset config: %w", err)
669670
}
@@ -1029,6 +1030,18 @@ func rpcGetLedYellowMode() (string, error) {
10291030
return config.LEDYellowMode, nil
10301031
}
10311032

1033+
func rpcGetAutoMountSystemInfo() (bool, error) {
1034+
return config.AutoMountSystemInfo, nil
1035+
}
1036+
1037+
func rpcSetAutoMountSystemInfo(enabled bool) error {
1038+
config.AutoMountSystemInfo = enabled
1039+
if err := SaveConfig(); err != nil {
1040+
return fmt.Errorf("failed to save config: %w", err)
1041+
}
1042+
return nil
1043+
}
1044+
10321045
var rpcHandlers = map[string]RPCHandler{
10331046
"ping": {Func: rpcPing},
10341047
"reboot": {Func: rpcReboot, Params: []string{"force"}},
@@ -1084,6 +1097,8 @@ var rpcHandlers = map[string]RPCHandler{
10841097
"mountWithWebRTC": {Func: rpcMountWithWebRTC, Params: []string{"filename", "size", "mode"}},
10851098
"mountWithStorage": {Func: rpcMountWithStorage, Params: []string{"filename", "mode"}},
10861099
"mountWithSDStorage": {Func: rpcMountWithSDStorage, Params: []string{"filename", "mode"}},
1100+
"setAutoMountSystemInfo": {Func: rpcSetAutoMountSystemInfo, Params: []string{"enabled"}},
1101+
"getAutoMountSystemInfo": {Func: rpcGetAutoMountSystemInfo},
10871102
"listStorageFiles": {Func: rpcListStorageFiles},
10881103
"deleteStorageFile": {Func: rpcDeleteStorageFile, Params: []string{"filename"}},
10891104
"startStorageFileUpload": {Func: rpcStartStorageFileUpload, Params: []string{"filename", "size"}},
@@ -1121,7 +1136,7 @@ var rpcHandlers = map[string]RPCHandler{
11211136
"getSDMountStatus": {Func: rpcGetSDMountStatus},
11221137
"loginTailScale": {Func: rpcLoginTailScale, Params: []string{"xEdge"}},
11231138
"logoutTailScale": {Func: rpcLogoutTailScale},
1124-
"canelTailScale": {Func: rpcCanelTailScale},
1139+
"cancelTailScale": {Func: rpcCancelTailScale},
11251140
"getTailScaleSettings": {Func: rpcGetTailScaleSettings},
11261141
"loginZeroTier": {Func: rpcLoginZeroTier, Params: []string{"networkID"}},
11271142
"logoutZeroTier": {Func: rpcLogoutZeroTier, Params: []string{"networkID"}},
@@ -1134,4 +1149,10 @@ var rpcHandlers = map[string]RPCHandler{
11341149
"getFrpcStatus": {Func: rpcGetFrpcStatus},
11351150
"getFrpcToml": {Func: rpcGetFrpcToml},
11361151
"getFrpcLog": {Func: rpcGetFrpcLog},
1152+
"startEasyTier": {Func: rpcStartEasyTier, Params: []string{"name", "secret", "node"}},
1153+
"stopEasyTier": {Func: rpcStopEasyTier},
1154+
"getEasyTierStatus": {Func: rpcGetEasyTierStatus},
1155+
"getEasyTierConfig": {Func: rpcGetEasyTierConfig},
1156+
"getEasyTierLog": {Func: rpcGetEasyTierLog},
1157+
"getEasyTierNodeInfo": {Func: rpcGetEasyTierNodeInfo},
11371158
}

ota.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ var UpdateMetadataUrls = []string{
5959
"https://api.github.com/repos/luckfox-eng29/kvm/releases/latest",
6060
}
6161

62-
var builtAppVersion = "0.0.2+dev"
62+
var builtAppVersion = "0.0.3+dev"
6363

6464
var updateSource = "github"
6565

0 commit comments

Comments
 (0)