FindDeviceByID dose not work
Closed this issue · 1 comments
lijinmin commented
`
id := "FA68B0301122"
device, err := mgr.FindDeviceByID(id)
if err != nil {
log.Error(err)
return
}
//device.
log.Debug(device.Name(), device.ID())
session, err := device.Attach("rock_paper_scissors", nil)
if err != nil {
log.Error(err)
return
}
`
then I got:
[error] could not attach for nil device
but if i change the codes like this:
`
id := "FA68B0301122"
device, err := mgr.FindDeviceByID(id)
if err != nil {
log.Error(err)
return
}
//device.
log.Debug(device.Name(), device.ID())
if device.Name() == "" {
devices, err := mgr.EnumerateDevices()
if err != nil {
log.Error(err)
return
}
for _, d := range devices {
if d.ID() == id {
device = d
break
}
}
}
log.Debug(device.Name(), device.ID())
session, err := device.Attach("rock_paper_scissors", nil)
if err != nil {
log.Error(err)
return
}
`
it works
[debug] Pixel FA68B0301122
NSEcho commented
Hey, that is by Frida's design because signals for device are not triggered until EnumerateDevices
is called