Skip to content

Commit 4af99a5

Browse files
committed
fix crash when config transfer fails sometimes
1 parent d68fd5f commit 4af99a5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

screencapture/activator.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ func enableQTConfigSingleDevice(device IosDevice) error {
3232
if err != nil {
3333
return err
3434
}
35-
duration, _ := time.ParseDuration("500ms")
35+
3636
var i int
3737
for {
3838
log.Infof("Checking for active QT config for %s", udid)
39-
time.Sleep(duration)
39+
time.Sleep(500 * time.Millisecond)
4040
err = ctx.Close()
4141
if err != nil {
4242
log.Warn("failed closing context", err)
@@ -64,8 +64,7 @@ func sendQTConfigControlRequest(device IosDevice) error {
6464
val, err := device.usbDevice.Control(0x40, 0x52, 0x00, 0x02, response)
6565

6666
if err != nil {
67-
log.Fatal("Failed sending control transfer for enabling hidden QT config", err)
68-
return err
67+
log.Warn("Failed sending control transfer for enabling hidden QT config. Seems like this happens sometimes but it still works usually.", err)
6968
}
7069
log.Debugf("Enabling QT config RC:%d", val)
7170
return nil

0 commit comments

Comments
 (0)