Coder Social home page Coder Social logo

Comments (8)

electricbubble avatar electricbubble commented on June 3, 2024

你说的转发是指 gidevice forward?

如果是的话,可参考guia2 NewUSBDriver

from gadb.

ZhouYixun avatar ZhouYixun commented on June 3, 2024

你说的转发是指 gidevice forward?

如果是的话,可参考guia2 NewUSBDriver

不是,是adb远程connect的功能。
例如a机器启动某个服务,b机器可以通过a机器的ip+端口来adb connect连接

from gadb.

electricbubble avatar electricbubble commented on June 3, 2024

你说的 a机器 是指 Android 设备?

b机器 是指 PC?


如果只是 adbconnect 功能,👇

gadb/client_test.go

Lines 91 to 103 in 0080b6d

func TestClient_Connect(t *testing.T) {
adbClient, err := NewClient()
if err != nil {
t.Fatal(err)
}
SetDebug(true)
err = adbClient.Connect("192.168.1.28")
if err != nil {
t.Fatal(err)
}
}

gadb/client.go

Lines 132 to 145 in 0080b6d

func (c Client) Connect(ip string, port ...int) (err error) {
if len(port) == 0 {
port = []int{AdbDaemonPort}
}
var resp string
if resp, err = c.executeCommand(fmt.Sprintf("host:connect:%s:%d", ip, port[0])); err != nil {
return err
}
if !strings.HasPrefix(resp, "connected to") && !strings.HasPrefix(resp, "already connected to") {
return fmt.Errorf("adb connect: %s", resp)
}
return
}

from gadb.

ZhouYixun avatar ZhouYixun commented on June 3, 2024

你说的 a机器 是指 Android 设备?

b机器 是指 PC?

如果只是 adbconnect 功能,👇

gadb/client_test.go

Lines 91 to 103 in 0080b6d

func TestClient_Connect(t *testing.T) {
adbClient, err := NewClient()
if err != nil {
t.Fatal(err)
}
SetDebug(true)
err = adbClient.Connect("192.168.1.28")
if err != nil {
t.Fatal(err)
}
}

gadb/client.go

Lines 132 to 145 in 0080b6d

func (c Client) Connect(ip string, port ...int) (err error) {
if len(port) == 0 {
port = []int{AdbDaemonPort}
}
var resp string
if resp, err = c.executeCommand(fmt.Sprintf("host:connect:%s:%d", ip, port[0])); err != nil {
return err
}
if !strings.HasPrefix(resp, "connected to") && !strings.HasPrefix(resp, "already connected to") {
return fmt.Errorf("adb connect: %s", resp)
}
return
}

机器都是pc,就是可以将本pc的adb的设备转发出去。然后另一个pc可以通过adb connect来连接。这就是adbkit的一个功能

from gadb.

ZhouYixun avatar ZhouYixun commented on June 3, 2024

https://github.com/DeviceFarmer/adbkit/tree/master/src/adb/tcpusb 就是这里的

from gadb.

ZhouYixun avatar ZhouYixun commented on June 3, 2024

翻了下gadb没实现这个,但是我ts不太熟哈哈哈,不知道你感兴趣吗

from gadb.

electricbubble avatar electricbubble commented on June 3, 2024

就是可以将本pc的adb的设备转发出去。然后另一个pc可以通过adb connect来连接。

实现一个 proxy 就行了,不难,
但这功能不符合本项目的实现目的

from gadb.

ZhouYixun avatar ZhouYixun commented on June 3, 2024

就是可以将本pc的adb的设备转发出去。然后另一个pc可以通过adb connect来连接。

实现一个 proxy 就行了,不难, 但这功能不符合本项目的实现目的

嗯明白,那我自己试下

from gadb.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.