rpms/libusb/devel libusb-0.1.12-wakeups.patch, NONE, 1.1 libusb.spec, 1.36, 1.37

Jindrich Novy (jnovy) fedora-extras-commits at redhat.com
Tue Dec 4 08:43:57 UTC 2007


Author: jnovy

Update of /cvs/extras/rpms/libusb/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv8617

Modified Files:
	libusb.spec 
Added Files:
	libusb-0.1.12-wakeups.patch 
Log Message:
- remove unnecessary 1ms wakeups while USB transfers are in progress,
  thanks to Scott Lamb (#408131)


libusb-0.1.12-wakeups.patch:

--- NEW FILE libusb-0.1.12-wakeups.patch ---
Remove unnecessary 1ms wakeups while USB transfers are in progress

--- linux.c.orig	2007-12-02 16:02:27.000000000 -0800
+++ linux.c	2007-12-02 16:33:12.000000000 -0800
@@ -14,6 +14,7 @@
 #include <errno.h>
 #include <sys/time.h>
 #include <dirent.h>
+#include <poll.h>
 
 #include "linux.h"
 #include "usbi.h"
@@ -164,7 +165,7 @@
 {
   struct usb_urb urb;
   int bytesdone = 0, requested;
-  struct timeval tv, tv_ref, tv_now;
+  struct timeval tv_ref, tv_now;
   struct usb_urb *context;
   int ret, waiting;
 
@@ -191,8 +192,6 @@
   }
 
   do {
-    fd_set writefds;
-
     requested = size - bytesdone;
     if (requested > MAX_READ_WRITE)
       requested = MAX_READ_WRITE;
@@ -213,25 +212,25 @@
       return ret;
     }
 
-    FD_ZERO(&writefds);
-    FD_SET(dev->fd, &writefds);
-
 restart:
     waiting = 1;
     context = NULL;
     while (!urb.usercontext && ((ret = ioctl(dev->fd, IOCTL_USB_REAPURBNDELAY, &context)) == -1) && waiting) {
-      tv.tv_sec = 0;
-      tv.tv_usec = 1000; // 1 msec
-      select(dev->fd + 1, NULL, &writefds, NULL, &tv); //sub second wait
+      struct pollfd pollfd;
+      int poll_timeout = -1;
+
+      pollfd.fd = dev->fd;
+      pollfd.events = POLLOUT;
+      pollfd.revents = 0;
 
       if (timeout) {
-        /* compare with actual time, as the select timeout is not that precise */
         gettimeofday(&tv_now, NULL);
-
-        if ((tv_now.tv_sec > tv_ref.tv_sec) ||
-            ((tv_now.tv_sec == tv_ref.tv_sec) && (tv_now.tv_usec >= tv_ref.tv_usec)))
-          waiting = 0;
+        poll_timeout = (tv_ref.tv_sec-tv_now.tv_sec)*1000 +
+                       (tv_ref.tv_usec-tv_now.tv_usec)/1000;
       }
+
+      if ((ret = poll(&pollfd, 1, poll_timeout)) != 1)
+        waiting = 0;
     }
 
     if (context && context != &urb) {


Index: libusb.spec
===================================================================
RCS file: /cvs/extras/rpms/libusb/devel/libusb.spec,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- libusb.spec	6 Nov 2007 11:24:43 -0000	1.36
+++ libusb.spec	4 Dec 2007 08:43:23 -0000	1.37
@@ -1,11 +1,12 @@
 Summary: A library which allows userspace access to USB devices
 Name: libusb
 Version: 0.1.12
-Release: 11%{?dist}
+Release: 12%{?dist}
 Source0: http://prdownloads.sourceforge.net/libusb/%{name}-%{version}.tar.gz
 Patch0: libusb-0.1.12-libusbconfig.patch
 Patch1: libusb-0.1.12-memset.patch
 Patch2: libusb-0.1.12-openat.patch
+Patch3: libusb-0.1.12-wakeups.patch
 License: LGPLv2+
 Group: System Environment/Libraries
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -41,6 +42,7 @@
 %patch0 -p1 -b .libusbconfig
 %patch1 -p1 -b .memset
 %patch2 -p1 -b .openat
+%patch3 -p0 -b .wakeups
 
 %build
 autoconf
@@ -80,6 +82,10 @@
 %{_libdir}/*.a
 
 %changelog
+* Tue Dec  4 2007 Jindrich Novy <jnovy at redhat.com> 0.1.12-12
+- remove unnecessary 1ms wakeups while USB transfers are in progress,
+  thanks to Scott Lamb (#408131)
+
 * Tue Nov  6 2007 Jindrich Novy <jnovy at redhat.com> 0.1.12-11
 - fix multilib conflict in manual.ps (#342461)
 - drop useless BR: gawk




More information about the fedora-extras-commits mailing list