hughsie / libgusb

GUsb is a GObject wrapper for libusb1
GNU Lesser General Public License v2.1
25 stars 21 forks source link

GUsbEventThread spins, draining battery #24

Closed heftig closed 4 years ago

heftig commented 4 years ago

The fwupd daemon's GUsbEventThread polls 1000 times per second, which is a measurable battery drain.

fwupd 1.3.6 libgusb 0.3.2

hughsie commented 4 years ago

Is this on Linux or Windows? I think we should only be doing the libusb polling on non-Linux.

hughsie commented 4 years ago

Also, do you get a log message platform does not do hotplug, using polling if you run fwupd as root with --verbose?

heftig commented 4 years ago

This is on Arch Linux. No, I do not get that message.

Also, the polling done with g_usb_context_rescan_cb would only be scheduled once per second. My problem seems to be the loop in g_usb_context_event_thread_cb, which polls with a timeout of 1000 usec.