Closed ghost closed 8 months ago
Just to second this, using libusb 1.0.24-2
on Manjaro linux and gousb v1.1.1
Thanks for reporting it. I encountered this issue on Linux and I don't seem to find any problem with USB communication. It is probably just a debug log.
Also thanks malc0mn for the suggestion. I just updated libusb.go and disabled this log.
Is there a way to remove this error?
I am using this stdlog.SetOutput(new(LogrusWriter))
where stdlog is the regular golang logger import stdlog "log"
and
type LogrusWriter int
const interruptedError = "interrupted [code -10]"
func (LogrusWriter) Write(data []byte) (int, error) {
logmessage := string(data)
if strings.Contains(logmessage, interruptedError) {
log.Tracef("gousb_logs:%s", logmessage)
return len(data), nil
}
log.Infof("gousb_logs:%s", logmessage)
return len(data), nil
}
it is a workaround for Logrus, but you can probably adapt it to whatever you are using.
I am using this
stdlog.SetOutput(new(LogrusWriter))
where stdlog is the regular golang loggerimport stdlog "log"
andtype LogrusWriter int const interruptedError = "interrupted [code -10]" func (LogrusWriter) Write(data []byte) (int, error) { logmessage := string(data) if strings.Contains(logmessage, interruptedError) { log.Tracef("gousb_logs:%s", logmessage) return len(data), nil } log.Infof("gousb_logs:%s", logmessage) return len(data), nil }
it is a workaround for Logrus, but you can probably adapt it to whatever you are using.
Thank you!
Same here in linux:
github.com/google/gousb/libusb.go:191: handle_events: error: libusb: interrupted [code -10]
I'm also getting the same error log while erasing the device, and the erasing process is very slow in golang compared to python code. I think the slowness of the erase process is because of the same error.
PS: I converted the python code to golang code manually.
Same here in macOS 14.1.1:
2023/12/04 00:58:46 handle_events: error: libusb: interrupted [code -10]
It seems working properly, just annoying messages.
Related gousb code: https://github.com/google/gousb/blob/844d4b8a718f46eb580a7a84afa00eb15c1b7a9a/libusb.go#L182-L194
Recently I have seen a lot of these errors:
handle_events: error: libusb: interrupted [code -10]
on Mac OS X and Linux with the latest LibUsbThis actually just seems to be a return code from libusb handle_events_with_timeout, that does not really indicate an error but just that the eventhandler was interrupted. Maybe this should be a debug log? Right now it seems like something is broken, while actually everything works as expected.