-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tcpip and usb command for device services
- Loading branch information
Showing
4 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,5 @@ mod reverse; | |
mod send; | ||
mod stat; | ||
mod transport; | ||
mod tcpip; | ||
mod usb; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::{ | ||
models::AdbServerCommand, | ||
ADBServerDevice, Result, | ||
}; | ||
|
||
impl ADBServerDevice { | ||
/// Set adb daemon to tcpip mode | ||
pub fn tcpip(&mut self, port: u16) -> Result<()> { | ||
let serial = self.identifier.clone(); | ||
self.connect()? | ||
.send_adb_request(AdbServerCommand::TransportSerial(serial))?; | ||
|
||
self.get_transport_mut() | ||
.proxy_connection(AdbServerCommand::TcpIP(port), false) | ||
.map(|_| ()) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::{ | ||
models::AdbServerCommand, | ||
ADBServerDevice, Result, | ||
}; | ||
|
||
impl ADBServerDevice { | ||
/// Set adb daemon to usb mode | ||
pub fn usb(&mut self) -> Result<()> { | ||
let serial = self.identifier.clone(); | ||
self.connect()? | ||
.send_adb_request(AdbServerCommand::TransportSerial(serial))?; | ||
|
||
self.get_transport_mut() | ||
.proxy_connection(AdbServerCommand::USB, false) | ||
.map(|_| ()) | ||
} | ||
} |