Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 'no more updates from usbmuxd after the last device disconnects' problem #74

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

sam80180
Copy link

@sam80180 sam80180 commented Jan 6, 2024

Whether this PR is eventually merged or not, Sonic will thank you very much for your contribution.

无论此PR最终是否合并,Sonic组织都非常感谢您的贡献。

Checklist

  • The title starts with fix, fea, or doc. | 标题为fix、feat或doc开头。
  • I have checked that there are no duplicate pull requests with this request. | 我已检查没有与此请求重复的拉取请求。
  • I have considered and confirmed that this submission is valuable to others. | 我已经考虑过,并确认这份呈件对其他人很有价值。
  • I accept that this submission may not be used. | 我接受此提交可能不会被使用。

Description

When the last device disconnects, usbmuxd stops itself.
As a result, the 'sib devices listen' command (and any other function that uses usbmux listen function) no longer receives device status update.

Here's my workaround to this problem. Hope it helps.

@prlabeler prlabeler bot added the fix fix bugs label Jan 6, 2024
@sam80180 sam80180 changed the title fix: fix 'no more responses from usbmuxd after the last device discon… fix 'no more updates from usbmuxd after the last device disconnects' problem Jan 6, 2024
@ZhouYixun
Copy link
Member

In many places in sonic-agent, according to the output of fmt in sib, are you sure that changing to logrus will not affect it?

@sam80180
Copy link
Author

sam80180 commented Jan 8, 2024

logrus output is directed to stderr
(https://github.com/SonicCloudOrg/sonic-ios-bridge/blob/main/src/util/log.go#L14)

if you're worried, feel free to modify it to fmt

@ZhouYixun
Copy link
Member

logrus output is directed to stderr (https://github.com/SonicCloudOrg/sonic-ios-bridge/blob/main/src/util/log.go#L14)

if you're worried, feel free to modify it to fmt

It will make some sonic-agent bugs, could you modify it to fmt? I think logrus should record our running status as a local file at the same time, but console should output fmt only, please check other files

@sam80180
Copy link
Author

sam80180 commented Jan 8, 2024

Could you be more specific where it might cause problems?

@ZhouYixun
Copy link
Member

Could you be more specific where it might cause problems?

Some places rely on the console output of sib to do relevant logic. Of course, this processing method is not good enough. If it is changed to logrus, it will take more time for the console output to be output, which may cause some Agent problems.

@sam80180
Copy link
Author

sam80180 commented Jan 9, 2024

# save this as 'l.go'
package main
import (
	"fmt"
	"log"
	"github.com/SonicCloudOrg/sonic-ios-bridge/src/util"
	"github.com/sirupsen/logrus"
)
func main() {
	util.InitLogger("debug")
	log.Println("aaa")
	logrus.Info("bbb")
	fmt.Println("ccc")
}

then run go run l.go 2>/dev/null, you can see that fmt is not affected by logrus. therefore it should not affect agent's behavior.

@ZhouYixun
Copy link
Member

# save this as 'l.go'
package main
import (
	"fmt"
	"log"
	"github.com/SonicCloudOrg/sonic-ios-bridge/src/util"
	"github.com/sirupsen/logrus"
)
func main() {
	util.InitLogger("debug")
	log.Println("aaa")
	logrus.Info("bbb")
	fmt.Println("ccc")
}

then run go run l.go 2>/dev/null, you can see that fmt is not affected by logrus. therefore it should not affect agent's behavior.

could you show console output? I am busy now, sorry

@sam80180
Copy link
Author

sam80180 commented Jul 1, 2024

could you show console output? I am busy now, sorry

you should only see

2024/07/01 10:46:10 aaa
ccc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix fix bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants