Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
car-controlserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenzhongjian
car-controlserver
Commits
a9d72472
Commit
a9d72472
authored
Dec 25, 2025
by
DESKTOP-MC5UL36\dell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hardware_iic读取失败会导致不上线,python文件下载的bug
parent
dcbd8165
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
62 deletions
+59
-62
hardware_iic.c
drivers/gpio/hardware_iic.c
+2
-4
go_deploy.c
modules/go_deploy/go_deploy.c
+57
-58
No files found.
drivers/gpio/hardware_iic.c
View file @
a9d72472
...
@@ -77,11 +77,9 @@ int hardware_iic_write(uint8_t device_addr, uint8_t reg_addr, const uint8_t *dat
...
@@ -77,11 +77,9 @@ int hardware_iic_write(uint8_t device_addr, uint8_t reg_addr, const uint8_t *dat
my_zlog_warn
(
"错误:向设备 0x%02X 寄存器 0x%02X 写入数据失败。"
,
device_addr
,
reg_addr
);
my_zlog_warn
(
"错误:向设备 0x%02X 寄存器 0x%02X 写入数据失败。"
,
device_addr
,
reg_addr
);
break
;
break
;
}
}
ret
=
0
;
// 成功
pthread_mutex_unlock
(
&
i2c_mutex
);
ret
=
0
;
// 成功
}
while
(
0
);
}
while
(
0
);
pthread_mutex_unlock
(
&
i2c_mutex
);
// my_zlog_info("成功向设备 0x%02X 寄存器 0x%02X 写入 %d 字节数据。", device_addr, reg_addr, len);
// my_zlog_info("成功向设备 0x%02X 寄存器 0x%02X 写入 %d 字节数据。", device_addr, reg_addr, len);
return
ret
;
return
ret
;
}
}
...
...
modules/go_deploy/go_deploy.c
View file @
a9d72472
...
@@ -290,79 +290,78 @@ int go_deploy_check_and_update(void) {
...
@@ -290,79 +290,78 @@ int go_deploy_check_and_update(void) {
if
(
access
(
target_file_path
,
F_OK
)
==
0
)
{
if
(
access
(
target_file_path
,
F_OK
)
==
0
)
{
chmod
(
target_file_path
,
0777
);
chmod
(
target_file_path
,
0777
);
}
}
}
// ---------------------------------------------------------
// 处理 video_proxy.7z
// 处理 video_proxy.7z
cJSON
*
pythonUrl
=
cJSON_GetObjectItem
(
moreInfo
,
"pythonUrl"
);
// ---------------------------------------------------------
if
(
pythonUrl
&&
cJSON_IsString
(
pythonUrl
)
&&
strlen
(
pythonUrl
->
valuestring
)
>
0
)
{
cJSON
*
pythonUrl
=
cJSON_GetObjectItem
(
moreInfo
,
"pythonUrl"
);
char
target_7z_path
[
512
];
if
(
pythonUrl
&&
cJSON_IsString
(
pythonUrl
)
&&
strlen
(
pythonUrl
->
valuestring
)
>
0
)
{
snprintf
(
target_7z_path
,
sizeof
(
target_7z_path
),
"%s/video_proxy.7z"
,
target_dir
);
char
target_7z_path
[
512
];
snprintf
(
target_7z_path
,
sizeof
(
target_7z_path
),
"%s/video_proxy.7z"
,
target_dir
);
int
need_download_7z
=
0
;
int
need_download_7z
=
0
;
// 检查文件是否存在
my_zlog_info
(
"target_7z_path:%s"
,
target_7z_path
);
// 检查文件是否存在
if
(
access
(
target_7z_path
,
F_OK
)
!=
0
)
{
if
(
access
(
target_7z_path
,
F_OK
)
!=
0
)
{
my_zlog_info
(
"video_proxy.7z not found, need download."
);
my_zlog_info
(
"video_proxy.7z not found, need download."
);
need_download_7z
=
1
;
need_download_7z
=
1
;
}
else
{
}
else
{
// 检查 Hash (使用 pythonHash)
// 检查 Hash (使用 pythonHash)
cJSON
*
pythonHash
=
cJSON_GetObjectItem
(
moreInfo
,
"pythonHash"
);
cJSON
*
pythonHash
=
cJSON_GetObjectItem
(
moreInfo
,
"pythonHash"
);
if
(
pythonHash
&&
cJSON_IsString
(
pythonHash
))
{
if
(
pythonHash
&&
cJSON_IsString
(
pythonHash
))
{
char
local_hash
[
65
]
=
{
0
};
char
local_hash
[
65
]
=
{
0
};
if
(
calculate_file_hash
(
target_7z_path
,
local_hash
)
==
0
)
{
if
(
calculate_file_hash
(
target_7z_path
,
local_hash
)
==
0
)
{
if
(
strcasecmp
(
local_hash
,
pythonHash
->
valuestring
)
!=
0
)
{
if
(
strcasecmp
(
local_hash
,
pythonHash
->
valuestring
)
!=
0
)
{
my_zlog_info
(
"7z Hash mismatch. Local: %s, Cloud: %s. Re-downloading..."
,
local_hash
,
goHash
->
valuestring
);
my_zlog_info
(
"7z Hash mismatch. Local: %s, Cloud: %s. Re-downloading..."
,
local_hash
,
goHash
->
valuestring
);
need_download_7z
=
1
;
need_download_7z
=
1
;
}
else
{
my_zlog_info
(
"7z Hash verified."
);
}
}
else
{
}
else
{
my_zlog_info
(
"7z Hash verified."
);
my_zlog_error
(
"Failed to calculate 7z local hash"
);
need_download_7z
=
1
;
}
}
}
else
{
}
else
{
my_zlog_error
(
"Failed to calculate 7z local hash"
);
my_zlog_warn
(
"goHash missing for 7z check"
);
need_download_7z
=
1
;
}
}
}
else
{
my_zlog_warn
(
"goHash missing for 7z check"
);
}
}
}
if
(
need_download_7z
)
{
if
(
need_download_7z
)
{
my_zlog_info
(
"Downloading 7z from: %s"
,
pythonUrl
->
valuestring
);
my_zlog_info
(
"Downloading 7z from: %s"
,
pythonUrl
->
valuestring
);
if
(
download_file
(
pythonUrl
->
valuestring
,
target_7z_path
)
==
0
)
{
if
(
download_file
(
pythonUrl
->
valuestring
,
target_7z_path
)
==
0
)
{
my_zlog_info
(
"Download 7z success. Preparing to extract..."
);
my_zlog_info
(
"Download 7z success. Preparing to extract..."
);
// 检查 7z 是否安装
// 检查 7z 是否安装
if
(
system
(
"which 7z > /dev/null 2>&1"
)
!=
0
)
{
if
(
system
(
"which 7z > /dev/null 2>&1"
)
!=
0
)
{
my_zlog_info
(
"7z not found. Installing p7zip-full..."
);
my_zlog_info
(
"7z not found. Installing p7zip-full..."
);
// 尝试安装 p7zip-full (Ubuntu)
// 尝试安装 p7zip-full (Ubuntu)
int
install_ret
=
system
(
"sudo apt-get update && sudo apt-get install -y p7zip-full"
);
int
install_ret
=
system
(
"sudo apt-get update && sudo apt-get install -y p7zip-full"
);
if
(
install_ret
!=
0
)
{
if
(
install_ret
!=
0
)
{
my_zlog_error
(
"Failed to install p7zip-full, return code: %d"
,
install_ret
);
my_zlog_error
(
"Failed to install p7zip-full, return code: %d"
,
install_ret
);
}
else
{
}
else
{
my_zlog_info
(
"p7zip-full installation completed successfully."
);
my_zlog_info
(
"p7zip-full installation completed successfully."
);
}
}
}
}
// 解压
// 解压
char
cmd
[
1024
];
char
cmd
[
1024
];
// 使用密码 fcrs2025606 解压, -y 自动覆盖, -o 指定输出目录
// 使用密码 fcrs2025606 解压, -y 自动覆盖, -o 指定输出目录
snprintf
(
cmd
,
sizeof
(
cmd
),
"7z x
\"
%s
\"
-o
\"
%s
\"
-pfcrs2025606 -y"
,
target_7z_path
,
target_dir
);
snprintf
(
cmd
,
sizeof
(
cmd
),
"7z x
\"
%s
\"
-o
\"
%s
\"
-pfcrs2025606 -y"
,
target_7z_path
,
target_dir
);
my_zlog_info
(
"Executing: %s"
,
cmd
);
my_zlog_info
(
"Executing: %s"
,
cmd
);
int
extract_ret
=
system
(
cmd
);
int
extract_ret
=
system
(
cmd
);
if
(
extract_ret
==
0
)
{
if
(
extract_ret
==
0
)
{
my_zlog_info
(
"Extraction success."
);
my_zlog_info
(
"Extraction success."
);
}
else
{
my_zlog_error
(
"Extraction failed with code: %d"
,
extract_ret
);
}
}
else
{
}
else
{
my_zlog_error
(
"Extraction failed with code: %d"
,
extract_ret
);
my_zlog_error
(
"Download 7z failed."
);
}
}
}
else
{
my_zlog_error
(
"Download 7z failed."
);
}
}
}
}
}
}
}
}
cJSON_Delete
(
root
);
cJSON_Delete
(
root
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment