Add parsing for DebugInit
This commit is contained in:
parent
3070e42945
commit
ebda011bc7
1 changed files with 14 additions and 10 deletions
|
@ -351,17 +351,21 @@ impl Device{
|
||||||
self.usb_tty.write_to_device(Command::Login);
|
self.usb_tty.write_to_device(Command::Login);
|
||||||
while self.usb_tty.read_from_device(None) != Response::ShellPrompt {}
|
while self.usb_tty.read_from_device(None) != Response::ShellPrompt {}
|
||||||
self.usb_tty.write_to_device(Command::GetSerial);
|
self.usb_tty.write_to_device(Command::GetSerial);
|
||||||
match self.usb_tty.read_from_device(None){
|
loop{
|
||||||
Response::Serial(Some(contains_serial)) =>{
|
match self.usb_tty.read_from_device(None){
|
||||||
for line in contains_serial.split("\n").collect::<Vec<&str>>(){
|
Response::Serial(Some(contains_serial)) =>{
|
||||||
if !line.contains(':') { continue; }
|
for line in contains_serial.split("\n").collect::<Vec<&str>>(){
|
||||||
let (section,value) = line.split_once(':').unwrap();
|
if !line.contains(':') { continue; }
|
||||||
if section.contains(SERIAL_HEADER){
|
let (section,value) = line.split_once(':').unwrap();
|
||||||
self.serial = value.trim().replace("\"","");
|
if section.contains(SERIAL_HEADER){
|
||||||
|
self.serial = value.trim().replace("\"","");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
},
|
},
|
||||||
_ => todo!(),
|
Response::DebugInit => { continue; }
|
||||||
|
_ => todo!(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.reboot();
|
self.reboot();
|
||||||
//self.serial = serial.to_string();
|
//self.serial = serial.to_string();
|
||||||
|
|
Loading…
Add table
Reference in a new issue