On Mon, Nov 26, 2007 at 04:07:56AM -0800, Michel Lespinasse wrote:
> At this point I'm stuck - I can't see what's wrong with this read.
> Maybe the event interface somehow expects a read size != 16 on x86_64 ????

Turned out one must read 24 bytes on x86_64,
due to struct timeval differences.

This patch makes the remote work for me:

--- evdev.py.orig       2007-06-16 12:32:37.000000000 -0700
+++ evdev.py    2007-11-26 04:34:12.000000000 -0800
@@ -147,7 +147,7 @@
         '''
         '''
         buf = ioctl(self._fd, EVIOCGVERSION, "    ")
-        l, =  struct.unpack("L", buf)
+        l, =  struct.unpack("I", buf)
         return (l >> 16, (l >> 8) & 0xff, l & 0xff)
 
     def get_id(self):
@@ -182,7 +182,7 @@
         l = ((keys[-1] + 7) / 8 + 3) & ~0x3
 
         buf = ioctl(self._fd, EVIOCGBIT(0, l), " " * l)
-        array = struct.unpack("L" * (l/4), buf)
+        array = struct.unpack("I" * (l/4), buf)
 
         self._events = {}
 
@@ -203,7 +203,7 @@
             except IOError:
                 # No events for a type results in Errno 22 (EINVAL)
                 break
-            subarray = struct.unpack("L" * (sl/4), buf)
+            subarray = struct.unpack("I" * (sl/4), buf)
 
             for j in xrange(sl * 8):
                 if not subarray[j / 32] & (1 << j % 32):
@@ -224,13 +224,13 @@
         '''
         '''
         try:
-            buf = os.read(self._fd, 16)
+            buf = os.read(self._fd, struct.calcsize("LLHHi"))
         except OSError, (errno, str):
             if errno == 11:
                 return None
             raise
 
-        sec, usec, type, code, value = struct.unpack("LLHHl", buf)
+        sec, usec, type, code, value = struct.unpack("LLHHi", buf)
 
         return (float(sec) + float(usec)/1000000.0, _types[type], 
_events[type][code], value)
 
Hope this helps,

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-devel mailing list
Freevo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-devel

Reply via email to