#goadb
A Golang library for interacting with the Android Debug Bridge (adb).
See demo.go for usage.
A Golang library for interacting with adb.
License: Apache License 2.0
#goadb
A Golang library for interacting with the Android Debug Bridge (adb).
See demo.go for usage.
I want to run the adb command adb shell, and into the interactive env. I want to input the subcommand : getevent and watch the output info to get the device mouse positions.
I have 4 devices plugged in, and can successfully retrieve with adb CLI
cpu12454@cpu12454-B360M-AORUS-Gaming-3:~$ adb devices -l
List of devices attached
330055a244c72319 device usb:1-5 product:a5xeltexx model:SM_A510F device:a5xelte transport_id:2
3300b0e061f593e9 device usb:1-1 product:on7xeltedd model:SM_G610F device:on7xelte transport_id:1
52004c98eea95419 device usb:1-2 product:j7y17ltedx model:SM_J730G device:j7y17lte transport_id:3
c9acd3c9 device usb:1-6 product:j6primeltedd model:SM_J610F device:j6primelte transport_id:4
But goadb
only return 3 of them:
Nov 23 18:40:15 cpu12454-B360M-AORUS-Gaming-3 device-manager[2040320]: {"Serial":"330055a244c72319","Product":"a5xeltexx","Model":"SM_A510F","DeviceInfo":"a5xelte","Usb":"1-5"}
Nov 23 18:40:15 cpu12454-B360M-AORUS-Gaming-3 device-manager[2040320]: {"Serial":"3300b0e061f593e9","Product":"on7xeltedd","Model":"SM_G610F","DeviceInfo":"on7xelte","Usb":"1-1"}
Nov 23 18:40:15 cpu12454-B360M-AORUS-Gaming-3 device-manager[2040320]: {"Serial":"52004c98eea95419","Product":"j7y17","Model":"","DeviceInfo":"","Usb":"1-2"}
I have 2 machines, each has 4 devices plugged in. Both of them have the same problem. It seems that they are ignoring the last device returned from adb.
Any idea how to resolve this problem?
It seems there is a sort of integer overflow when attempting to query sizes of large files (>5GB).
For example:
$ du -b 5gb.img
5368709120 5gb.img
(Trying to get size for this file via (DirEntry).Size returns 1073741824)
$ du -h 6gb.img
6442450944 6gb.img
(Trying to get size for this file via (DirEntry).Size returns -2147483648)
$ du -h 10gb.img
10737418240 10gb.img
(Trying to get size for this file via (DirEntry).Size returns -2147483648)
Note: Range of int32 is -2147483648 through 2147483647.
Any workarounds/solutions to get the proper sizes?
Command Line:
adb devices -l
List of devices attached
9591163035000RU device product:PD2085 model:V2085A device:PD2085 transport_id:24
a9bdcc8c device product:PD1821 model:V1821A device:PD1821 transport_id:23
10.13.209.82:9999 device product:PD2085 model:V2085A device:PD2085 transport_id:19
demo.go:
Starting server…
Server version: 41
panic: runtime error: index out of range [1] with length 1
goroutine 1 [running, locked to thread]:
github.com/zach-klippenstein/goadb.parseKeyVal(...)
~/go/pkg/mod/github.com/zach-klippenstein/[email protected]/device_info.go:86
github.com/zach-klippenstein/goadb.parseDeviceAttributes({0xc0004a40e0, 0x4, 0xc0004aa000?})
~/go/pkg/mod/github.com/zach-klippenstein/[email protected]/device_info.go:77 +0x125
github.com/zach-klippenstein/goadb.parseDeviceLong({0xc0004aa000?, 0xc0004a20b0?})
~/go/pkg/mod/github.com/zach-klippenstein/[email protected]/device_info.go:70 +0x4f
github.com/zach-klippenstein/goadb.parseDeviceList({0xc0004a0100, 0xff}, 0xa21a68)
~/go/pkg/mod/github.com/zach-klippenstein/[email protected]/device_info.go:47 +0x132
github.com/zach-klippenstein/goadb.(*Adb).ListDevices(0xc00033aaa0)
~/go/pkg/mod/github.com/zach-klippenstein/[email protected]/adb.go:130 +0x56
main.main()
~/test_goadb.go:39 +0x2b1
OSX 10.10.5
Platform tools 23.0.1
how to exec adb root command
$ adb connect
$ adb disconnect
Hi there,
func (c _Device) Stat(path string) (_DirEntry, error), this function takes almost 2 seconds to stat a file on device. while it takes only serveral ms for "adb shell test -f xxx.x". Could this function be optimized?
Hello,when i launch 3 emulator i received error from ListDevices function while in terminal adb devices command working nice.
When i run 2 device there is no like issue
Any help about this problem?
My code for listing devices
client,err := adb.New()
if err != nil {
fmt.Fprintf(os.Stderr, "error New adb: %v\n", err)
return
}
b_devices,err := client.ListDevices()
if err != nil {
fmt.Fprintf(os.Stderr, "error ListDevices adb: %v\n", err)
return
}
received error message
error ListDevices adb: ParseError: error performing ListDevices on *adb.Adb (&{server:0xc0001320f0})
adb is getting support for differentiating stdout and stderr streams, and process exit codes.
Implementation:
https://github.com/android/platform_system_core/blob/ac50d0cc5789d8462fcd2d9f6cb225e0edf9a12f/adb/shell_service.h
https://github.com/android/platform_system_core/blob/ac50d0cc5789d8462fcd2d9f6cb225e0edf9a12f/adb/shell_service.cpp
RunCommand
should still be supported for combined stdin/stdout streams, but there should be an API like exec.Cmd
. The old mode is called "PTY" mode, and RunCommand
should probably use that. The new mode is called "protocol" mode, and multiplexes out/err streams over a single connection with a simple protocol that sends packets with stream ID headers.
The exit code is sent as a single raw byte on the kIdExit
stream.
Get the below error when I try to go build
on windows:
$ go build
# github.com/zach-klippenstein/goadb
.\server.go:140: undefined: unix.Access
.\server.go:140: undefined: unix.X_OK
The unix package is not available on windows. Need conditional compilation. I don't see any reason this library cannot be supported on windows.
Sorry in advance for the newbie question. I am new to go and new to goadb.
I am trying to build the demo.go app on Windows and while I did do the requisite go get's for both goadb and the internal/errors I see this error:
C:\goadb>go build demo.go
demo.go:11:2: no required module provides package github.com/zach-klippenstein/goadb: working directory is not part of a module
demo.go:12:2: no required module provides package github.com/zach-klippenstein/goadb/internal/errors: working directory is not part of a module
Can someone help or point me to any link to get me started?
Thanks,
Will
When you have a lot of the same mobile phone,serial
is same,please tell me how to distinguish between them and connect them?thinks
whenever we try to execute adb command on windows using goadb .. it is opening command line for sometime and then closing it after the adb command execution.
how can i change this behaviour and stop goadb from opening cmd window ?
we are using "windows 10". and goadb version "v0.0.0-20201208042340-620e0e950ed7"
Hi, Im a new golang coder,
when I build demo.go, this issue be appeared
Can anyone help me to resolve it
Thansk
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.