Skip to content

Commit c8c5481

Browse files
committed
Serial number support
1 parent f0366f9 commit c8c5481

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

Cmd_Env.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ std::vector<std::string> env_list = {
2626
"allow_write",
2727
"app_name",
2828
"app_version",
29+
"serial",
2930

3031
"reboot_count",
3132
"watchdog_failed_count",
@@ -41,6 +42,7 @@ enum {
4142

4243
EnvType_str, EnvType_bin,
4344
};
45+
4446
std::unordered_map<std::string, std::tuple<uint8_t, uint8_t, uint8_t, uint8_t>> env_table = {
4547
// Category, Type, Offset, Size
4648
{"watchdog_config", {0, EnvType_u8, 1, 1}},
@@ -49,6 +51,7 @@ std::unordered_map<std::string, std::tuple<uint8_t, uint8_t, uint8_t, uint8_t>>
4951
{"allow_write", {0, EnvType_u32, 8, 4}},
5052
{"app_name", {0, EnvType_str, 12, 16}},
5153
{"app_version", {0, EnvType_str, 28, 8}},
54+
{"serial", {0, EnvType_str, 36, 16}},
5255

5356
{"reboot_count", {1, EnvType_u32, 0, 4}},
5457
{"watchdog_failed_count", {1, EnvType_u32, 4, 4}},

Cmd_Info.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,15 @@ int Command_Info(const std::vector<std::string>& args) {
6666
printf("Chip name: %s\n", info_chip.data());
6767
printf("Chip Manufacturer: %s\n", info_chip_mf.data());
6868

69+
uint8_t cat = 0;
70+
auto env_block0 = serial_chat(tty, FlasherCommand_EnvironmentRead, &cat);
71+
72+
if (env_block0.size() >= 52) {
73+
printf("Serial: ");
74+
fflush(stdout);
75+
write(STDOUT_FILENO, env_block0.data()+36, 16);
76+
puts("");
77+
}
78+
6979
return 0;
7080
}

ScanDevice.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ std::vector<std::string> ScanDevice_GetValidDevices() {
6060

6161
try {
6262
tty.make_raw();
63-
tty.speed() = 2000000;
6463
} catch (...) {
6564
#ifndef __CYGWIN__
6665
continue;

0 commit comments

Comments
 (0)