Skip to content

Commit

Permalink
fix: optimize usbmuxd error handle
Browse files Browse the repository at this point in the history
  • Loading branch information
bitxeno committed Jun 24, 2024
1 parent f7af517 commit 7b6e5a7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ func CheckAfcService(ctx context.Context, id string) error {

var err error
if err = manager.CheckAfcServiceStatus(device.UDID); err != nil {
log.Infof("check afc service status error: %s", err)
// try restart usbmuxd to fix afc connect issue
if err = manager.RestartUsbmuxd(); err == nil {
time.Sleep(5 * time.Second)
Expand Down
3 changes: 2 additions & 1 deletion internal/task/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,8 @@ func (t *Task) RunImmediately(v model.InstalledApp) {
func (t *Task) runInternalRetry(v model.InstalledApp) error {
err := t.runInternal(v)
// AppleTV system has reboot/lockdownd sleep, try restart usbmuxd to fix
if err != nil && (strings.Contains(err.Error(), "LOCKDOWN_E_MUX_ERROR") || strings.Contains(err.Error(), "AFC_E_MUX_ERROR")) {
// LOCKDOWN_E_MUX_ERROR / AFC_E_MUX_ERROR /
if err != nil {
log.Info(i18n.LocalizeF("task.try_restart_usbmuxd", map[string]interface{}{"name": v.IpaName}))
if err = manager.RestartUsbmuxd(); err == nil {
log.Info(i18n.LocalizeF("task.try_restart_usbmuxd_success", map[string]interface{}{"name": v.IpaName}))
Expand Down

0 comments on commit 7b6e5a7

Please sign in to comment.