Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d0e0f46571 | ||
|
|
727f3a3eb4 | ||
|
|
ab77db5cc8 | ||
|
|
1255f2b5d6 | ||
|
|
eb04f9064c | ||
|
|
69107e2333 |
29
.github/workflows/python-build.yml
vendored
29
.github/workflows/python-build.yml
vendored
@@ -7,43 +7,28 @@ on:
|
||||
types: [created]
|
||||
|
||||
jobs:
|
||||
gen-stubs:
|
||||
name: "build-release"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Build project
|
||||
run: cargo run --bin stub_gen
|
||||
|
||||
build-python-packages:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Build Python stubs
|
||||
run: cargo run --bin stub_gen
|
||||
|
||||
- name: Install Python build dependencies
|
||||
run: pip install maturin==1.8.2
|
||||
|
||||
- name: Build Python packages
|
||||
run: maturin build --release -m pyadb_client/Cargo.toml --compatibility manylinux_2_25 --auditwheel=skip
|
||||
|
||||
publish-python-packages:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-python-packages]
|
||||
if: github.event_name == 'release' && github.event.action == 'created'
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Python build dependencies
|
||||
run: pip install maturin==1.8.2
|
||||
run: maturin build --sdist --release -m pyadb_client/Cargo.toml
|
||||
|
||||
- name: Publish Python packages
|
||||
run: maturin publish -m pyadb_client/Cargo.toml --non-interactive --compatibility manylinux_2_25 --auditwheel=skip
|
||||
if: github.event_name == 'release' && github.event.action == 'created'
|
||||
run: maturin publish -m pyadb_client/Cargo.toml --non-interactive
|
||||
env:
|
||||
MATURIN_PYPI_TOKEN: ${{ secrets.MATURIN_PYPI_TOKEN }}
|
||||
|
||||
- name: "Publish GitHub artefacts"
|
||||
if: github.event_name == 'release' && github.event.action == 'created'
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
files: |
|
||||
|
||||
@@ -9,7 +9,7 @@ homepage = "https://github.com/cocool97/adb_client"
|
||||
keywords = ["adb", "android", "tcp", "usb"]
|
||||
license = "MIT"
|
||||
repository = "https://github.com/cocool97/adb_client"
|
||||
version = "2.1.6"
|
||||
version = "2.1.8"
|
||||
|
||||
# To build locally when working on a new release
|
||||
[patch.crates-io]
|
||||
|
||||
@@ -38,18 +38,26 @@ impl ADBTcpDevice {
|
||||
|
||||
self.get_transport_mut().write_message(message)?;
|
||||
|
||||
// At this point, we should have received a STLS command indicating that the device wants to upgrade connection with TLS
|
||||
self.get_transport_mut()
|
||||
.read_message()
|
||||
.and_then(|message| message.assert_command(MessageCommand::Stls))?;
|
||||
let message = self.get_transport_mut().read_message()?;
|
||||
|
||||
self.get_transport_mut()
|
||||
.write_message(ADBTransportMessage::new(MessageCommand::Stls, 1, 0, &[]))?;
|
||||
|
||||
// Upgrade TCP connection to TLS
|
||||
self.get_transport_mut().upgrade_connection()?;
|
||||
|
||||
log::debug!("Connection successfully upgraded from TCP to TLS");
|
||||
// Check if client is requesting a secure connection and upgrade it if necessary
|
||||
match message.header().command() {
|
||||
MessageCommand::Stls => {
|
||||
self.get_transport_mut()
|
||||
.write_message(ADBTransportMessage::new(MessageCommand::Stls, 1, 0, &[]))?;
|
||||
self.get_transport_mut().upgrade_connection()?;
|
||||
log::debug!("Connection successfully upgraded from TCP to TLS");
|
||||
}
|
||||
MessageCommand::Cnxn => {
|
||||
log::debug!("Unencrypted connection established");
|
||||
}
|
||||
_ => {
|
||||
return Err(crate::RustADBError::WrongResponseReceived(
|
||||
"Expected CNXN or STLS command".to_string(),
|
||||
message.header().command().to_string(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ use crate::{DeviceState, RustADBError};
|
||||
use regex::bytes::Regex;
|
||||
|
||||
static DEVICES_LONG_REGEX: LazyLock<Regex> = LazyLock::new(|| {
|
||||
Regex::new("^(?P<identifier>\\S+)\\s+(?P<state>\\w+) ((usb:(?P<usb1>.*)|(?P<usb2>\\d-\\d)) )?(product:(?P<product>\\w+) model:(?P<model>\\w+) device:(?P<device>\\w+) )?transport_id:(?P<transport_id>\\d+)$").expect("cannot build devices long regex")
|
||||
Regex::new(r"^(?P<identifier>\S+)\s+(?P<state>\w+)\s+(usb:(?P<usb1>\S+)|(?P<usb2>\S+))?\s*(product:(?P<product>\w+)\s+model:(?P<model>\w+)\s+device:(?P<device>\w+)\s+)?transport_id:(?P<transport_id>\d+)$").expect("cannot build devices long regex")
|
||||
});
|
||||
|
||||
/// Represents a new device with more informations.
|
||||
|
||||
@@ -1,26 +1,30 @@
|
||||
[package]
|
||||
name = "pyadb_client"
|
||||
description = "Python wrapper for adb_client library"
|
||||
authors.workspace = true
|
||||
description = "Python wrapper for adb_client library"
|
||||
edition.workspace = true
|
||||
homepage.workspace = true
|
||||
keywords.workspace = true
|
||||
license.workspace = true
|
||||
name = "pyadb_client"
|
||||
readme = "README.md"
|
||||
repository.workspace = true
|
||||
version.workspace = true
|
||||
readme = "README.md"
|
||||
|
||||
[lib]
|
||||
name = "pyadb_client"
|
||||
crate-type = ["cdylib", "rlib"]
|
||||
name = "pyadb_client"
|
||||
|
||||
[[bin]]
|
||||
name = "stub_gen"
|
||||
doc = false
|
||||
name = "stub_gen"
|
||||
|
||||
[dependencies]
|
||||
adb_client = { path = "../adb_client" }
|
||||
anyhow = { version = "1.0.95" }
|
||||
adb_client = { version = "2.1.5" }
|
||||
pyo3 = { version = "0.23.4", features = ["extension-module", "anyhow", "abi3-py37"] }
|
||||
pyo3 = { version = "0.23.4", features = [
|
||||
"abi3-py37",
|
||||
"anyhow",
|
||||
"extension-module",
|
||||
] }
|
||||
pyo3-stub-gen = "0.7.0"
|
||||
pyo3-stub-gen-derive = "0.7.0"
|
||||
pyo3-stub-gen-derive = "0.7.0"
|
||||
|
||||
@@ -42,7 +42,10 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_static_devices_long() {
|
||||
let inputs = ["7a5158f05122195aa device 1-5 product:gts210vewifixx model:SM_T813 device:gts210vewifi transport_id:4"];
|
||||
let inputs = ["7a5158f05122195aa device 1-5 product:gts210vewifixx model:SM_T813 device:gts210vewifi transport_id:4",
|
||||
"n311r05e device usb:0-1.5 product:alioth model:M2012K11AC device:alioth transport_id:58",
|
||||
"192.168.100.192:5555 device product:alioth model:M2012K11AC device:alioth transport_id:97",
|
||||
"emulator-5554 device product:sdk_gphone64_arm64 model:sdk_gphone64_arm64 device:emu64a transport_id:101"];
|
||||
for input in inputs {
|
||||
DeviceLong::try_from(input.as_bytes().to_vec())
|
||||
.expect(&format!("cannot parse input: '{input}'"));
|
||||
|
||||
Reference in New Issue
Block a user