找回密码
 注册

QQ登录

只需一步,快速开始

查看: 414|回复: 5

hw_ctree.xml configuration in .bin?

[复制链接]
发表于 2024-11-13 23:45:40 | 显示全部楼层 |阅读模式
can i put hw_ctree.xml in .bin file flasher to make epon at the same time load the configuration?
( Y  w. e* B3 `% ?
发表于 2024-11-14 03:11:26 | 显示全部楼层
本人不懂英文;顶贴。
发表于 2024-11-14 03:24:24 | 显示全部楼层
you need to convert file content in hw_ctree.xml to binary data as output.bin2 p- @) K6 N- W7 K& \

8 H& ~, M; ?! W9 c" s7 p1 aPython:# }- N0 L2 ~) ]% N0 G

7 a/ T( @6 V6 @. N% P  W) r" S% A* x3 Jimport struct/ R. _2 h4 u( H. J' o# f6 g1 C
0 D7 b0 }) P: h$ K( Z
# to write in- ~" C) |4 A/ {+ q; a: M
data_to_write = "file content"  #file content of hw_ctree.xml) H8 T: k- M( t5 K% ?( W/ E0 G

6 X3 ^8 F& E! w" E$ I# open .bin to write- m1 B4 V: T2 ]! a* X# ^  k+ A
with open("output.bin", "wb") as bin_file:/ K( x! p# {- c8 U& Y
# to binary( `, ^1 ]0 @- k# E
   binary_data = data_to_write.encode('utf-8')8 P$ s5 E" T, Y! Z/ ]2 d3 ~
0 A0 H: Z  O$ n# S. `, i+ l/ e
# to .bin3 m6 W. M  I" \- r) k7 L" g. Z- y
    bin_file.write(binary_data)
# @6 N5 Z+ P( Z8 X- K
5 d9 m/ H# H) H#So do game over
发表于 2024-11-14 03:35:33 | 显示全部楼层
import struct; G$ w) V* E3 j9 n
with open('hw_ctree.xml', 'r') as file:  Z' }5 }+ m! U9 p8 t
    content = file.read()# c7 Z$ y9 V0 N, ~) h) `

' _( k5 L( B/ }: c" r9 c8 ], obinary_data = content.encode('utf-8')  B  K! |4 O3 W$ d) d7 G- Z6 v; I  H

4 d' g5 }* T* P! z4 Bwith open('output.bin', 'wb') as bin_file:+ d. T/ e2 ?- \+ h4 r% o% h8 p0 f% e
    bin_file.write(binary_data)
 楼主| 发表于 2024-11-14 04:02:26 | 显示全部楼层
zhang260gt 发表于 2024-11-14 03:355 p7 i3 y+ `, f$ b; ?
import struct5 v+ h5 M/ L& B: o4 w
with open('hw_ctree.xml', 'r') as file:# z5 X: H7 f, ~# `3 a. G
    content = file.read()

5 v7 J- A) k7 ~. P- mwhats this what app
发表于 2024-11-14 09:47:28 | 显示全部楼层
python 转二进制。厉害了
*滑块验证:
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|宽带技术网 |网站地图 粤公网安备44152102000001号

GMT+8, 2025-6-17 12:16 , Processed in 0.023197 second(s), 4 queries , Redis On.

Powered by Discuz! X3.5 Licensed

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表